Page 2 of 3

Re: AI programming

Posted: Sat Mar 22, 2008 5:10 pm
by freereign
Alright. I will work on that. I will probably have to some of it in Windows, so that I can compile the game from source. (still working on getting that done in ubuntu hardy)

Re: AI programming

Posted: Sat Mar 22, 2008 10:20 pm
by eleazar
freereign wrote:On the other hand, if the citizens are anti-technology (like the Amish, sorta) then priorities would shift and Production would have a higher priority than Research.
I don't know how much of the design threads you've been reading, but yes, we're leaning strongly towards having citizens will approve or disapprove of various things like war/peace, industry, spying, science etc.

Re: AI programming

Posted: Sun Mar 23, 2008 12:12 pm
by freereign
Yes, I had read some threads on that idea. That's how I came up with it. Anyway, I am going to get the basics done (get current output for each resource, get current requirement for each resource)

This is probably a simple question, but do minerals, industry, and research have requirements? I have never noticed those in the games I've played.

Re: AI programming

Posted: Sun Mar 23, 2008 7:10 pm
by Geoff the Medio
freereign wrote:...do minerals, industry, and research have requirements?
I don't understand the question... what are or would be requirements for minerals, industry and research?

Re: AI programming

Posted: Sun Mar 23, 2008 8:33 pm
by freereign
I mean are there requirements for them. If you do not meet these requirements, there is a penalty (like there is for food).

I don't think there is, but I wanted to make sure I hadn't missed it.

Re: AI programming

Posted: Sun Mar 23, 2008 8:47 pm
by Geoff the Medio
If you don't have minerals and industry or research, you can't produce things or research techs.

Re: AI programming

Posted: Mon Mar 24, 2008 3:20 pm
by freereign
Okay. I finally got it to compile properly, so now I will play around some with the resources in the game itself. I already have a small section of the AI done, but soon more will be done.

EDIT: Latest SVN broke my compiles. I will attempt to get the latest running again, but once the shaders are implemented (unless there is an option to disable them) I am sunk until I get my new computer done (I am building one).

I have a better understanding now on the requirements for each resource since I have played around with the game in depth now (3 hrs last night, entirely focused on the resources). Hopefully the AI will not depend on any new SVN changes until I get the compile working again. But even then it shouldn't take too much modification.

Re: AI programming

Posted: Mon Apr 07, 2008 4:13 pm
by BioKom
The tricky thing will be deciding when everything is of the balance so much that the focus will need to change. You'll probably have to devise some set of rules for this and test it until you found the right parameters.
I think the problem is: Where are the goals of the AI?
As long as there are no Species attitude ore real Planning ahead involved, it's maybe the best just to try to match the opponent (e.g. human).
If the opponent is better in technology, but the AI has higher production, give technology a higher priority and production a lower.
So the AI depends on the "brainpower" of the opponent.

Re: AI programming

Posted: Mon Apr 07, 2008 10:44 pm
by freereign
I like the idea BioKom. I will see about that (if it is possible with the current python wrapper)

Also, I haven't gotten much done on the AI since my last post. I have been attempting to fix my internet connection. (writing from a different computer now)

A basic one won't take long after I finish that.

EDIT: my internet connection on my laptop is now fixed. I will be working more on the AI now (yeah!)

Re: AI programming

Posted: Tue Apr 08, 2008 7:42 pm
by m_k
BioKom wrote:
The tricky thing will be deciding when everything is of the balance so much that the focus will need to change. You'll probably have to devise some set of rules for this and test it until you found the right parameters.
I think the problem is: Where are the goals of the AI?
As long as there are no Species attitude ore real Planning ahead involved, it's maybe the best just to try to match the opponent (e.g. human).
If the opponent is better in technology, but the AI has higher production, give technology a higher priority and production a lower.
So the AI depends on the "brainpower" of the opponent.
The "goals" of the AI will be in the PrioritiesAI / DemandAI for now (see here) Of course they aren't real goals, I'm a bit sceptic if strategic thinking beyond some simple things like "concentrate attacks on this part of the empire, because it's weaker" is even possible at all. It's a bit like the problem with chess, where it works better for the computer to evaluate millions of possible positions superficialy than the human approach of considering few positions in great detail.
On matching the opponent, the AI sees the same things a human player would see, because it is treated like any human player by the server, after all, nobody likes an AI that cheats. So it is not possible for the AI to try and match the opponent, because it simply doesn't know what the opponent does (at least it will once visibility is implemented properly). Nevertheless there will be some matching resulting from the rules for the Priorities, if the enemy has many ships (and they are visible), the need for new ships will be greater, and so on.

Re: AI programming

Posted: Wed Apr 16, 2008 9:08 am
by kroddn
A simple question: does the current AI require Python2.5? I compiled the linux-version using python2.4, and that seems to result in non-functional AI.
2008-04-16 08:35:40,272 DEBUG AI : AI_1 logger initialized.
2008-04-16 08:35:40,694 DEBUG AI : Python stdout and stderr redirected
2008-04-16 08:35:40,696 DEBUG AI : Traceback (most recent call last):
2008-04-16 08:35:40,696 DEBUG AI : File "/tmp/freeorion/application/default/AI/FreeOrionAI.py", line 2, in ?
2008-04-16 08:35:40,697 DEBUG AI : import pickle # Python object serialization library
2008-04-16 08:35:40,697 DEBUG AI : File "/usr/lib/python2.4/pickle.py", line 34, in ?
2008-04-16 08:35:40,697 DEBUG AI : import struct
2008-04-16 08:35:40,697 DEBUG AI : ImportError: /usr/lib/python2.4/lib-dynload/struct.so: undefined symbol: PyExc_TypeError
2008-04-16 08:35:44,495 DEBUG AI : AIClientApp::HandleMessage : Received JOIN_GAME acknowledgement
2008-04-16 08:35:44,495 DEBUG AI : AIClientApp::HandleMessage : Received GAME_START message; starting AI turn...
2008-04-16 08:35:44,776 DEBUG AI : Message::GAME_START loaded_game_data: 1
2008-04-16 08:35:44,776 DEBUG AI : Message::GAME_START save_state_string:
2008-04-16 08:35:44,777 DEBUG AI : AttributeError: 'NoneType' object has no attribute 'resumeLoadedGame'
2008-04-16 08:35:44,891 DEBUG AI : AttributeError: 'NoneType' object has no attribute 'generateOrders'
2008-04-16 08:35:44,891 DEBUG AI : AIInterface::DoneTurn()
2008-04-16 08:35:45,149 DEBUG AI : AIClientApp::HandleMessage Message::SAVE_GAME
2008-04-16 08:35:45,149 DEBUG AI : AttributeError: 'NoneType' object has no attribute 'prepareForSave'
2008-04-16 08:38:44,456 DEBUG AI : AttributeError: 'NoneType' object has no attribute 'generateOrders'
2008-04-16 08:38:44,456 DEBUG AI : AIInterface::DoneTurn()
2008-04-16 08:44:30,136 FATAL AI : Initiating Exit (code 0 - normal termination)
Currently I am compiling boost with python2.5 to see, if that changes then.

Re: AI programming

Posted: Wed Apr 16, 2008 9:55 am
by Geoff the Medio
If you run Python 2.4 from the command line (independently of anything freeorion related), can you "import pickle" successfully? Just importing a library shouldn't be causing a crash like that, since it's not even using the library, but does appear to find it.

Re: AI programming

Posted: Wed Apr 16, 2008 8:36 pm
by kroddn
The problem does not appear, if I link in python2.4 dynamically. So, for future releases of the linux-version, I will link it this way. I hope that python2.4 is available on most linux-systems.

Re: AI programming

Posted: Mon Apr 21, 2008 2:40 pm
by freereign
Well, the gremlins have returned. My laptop HDD just crashed. Thankfully I had backups of most everything (not my working compile of FO though). I will have to redo a little bit of work, but not much.

Re: AI programming

Posted: Sat May 17, 2008 1:41 pm
by freereign
Okay, I had this bookmarked before, and now I can't find it. What variable sets a planet's primary and secondary focus? (WOW its been along time since I've been on here.