AI programming

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
freereign
Space Squid
Posts: 53
Joined: Wed Mar 19, 2008 4:40 pm

Re: AI programming

#16 Post 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)
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: AI programming

#17 Post 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.

freereign
Space Squid
Posts: 53
Joined: Wed Mar 19, 2008 4:40 pm

Re: AI programming

#18 Post 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.
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12799
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI programming

#19 Post 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?

freereign
Space Squid
Posts: 53
Joined: Wed Mar 19, 2008 4:40 pm

Re: AI programming

#20 Post 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.
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12799
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI programming

#21 Post by Geoff the Medio »

If you don't have minerals and industry or research, you can't produce things or research techs.

freereign
Space Squid
Posts: 53
Joined: Wed Mar 19, 2008 4:40 pm

Re: AI programming

#22 Post 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.
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate

BioKom
Space Krill
Posts: 1
Joined: Thu Apr 03, 2008 4:47 pm

Re: AI programming

#23 Post 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.

freereign
Space Squid
Posts: 53
Joined: Wed Mar 19, 2008 4:40 pm

Re: AI programming

#24 Post 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!)
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate

m_k
Space Floater
Posts: 33
Joined: Wed Mar 12, 2008 10:54 am
Location: Aachen, Germany

Re: AI programming

#25 Post 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.

User avatar
kroddn
Static Linker
Posts: 347
Joined: Thu Jun 28, 2007 10:28 am

Re: AI programming

#26 Post 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.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12799
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: AI programming

#27 Post 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.

User avatar
kroddn
Static Linker
Posts: 347
Joined: Thu Jun 28, 2007 10:28 am

Re: AI programming

#28 Post 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.

freereign
Space Squid
Posts: 53
Joined: Wed Mar 19, 2008 4:40 pm

Re: AI programming

#29 Post 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.
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate

freereign
Space Squid
Posts: 53
Joined: Wed Mar 19, 2008 4:40 pm

Re: AI programming

#30 Post 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.
MoO: Darloks Rule!
MoO2: Custom Darloks Rule!
MoO3: Dunno cuz I'm a cheapskate

Post Reply