Daxter's God AI

Smellis

New member
Joined
May 22, 2011
Messages
22
how does one use daxters god ai? i cant seem to compile it from the long list of errors, the ones that actually appear are unknown constants. I assume i must be missing something.... any advice?
 
  It looks like this script makes use of abbreviated constants. Things like "TREE" are supposed to be "SCRIPT_OBJECT_TYPE_TREE", "TREE_INFO_CEDAR", "ABODE_NUMBER_STORAGE_PIT " and so on. I think if you simply add this script here to the compilation list before the godai.txt script, it will create all of these abbreviations.
 

  Also, this script uses strings. As mentioned in other places here, make sure to copy the bw2text.bin file to the script directory or the compile will fail. notice that This is not the same as the bw2text.lhts file that is already there. The compiler will still crash and give warnings, but the file will actually compile.

-ego533

 
Thank you,

i have got the compiler to finish with 15368 instructions in GodAI.txt
but got quite a few strings missing :S will it work ok?

EDIT must be important because the god goes to storehouse interracts for a couple of seconds and then heads to what i assume is 0,0,0 in the ocean and i doesnt come back.
 
  Post the lines of your Mainscript.txt file that start the GodAI script.

  Also, It looks like the GodAI.txt script has hard-coded coordinates in it. I assume it was made for specific maps in the OGAM project that it was created under. This thread has a bit of information about this:  http://www.bwfiles.com/boards/index.php?topic=2768.0
  What I gather is that you must scan through the GodAI file and edit the hard-coded coordinates to point to objects int he correct locations in your map. In a text editor, search for " { " or " { ? " where '?' is a numeric character. I have not analyzed the script, so I don't understand what some of the objects are for, like the ore rocks.. you may need to play around to get the coordinates correct.

-ego533
 
perhaps. he has left notes in the code i guess to make it easier for people to modify the only things he mentioned were the location of or mines. Bah, this is gonna take long... is daxter no longer around?
 
   I suspect the first run, the god was going after the ore rocks that are created, except they are in the water.. maybe.




  I think you're supposed to have a 'forest' (cedar or spruce trees) a moderate distance from the god's town center.


Line 67 to 83 : Define the coordinates of ore mines on the map. If you less than 3, I THINK you could simply specify the same mine more than once without harming the script. If you have more than 3, you can specify them here, but you'll have to modify the code where these mines are referenced to add references to the extra mines.

Line 161 : Starting point of God. Can technically be anything, probably should be somewhere near the god's town

Line 166 to 172 : I'm not sure.. These may need to exist already in the god's town, but also may not need to.. I can't tell yet. If the script seems to act oddly, try adding these to the god's town and see if it evens out. Or, if the god never builds them, it may need them pre-built.

Line 183 : I'm pretty sure you don't have to have a Cedar tree near the town, but if the script acts screwy, try making trees near the god's town.

Line 185 : I think this is basically just 'an ore rock for the god to gather' for visual effect. Place this on or very near oremine1

Line 186 : I think this is basically just 'an ore rock for the god to gather' and nothing more. Place this on or very near oremine2

Line 1155 : I'm not sure.. I think this is a hard-coded location where an enemy god should be to throw fireballs at the players town (the alter and some surrounding houses). This should probably be a short to moderate distance away from the player's town center and a little bit above the ground? You could also make it instersting and set the coordinates to a random number in a radius around the player's town center (Smellis, use your 'random-generating platoon in a radius' script idea for a random position in a radius to do this)

Line 1192 : HousePos1 is defined, but never actually used. You can just ignore this coordinate.

Line 1518 : "Oremine" is never usedm it seems. instead Oremine1 - Oremine3 are referenced as created in lines 67 - 83

Line 1519 : "Newforest" is never used. I think this can just be ignored.

Line 1810 : This coordinate seems a bit random.. I think this is something you can decide. Basically, the god is allowed to extend their influence ring once in the pursuit of wood gathering. This marker points to a 'nearest point' from on influence ring where the god will want to extend the influence. I believe this would make the most sense to place over a large patch of trees that would be a moderate distance from the god's town and for which the god's influence may resonably, eventually extend to.



-ego533
 
ive just deleted a ready made storehouse, now when he starts he takes the nearest tree to 0,0
 
He can now successfully replenish his store house. i have moved a mine and field near to town centre aswell as the buildings mentioned above. he collects resources for a while then shoots off to the corner of the map. So i could probably rule resources out, he could have trouble with building? or disciple creating? arghhh so frustrating! what about the strings still not working in compiler, how could i sort that out?
 
  Still haven't tested this.. As another guess, make sure that trees or forests near the god's town are specifically spruce or cedar trees. The script (seems to) specifically check for these two types only and in a few places, does not account for the 'got' tree variable not having been 'got'... in other words, may shoot off to 0,0,0.

-ego533

 
Hello, I know the AI script is still a little messy, as mentioned, it was made specifically for OGaM so I didn't take the time to modify it so it works with custom maps, whilst my BnW2 game does not work still, I might be able to update and remove the hard-coded sections of the script so that they do work.

[quote author=ego533]
Line 67 to 83 : Define the coordinates of ore mines on the map. If you less than 3, I THINK you could simply specify the same mine more than once without harming the script. If you have more than 3, you can specify them here, but you'll have to modify the code where these mines are referenced to add references to the extra mines.

Line 161 : Starting point of God. Can technically be anything, probably should be somewhere near the god's town

Line 166 to 172 : I'm not sure.. These may need to exist already in the god's town, but also may not need to.. I can't tell yet. If the script seems to act oddly, try adding these to the god's town and see if it evens out. Or, if the god never builds them, it may need them pre-built.

Line 183 : I'm pretty sure you don't have to have a Cedar tree near the town, but if the script acts screwy, try making trees near the god's town.

Line 185 : I think this is basically just 'an ore rock for the god to gather' for visual effect. Place this on or very near oremine1

Line 186 : I think this is basically just 'an ore rock for the god to gather' and nothing more. Place this on or very near oremine2

Line 1155 : I'm not sure.. I think this is a hard-coded location where an enemy god should be to throw fireballs at the players town (the alter and some surrounding houses). This should probably be a short to moderate distance away from the player's town center and a little bit above the ground? You could also make it instersting and set the coordinates to a random number in a radius around the player's town center (Smellis, use your 'random-generating platoon in a radius' script idea for a random position in a radius to do this)

Line 1192 : HousePos1 is defined, but never actually used. You can just ignore this coordinate.

Line 1518 : "Oremine" is never usedm it seems. instead Oremine1 - Oremine3 are referenced as created in lines 67 - 83

Line 1519 : "Newforest" is never used. I think this can just be ignored.

Line 1810 : This coordinate seems a bit random.. I think this is something you can decide. Basically, the god is allowed to extend their influence ring once in the pursuit of wood gathering. This marker points to a 'nearest point' from on influence ring where the god will want to extend the influence. I believe this would make the most sense to place over a large patch of trees that would be a moderate distance from the god's town and for which the god's influence may resonably, eventually extend to.
[/quote]

Most of these are easily tweaked so they instead look for an array of objects on the map nearest that god's town, ranging from none to many instead of a specific object on the player's map.
 
playing bw1 atm cos got frustrated lol.

like i said the i got the god to work collecting resources, then im guessing it goes on to build? or some other task it intends to complete. do the buildings that want to be constructed need to be planned in editor?

if you could fix the string errors that would be great, i can upload it if anyone would like what i have so far. the map was intended for sanbox/builder with enemy platoons attacking but i got interested in this script.
 
The script was designed to look for a pre-defined building in the landscape editor to start off but as I said, easily fixed. All you would have to do is edit the script to look for an existing storehouse or wait until one has been constructed.

It tends to be a pain though and bug out when expected to wait for the building to be constructed.
 
Give GE Bimbo a try, the source files are included in this download.

http://www.bwfiles.com/files/file.php?id=1333

It's similar in function to Daxter's, but it works on any map (theoretically) and it's super moddable. You should have no problem getting it going, just use the following lines of code (for example) to instantiate the instances:
Code:
// Start AI
run script bimNewBimbo(oTown)
run script bimNewBimbo(1Town)
run script bimNewBimbo(2Town)

After you test out the prototype, you can modify it to make it behave the way you want and upload it as a custom AI. The prototype AI (GE Bimbo.txt) is a good example that shows a lot of the different stuff you would want to do using God Engine. Here's an example of some of the functions in God Engine, to give you an idea of how easy it is to use (from GodEngineH.txt)
Code:
# Script: geMoveToObject(GodHandle,rObject)
# -----------------------------------------
# Desc:   Causes the god hand to move to desired object.
#
# Params: GodHandle - Valid handle for an existing god instance.
#         rObject   - Object in the game you want god hand to move to.
#
#
# Script: gePickupResource(GodHandle,rResourceObject,rResourceType,ResourceQuantity)
# -----------------------------------------
# Desc:   Causes the god hand to move to resource object and pick up a quantity. If god is already
#         holding a resource of a different type, the first resource will disappear. (ex. if god is
#         holding food, and you go pick up ore, the food will disappear.)
#
# Params: GodHandle        - Valid handle for an existing god instance.
#         rResourceObject  - Object containing resource (storehouse, tree, ore rock, construction site)
#         rResourceType    - Member of GE Resource Type enum (ex. GE_HT_ORE)
#         ResourceQuantity - Desired quantity to pick up (-1 for all in object)

And here is an example of how easy it is to use God Engine to satisfy town desires:
Code:
while townDesire >= bim_MaxDesireToStopResource and SCRIPT_OBJECT_PROPERTY_TYPE_BUILT_PERCENTAGE of myStorehouse >= 1.0 and myTree exists
	run script gePickupResource(godHandle,myTree,GE_HT_WOOD,-1)
	run script geDropInStorehouse(godHandle,myStorehouse,-1)
	townDesire = get rTown desire TOWN_DESIRE_FOR_WOOD
	myTree = get SCRIPT_OBJECT_TYPE_TREE at {rTown} radius bim_ResourceGatherRadius
end while

Let me know how it goes  :)
 
just had a go on greenpatch with GE and i didnt see much action does it do more than just make disciples and fly through their own buildings (destroying them)?
 
Smellis said:
just had a go on greenpatch with GE and i didnt see much action does it do more than just make disciples and fly through their own buildings (destroying them)?
GE Bimbo starts by making disciples, then it checks to see if there's anything to build or any town desires to satisfy (wood, ore, food) and it uses some miracles like water to water fields and put out fires.

There is obviously something wrong if it's flying through buildings, I'll have a look (maybe I uploaded a crap/test version or something by accident.)
 
I just downloaded it and gave it a try, and it worked fine. It did run through one building (beta, remember) but it replenished resources when I took them out of the storehouse, and it built all the buildings I placed. It should also put out fires if you set one of your enemy god's towns on fire, un-disciple disciples if you make more than the exact amount it wants (the test personality is very picky) and do some other basic test behaviors.

Does it do these things when you run it?

What would you like to make it do?

Could you be more specific about any problems your having?
 
admittedly i didnt watch him for long but, i was hoping he would act like or as close to, a god on bw1, like place desired buildings, more housing, offensive miracles, platoon control? etc (im sorry if it does some of these things already but i didnt watch for that long.)

 
Back
Top