Author Topic: General Ai  (Read 3134 times)

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
General Ai
« on: November 29, 2005, 01:33:59 PM »
So far i've only had a few ideas... and that's what they are at this moment: ideas...

I'm currently rewriting the BuildingGroup class, so i can include custom-stuff, like priorities. Something that the OP2/dynamix-version doesn't have.

The order in which buildings are first inserted into the AI is specified on the opu help pages. The same thing will be done with research: using the list on that same page, with priorities.
The priority of any given building could change over time. For instance: when population growth is hampered by a residence shortage, the residence priority will rise. When power becomes a problem, power generating sctructures get higher priority, etc..

Since this whole AI thing is "trigger-happy" i'll be using Events instead, because they offer more stability, and a larger number to use.

The real problem will be to find the correct spots for buildings to be placed. At first i'll just go along with "any spot will do". Once i got everything to work a bit, i'll take tacticle advantage in account for determining spots.
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
General Ai
« Reply #1 on: November 29, 2005, 01:52:22 PM »
Persoanly i think the spots for buildings in each map can be stored in a ini file and the dll can read that so it knows where to place each building.

Great work. And so glad u have started this project :D

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
General Ai
« Reply #2 on: November 29, 2005, 02:58:21 PM »
The idea is to have an AI dll/library that can be linked into ANY map, existing or future. Although the idea of putting it into an ini-file (or any file for that matters) is good, but kinda defeats the purpose the I in "AI".
As i've said: finding spots that are elegible for buildings isn't all that hard: just check if the spot is taken. But finding a strategicly good spot is a whole new story. I don't want the AI to build its entire base away from the entrence of a "cave", while its CC is nearly unprotected.
This will be hard to do, and may be map-specific. In that light a general listing of AI-parameters in an accompanying ini-file would solve some problems.

Thanx for the tip
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
General Ai
« Reply #3 on: November 29, 2005, 04:29:27 PM »
Ask me and ill tell you where to build. Each map has correct spots.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
General Ai
« Reply #4 on: November 29, 2005, 08:49:38 PM »
I don't think an ini file for each possible map will work too well. Especially since Eddy wanted this to work with any level. Some of which have yet to be made.

Btw, how to you plan to get this working with existing levels? I actually have a bit of a solution there, although you've probably already got something working, and it's probably better suited to your needs.
 

Offline Betaray

  • Administrator
  • Hero Member
  • *****
  • Posts: 2897
General Ai
« Reply #5 on: November 29, 2005, 08:53:48 PM »
im sure any ideas are welcome with open arms
I am the nincompoop, I eat atomic bombs for breakfest, fusion bombs for lunch, and anti-matter bombs for dinner

I just hope they don't explode

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
General Ai
« Reply #6 on: November 30, 2005, 12:45:00 PM »
Quote
im sure any ideas are welcome with open arms
they sure are - coz in looking into the dark about this still..
and i'm not there yet, anyway.   I'm still trying to get my new BuildingGroup to work the way i want it (upgrading IUnit and Events as i go :P)
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline HaXtOr

  • Sr. Member
  • ****
  • Posts: 423
    • http://www.wtfmoogle.com
General Ai
« Reply #7 on: December 01, 2005, 12:13:56 AM »
I have been working hard on a "general ai" that all you need to do is call one methood and the ai is created on your map. that way new programmers can have a basic ai on their map and learn from my code

Offline Eddy-B

  • Hero Member
  • *****
  • Posts: 1186
    • http://www.eddy-b.com
General Ai
« Reply #8 on: December 01, 2005, 02:31:42 AM »
good!
would be nice to have more than 1 AI library. Coz any AI is still A-Aritificial, and if you play a number of times, you can figure out how it works..
Rule #1:  Eddy is always right
Rule #2: If you think he's wrong, see rule #1
--------------------

Outpost : Renegades - Eddy-B.com - Electronics Pit[/siz

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
General Ai
« Reply #9 on: December 01, 2005, 03:32:42 AM »
Well, I had a test project that basically inserted a special AIProc into the game using a custom loader. The AIProc was in an external DLL, and would link in to the game in such a way that it would be called no matter what level was being played, and without interfering with the usual AIProc for that level.

In theory, it could be used to control an AI on an arbitrary map. But then, it was mostly just the hooking that I did, and a simple test to see that it really could order units around. The project kinda stopped there. So yeah, you could build in some sort of AI by just issuing orders to player[1] in single player (which is generally always going to be the AI), or some other player number in multiplayer. I'm sure it could determine the number of players (/human players) and or just figure out which ones to place under AI control.


Oh, and how the loader works is really cool. I basically downloaded a really nice project I found on the internet. It starts a process but in suspended mode, allocates memory in the remote process, writes data to the memory about which DLL to load, creates a new thread in that process which then calls LoadLibrary on the DLL of your choosing (the name of the DLL needs to be in the address space of the calling process, hence the mem alloc and write), and then it cleans up and unpauses the program. You get the process started with your nice custom DLL loaded into it.  (thumbsup) I thought it was just amazingly kick ass. The person who wrote it needs a pat on the back.
 

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
General Ai
« Reply #10 on: December 01, 2005, 04:09:37 AM »
So do Eddy and Hooman for there great work :)