FreeOrion

Forums for the FreeOrion project
It is currently Sun May 19, 2013 8:15 am

All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Status of Python integration
PostPosted: Sun Aug 31, 2003 10:55 am 
Offline
Programmer
User avatar

Joined: Sat Jun 28, 2003 8:17 pm
Posts: 376
Location: Heidelberg, Germany
Yesterday I finally managed to take some time working on FO, the Python part mainly. After experimenting and trying to understand the bad (IMHO) documentation of Boost.Python, I finally managed to get started. I exposed TechLevel and TechManager to Python, here is an sample run:
Code:
>>> from balla import *
>>> TM = TechManager.instance()
>>> TM.LoadTechTree("dummy")
1
>>> for tech in TM:
...     print tech.GetName(), tech.GetMinPts()
...
Defense Base 350
Mark II 250
Mark III 750
Mark IV 1650
Right now, I mirror the C++-interface, but later on I will do it in a more "pythonic way", for example, TM=TechManager.instance() would not be neccesary, TechManager could be used instead. And tech.GetName will of course become (read-only) tech.Name.
I will work on a more complex demo how python can help us. For now, I think I will code the System-generation


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 31, 2003 5:16 pm 
Offline
Creative Contributor

Joined: Thu Jun 26, 2003 4:33 pm
Posts: 226
Location: Baltimore, MD
I thought that we were only thinking of using python to implement logic things that we want to be able to tweak (like effects of technology, specials, etc) Why do system generation in python? Particularly when it's already coded in C++ (for irregular galaxies)

_________________
Empire Team Lead


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 31, 2003 6:48 pm 
Offline
Programmer
User avatar

Joined: Sat Jun 28, 2003 8:17 pm
Posts: 376
Location: Heidelberg, Germany
jbarcz1 wrote:
I thought that we were only thinking of using python to implement logic things that we want to be able to tweak (like effects of technology, specials, etc) Why do system generation in python? Particularly when it's already coded in C++ (for irregular galaxies)
Yes, it would be only an example. I thought of using system generation so we all have a comparison between how things are done in Python and what the relevant C++-code would look like


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 03, 2003 9:54 pm 
Offline
Programmer
User avatar

Joined: Sat Jun 28, 2003 8:17 pm
Posts: 376
Location: Heidelberg, Germany
Current status: stalled (again)

This stupid ReiserFS randomized it's tree structure again. I will have to get a second hard-disk to do a backup before I can try to repair the filesystem.

This might take a little time, sorry.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 06, 2003 3:52 pm 
Offline
FreeOrion Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 6:23 am
Posts: 883
Location: Australia
I personally am still very keen to see python integrated - or at least evaluated fairly once we can see first hand how it will benefit us.

That's why I'd like to not lay this issue to rest yet until after Yoghurt completes his demo. I'm currently working through http://www.diveintopython.org and it's looking pretty good.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 07, 2003 12:03 am 
Offline
Programmer
User avatar

Joined: Sat Jun 28, 2003 8:17 pm
Posts: 376
Location: Heidelberg, Germany
My computer works again!

I will now continue to work on the Python thing. Suggestions are welcome.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 07, 2003 12:40 am 
Offline
Programming Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 1:33 pm
Posts: 1092
My only suggestion is ext3fs. Heh.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 07, 2003 6:20 am 
Offline
FreeOrion Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 6:23 am
Posts: 883
Location: Australia
tzlaine wrote:
My only suggestion is ext3fs. Heh.


Bah, Yoghurt must be incompetent! reiserfs never hurt anyone :) I give a thumbs up to journalling in either fs though, very nice. Especially with the crashing my new video card gives :(


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 07, 2003 12:23 pm 
Offline
Programmer
User avatar

Joined: Sat Jun 28, 2003 8:17 pm
Posts: 376
Location: Heidelberg, Germany
ReiserFS is more stable than ext2, and IRRC, also faster.

It is also very hard to get Reiser to data corruption, but if it happens, it's really f*cked up, I needed to do a rebuild-tree 3 times till I have installed Reiser, and 2 of the 3 times I "lost" about half of my data (which was backuped of course)

Zach, I will implement ext3fs in Python for FO, but will we really need it? :twisted:


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 07, 2003 1:24 pm 
Offline
FreeOrion Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 6:23 am
Posts: 883
Location: Australia
Yoghurt wrote:
ReiserFS is more stable than ext2, and IRRC, also faster.
It is also very hard to get Reiser to data corruption, but if it happens, it's really f*cked up, I needed to do a rebuild-tree 3 times till I have installed Reiser, and 2 of the 3 times I "lost" about half of my data (which was backuped of course)


What is a rebuild-tree? I've never used that with reiserfs. However, I have noticed something disturbing a couple of times - XFree has crashed, and my XF86Config file has been completely borked. Almost never happens - has happened twice. Also vim config file was borked once.

ReiserFS is supposed to be a fair bit faster with filesystems containing lots of smaller files, iirc. From the glance of a beginner's eyes at the future of reiserfs, looks pretty exciting.

Yoghurt wrote:
Zach, I will implement ext3fs in Python for FO, but will we really need it? :twisted:


Hmm, that gives me an idea. Why don't we just make FO as a plugin for Emacs? I'm sure there's some code in there we could build off :twisted: :twisted: Otherwise, we could have FO compete with Emacs.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 07, 2003 5:28 pm 
Offline
Programming Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 1:33 pm
Posts: 1092
Mmmm, Emacs... [drools on self].


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 12:34 pm 
Offline
Programmer
User avatar

Joined: Sat Jun 28, 2003 8:17 pm
Posts: 376
Location: Heidelberg, Germany
tyreth wrote:
Hmm, that gives me an idea. Why don't we just make FO as a plugin for Emacs? I'm sure there's some code in there we could build off :twisted: :twisted: Otherwise, we could have FO compete with Emacs.
Either that, or we could you Emacs-like key-combinations. I can alreay imagine the first page of the FreeOrion Tutorial.
Quote:
First of all, we will have to select a scout ship to explore. We achieve this by Pressing C-M-X M-T Y z (thats a small z!) C-U S 1.
... To quit the game, simple press C-x C-f C-q q y RET
Maybe we can get the FSF-Award!
:roll:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 10, 2003 12:19 pm 
Offline
Programmer
User avatar

Joined: Sat Jun 28, 2003 8:17 pm
Posts: 376
Location: Heidelberg, Germany
Status: on-going.

Yesterday I finally managed to checkout the CVS version of Pyste (the wrapper-generator) which works better than the version in boost 1.30.0, however, I stumbled upon some misterious compilation errors that lead to an internal g++ compiler error :-(

As you might now, the error messages that are produced when STL and other template-heavy stuff (which Boost.Python is) are no more infomative than line noise (I got around 20K of error messages)

Nevertheless, I'm confident that Python-integration will reach alpha in a few weeks, hopefully less.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 21, 2003 1:43 am 
Offline
Programmer
User avatar

Joined: Sat Jun 28, 2003 8:17 pm
Posts: 376
Location: Heidelberg, Germany
Update: with the new build system. Python should fit in nicely.

It still will take some time before the alpha (sorry, sorry, sorry), but the FreeOrion files are a stress-test for the automatic wrapper generators. I stopped counting the "internal compiler errors" of GCCXML.

But it'll be done soon.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2003 1:35 pm 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 27, 2003 2:35 am
Posts: 383
Location: Texas
Hey Yoghurt,

This weekend (after all my tests etc.) I'll have a bit of free time, and wanted to start on some primitive colonizing AI. I'll be doing it in python and so i need to know how to structure the program. It will need 2 inputs, one is easy, The number of stars. the second one is more difficult. It needs to know which stars are connected by starlanes to which other stars. The output will consist of 2 NxN matricies where N is the number of stars.

The idea is to create an adjacency matrix that will give the AI a way to tell distance (in starlane hops) between any two stars on the galaxy map as an aid in colonizing and eventually attack effectively. This module coupled with a set of weights or something similiar ought to be pretty good until races are integrated and the tech tree is expanded. Just give me an outline to follow and i'll (try) to take care of the rest.

_________________
Aquitaine is my Hero.... ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group