Game Development Community

How To Make AI Discussion

by Bryce · in Technical Issues · 11/04/2004 (2:44 pm) · 156 replies

I'm making a game called Metal vs. Flesh and I cant figure out how to make AI players.
#81
12/03/2004 (3:50 pm)
Mark... Got problem. A friend of mine is setting up a simple rw server for him and some friends to play on. He wanted some AI's so I sent him to the newaiplayer resource u made. He couldnt get it to work at all. I looked at his scripts for him but from what i can tell he's done everything right. This is what happens. When he adds into the game.cs for it to load the aiPlayer.cs file his game crashes when he tries to load a map. Whenever he takes out aiPlayer.cs line from the game.cs everything else works fine. Any suggestions?
#82
12/03/2004 (4:14 pm)
Odd...

Haven't tried my file with RW, s don't know if there's something incompatible there...

You say it completely crashes when he loads the aiplayer.cs file. Is it crashing when he execs the aiplayer.cs file or when he tries to LoadEntities ? If it's when he first tries to compile and load the exec I'm kind of at a loss. I guess he should verify that the file isn't corrupted, and I'd wipe out the .dso file - if it ever got created.

Next I'd take out any of the exec to AIManager - just in case there's an incompatibility there - if you can. My code doesn't call on it and there might be some overlapping if it's still in there.

If the file is loading, but bombing on LoadEntities, then I'd make sure that the player.dtf that AIPlayer uses for a marker is a valid shape file, otherwise it might be causing a problem. Just replace the player.dtf reference with a good reference to a player.dtf...

That's my first best guesses. Check those out and let me know.

If you want me to take a look at his scripts I can check them out. Send them to me along with the log file to markholcomb AT ev1.net.
#83
12/03/2004 (4:20 pm)
Ignore the player.dtf reference in regards to markers - I use that setup in my newer files. But still make sure that the marker file and player file are valid filenames.

Mark
#84
12/03/2004 (4:26 pm)
Hi Mark, is it ok to get a working copy of your codes? I'll try to incorporate it with the Tank Pack that I bought from brave tree. Anyone tried this with the tank pack?

tia,

roger
#85
12/03/2004 (4:38 pm)
If you have the capability to do a recompile then I strongly recommend you go here:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6773

to get the latest files for AIGuard and AIPatrol. AiGuard is a lot better than the code in my first resource. All the documentation is there as well as to how to make it all work.

As for integrating it with the tank pack I believe Phil - from earlier on this board was working on doing the same thing. Maybe he'll pass on how it went. I know he ran into a few quirks, but I don't know if he got them ironed out.

If you don't want to recompile or can't - then go here and get the earlier resource.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6742

But as I said the AIGuard and AIPatrol are superior versions.
#86
12/03/2004 (4:45 pm)
Thank you Mark for very quick response. Let me try both of them.
#87
12/03/2004 (5:51 pm)
Yup works fine with the tank pack ...
#88
12/03/2004 (5:57 pm)
Thanks for the info Phil.

I guess one of these days I'll have to shell out the bucks and try it out.
#89
12/03/2004 (8:52 pm)
Hey I'm not at his house currently but I know the marker that is being used in the aiplayer.cs file is correct. Its just the standard octahedron file. He says that he cant seem to see where it is specified in the aiplayer.cs file where a shape is being specified to be used for the player. I'm guessing its because he needs to add the DemoPlayer into his player script so it know what shape to load, but I wasnt sure on this. Is that correct? BTW u might be right that RW is missing something but I currently dont have the time to look.
#90
12/03/2004 (9:01 pm)
Not to worry, my mistake earlier I was trying to do 3 things at once and doing them all poorly.

The file for the marker is the only one that it references directly.

The problem might be from AIPlayer trying to access PlayerBody in the datablock

datablock PlayerData(PatrolPlayer : PlayerBody)
{
   maxForwardSpeed = 10;
   maxBackwardSpeed = 8;
   maxSideSpeed = 10;
   shootingDelay = 100;
};

if for some reason that datablock is not available, then it might be causing the bombout.

I might try to check into RW in the next day or so. Right now I'm trying to work out a sound glitch.
#91
12/03/2004 (9:15 pm)
Anyway I D/L'd Realm Wars and looked around in the AIPlayer file. They have modified some stuff in there to allow for the different character classes ORC/Elf.

So I don't think my stuff will work without having to do some serious mumbo jumbo.
I'd like to say I'd try and make mine fit into their stuff, but I doubt I'll get to it for awhile.

Sorry.
#92
12/03/2004 (9:39 pm)
Actually I still had it on my hd and did some looking for him. I created a DemoPlayer and exec it in the player.cs file. I can now load RW with no crash. However now it loads fine and I can place the marker with no problems. But it doesnt spawn the ai when u play the map, just shows the maker where the bot should be.
#93
12/03/2004 (11:19 pm)
Yes mark it's work thanks for your support.
#94
12/04/2004 (10:12 am)
Ok, did some more fooling with it. Changed the demoplayer I added so that it poits directly to a body. Changed a few minor things on the server side that really doesnt have anything to do the ai but had some to do with the players in general. Everythings still running with no errors. The aiplayer entities load fine now and the aiplayer.cs file still doesnt crash RW. Now the only prob is that I can now place the marker in edit. See the marker just fine and see its properties. The only thing I cant seem to get to work is to get it to spawn the aiplayer when playing in regular mode. Any ideas?
#95
12/04/2004 (10:28 am)
LoadEntities goes through the markers and calls the function to spawn the players where the markers are and hide them.

If you're seeing the markers then at least the file is compiling and loading.

I'd double check and make sure that AIPlayer::LoadEntities is added to game.cs after the misision loaded part.

Then I'd go through and set statements like

echo("Inside Spawn at marker...");

echo("Inside Spawn...");

etc... in the head of the functions then track the log to see if the functions are actually getting called.

Also, make sure to put your markers slightly above ground level, else Kork will drop through the ground when created, and seem as if he didn't get created.

That's all I can offer for now. Keep me posted and I'll do what I can to help.
Mark
#96
12/04/2004 (11:54 am)
Look for a negative z-axis if so , it fell thru the map
#97
12/04/2004 (7:43 pm)
I'll try that, I know that the marker is above ground though, as I used to do a lot of scripting for RW with the server I ran. I even put it back up for a while for some of the others to play but will try your suggestions to see if they work. if so, you managed o make an easy ai bot for RW that a lot of ppl havent ben able to accomplish.
#98
12/04/2004 (8:06 pm)
Good luck, I'll try to take a look at it if I get a chance, but my dad's visiting from Ca. for the next few days so I doubt I'll be able to do much more than check emails and offer a few hints here and there.
#99
12/04/2004 (8:40 pm)
I understand that, if this helps this is what I'm getting during the game setup after loading the AIentities:

[b]Loading AIPlayer entities...[/b]
rw/server/scripts/aiPlayer.cs (226): Unable to instantiate non-conobject class AIPlayer.
[b]Set::add: Object "0" doesn't exist[/b]
rw/server/scripts/aiPlayer.cs (248): Unable to find object: '0' attempting to call function 'EquipBot'
rw/server/scripts/aiPlayer.cs (250): Unable to find object: '0' attempting to call function 'setShapeName'
rw/server/scripts/aiPlayer.cs (251): Unable to find object: '0' attempting to call function 'setTransform'
rw/server/scripts/aiPlayer.cs (252): Unable to find object: '0' attempting to call function 'followPath'
rw/server/scripts/aiPlayer.cs (256): Unable to find object: '0' attempting to call function 'schedule'
rw/server/scripts/aiPlayer.cs (117): Unknown command sethidden.

its does have its problems I guess as it cant find things listed in the aiplayer.cs
#100
12/04/2004 (8:46 pm)
Conobject errors come up when you try to create a new class and the game doesn't know how to handle the callbacks for it.

That's why all the function calls are buying the farm.

I've got a few minutes and I'm playing around right now to see what I can cook up. I'll post whatever I accomplish here.

BTW: Are you still involved with the RW project?