Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » AI Coding
icon5.gif  AI Coding Fri, 16 February 2007 12:44 Go to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
I just finished implementing bombing code and according to the unit test it actually works. At this point CraigStars! has exploration, expansion, battle, and conquest. All my AI does is explore and colonize though. It's a hacked together chunk of code and I would like to formalize it.

Here are my ideas. I've never programmed anything remotely AI-ish before, so if anyone has any other ideas or suggestions, please let me know. Smile

AI's need a set of knowledge. They need to have at their fingertips knowledge of the universe, such as:

  • A list of enemy fleets they know about.
  • A list of unexplored planets that need scouting
  • A list of habitable planets that need to be colonized.
  • A list of enemy planets that need to be destroyed.

To work with the above lists, the AI needs to be able to design ships and build custom fleets to accomplish the above tasks. This is where things get tricky. In CraigStars! the techs are all loaded from a file. They aren't coded into the engine. The AI needs a way to determine what techs to use for what situation.

I have added a 'Ranking' field to each tech to determine how it stacks up to similar techs. My thought with this is to enable the AI to design ships with any technology set, not just the standard Stars! one. I haven't implemented it yet, but I think it'd be fairly easy to say "Build a colony ship with the best engine, the hull that holds the most cargo, and the best armor/shields available."

I'm not sure where to go with hulls themselves though. What kinds of ships should an AI be building? How should the AI determine what hull to use for a colony ship? Should they use the standard hull and ship colonists along with it? Should they colonize planets and then send freighters with people after the fact?

At what point does an AI attack another player? Is there some heuristic for when you switch from a explorer/colonizer to a warm machine?

I want to make the AIs as simple to make as possible because I would like, eventually, for anyone to be able to program one and plug it in. All AI programmers will need some shared functionality, so it might as well be in the game engine for everyone to use.

Some ideas I've had for types of fleets to build...

  • Colonizers
  • Search and Destroy Attack Squadrons
  • Remote Miners
  • Transports for mineral balancing
  • Transports for population balancing
  • Bombers
  • Planet invaders

Report message to a moderator

My AI Pipedream Fri, 16 February 2007 12:55 Go to previous messageGo to next message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
One possible way to implement the above ideas and to make AI's as cool as possible is to make them modular. I've been kicking around an idea for how to implement AIs for a while, and I think I need to sit down and just do it.

Each AI is made up of components.

  • Explore/Expand
  • Attack/Destroy
  • Ship design creator
  • Empire maintenance (mineral/pop balancing)

I think it would be really neat to have each of these as an independent turn processor. The AI would just be a collection of turn processors that were virtually independent of each other. They would all share the same knowledge set, but they would do different things. The Explorer processor would identify unexplored planets and create fleets of scouts to explore them. The Attacker would identify enemy ships and build fleets to intercept them. The ship designer would keep the other processors up to date with the latest designs the player can build.

Each of these processors would need to be independent in code, but they also need some way to tag their items. The ship designer would need to tag each ship as a colonizer, attacker, scouter, bomber, etc. The explorer would need to tag its fleets for their intended purpose so the attacker doesn't steal them for their fleets.

If the processors were good enough and independent enough player's could use them in the client to process their turns. Are you tired of min/pop balancing your planets? Just enable the min/pop pre-turn processor to process your turns before you get them.

If the API were easy enough to use, any C# or VB.Net programmer could write one to do any sort of turn processing. The possibilities are pretty cool. Smile

Report message to a moderator

Re: My AI Pipedream Fri, 16 February 2007 13:41 Go to previous messageGo to next message
Ptolemy is currently offline Ptolemy

 
Commander

Messages: 1008
Registered: September 2003
Location: Finland

I'd like to also see AI's make a more sensible usage fo fleets - i.e. 'act' like a real player.

Once the AI has colonized a core area, multiple minelayers get deployed in space laying many small fields.

Attack plans for planets are done using a 'look ahead' like in chess. Calculate how many of what type of ships are needed to win the battle and bring chaff. One way of fixing the chaff problem is simply to expand the order set to have specific orders to kill capitol ships first or fastest armed ships. Granted, there will still need to be an attractiveness calculation done of some sort since battles aren't interactive - nor should they be for any Stars! version.

However, I would not want to completely remove chaff effectiveness.

I would really like to see the AI's build large fleets and send them out using cloaking and all the techniques that we all know as players.

Ptolemy




Though we often ask how and why, we must also do to get the answers to the questions.

Report message to a moderator

Re: AI Coding Fri, 16 February 2007 13:48 Go to previous message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
sirgwain wrote on Fri, 16 February 2007 18:44


AI's need a set of knowledge. They need to have at their fingertips knowledge of the universe, such as:

  • A list of enemy fleets they know about.
  • A list of unexplored planets that need scouting
  • A list of habitable planets that need to be colonized.
  • A list of enemy planets that need to be destroyed.

To work with the above lists, the AI needs to be able to design ships and build custom fleets to accomplish the above tasks. This is where things get tricky. In CraigStars! the techs are all loaded from a file. They aren't coded into the engine. The AI needs a way to determine what techs to use for what situation.

I have added a 'Ranking' field to each tech to determine how it stacks up to similar techs. My thought with this is to enable the AI to design ships with any technology set, not just the standard Stars! one. I haven't implemented it yet, but I think it'd be fairly easy to say "Build a colony ship with the best engine, the hull that holds the most cargo, and the best armor/shields available."

I'm not sure where to go with hulls themselves though. What kinds of ships should an AI be building? How should the AI determine what hull to use for a colony ship? Should they use the standard hull and ship colonists along with it? Should they colonize planets and then send freighters with people after the fact?



I'd guess the AI would do well to keep records on foreign ships, ranked by quantity detected, cost, observed average speed, and even battle prowess. That kind of info should enable it to answer questions like: what's the most likely composition of an enemy battlefleet? Which is their main wardesign? Which is the better to copy? What's the best (or at least the commonest) freighter/bomber/minelayer design? Sherlock Whip

And of course careful records of its own designs, possibly carried across several games, like a kinda portfolio. Rolling Eyes

That would enable an "arms race", as well as some evolution by imitation. Twisted Evil



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Previous Topic: AR reality
Next Topic: I introduce myself
Goto Forum:
  


Current Time: Fri May 03 11:32:02 EDT 2024