Understasnding Kork ai
by Christopher Gardner · in Torque Game Engine Advanced · 06/25/2009 (4:32 pm) · 9 replies
Hello, I am wondering, how is kork only spawned on the stronghold map? Also, how can i spawn him manually on the map (and have him stay there forever, making an single player mission)?
#2
Also, if you look in the aiplayer.cs you'll see how the stock Kork spawns, and why it only happens on "that" path.
06/25/2009 (5:50 pm)
Also "Killer Kork" resource.Also, if you look in the aiplayer.cs you'll see how the stock Kork spawns, and why it only happens on "that" path.
#3
How to get silly bots into a level by Stefan Beffy Moises
Both are excellent resources for reading. The Improved AI Guard Unit is very easy to install, and Beffy's resource taught me ALOT.
@Christopher, you're only 13? Great time to get into game programming! Good luck with everything, and if you need help, let us know. We'll kepp answering questions.
06/26/2009 (7:22 am)
Improved AI Guard Unit by Twisted JeniusHow to get silly bots into a level by Stefan Beffy Moises
Both are excellent resources for reading. The Improved AI Guard Unit is very easy to install, and Beffy's resource taught me ALOT.
@Christopher, you're only 13? Great time to get into game programming! Good luck with everything, and if you need help, let us know. We'll kepp answering questions.
#4
;D
Killer Kork
06/26/2009 (7:37 am)
Quote:Agreed, best whilst your brain is still like a sponge and before it gets ravaged by time, booze and filling in tax returns ...
you're only 13? Great time to get into game programming!
;D
Killer Kork
#5
@Infinitum
I actually started when i was 8, but i only really started to program about 2 years ago. And thanks.
@Steve
Already tried out killer kork, not what i'm looking for.
06/26/2009 (7:45 am)
Thanks, but I already found out how to do this. @Infinitum
I actually started when i was 8, but i only really started to program about 2 years ago. And thanks.
@Steve
Already tried out killer kork, not what i'm looking for.
#6
I am in the same boat you are. Except Im not a boy genius like you are. haha
I was trying to figure out the same thing last night. I could't quite figure out where the barebones.mis actual called for Kork to spawn. which i belive is found here in the aiPlayer.cs
so to figure it out, i created a new file called addNewKork.cs in a testingScripts folder in the main folder and kinda started from scratch.
when I took out exec("aiPlayer.cs") from the game.cs, it stopped adding kork to the barbones mission. As I said before I didn't see a call for the spawn function in aiPlayer.cs, I did however find the following lines in the game.cs that might be where it comes from ...
under the startgame() function is says ...
I have done a lot of programming in AS2 and AS3 (not an expert in either by any means) but I believe the new ScriptObject(AIManager) the MissionCleanup.add(AIManager) imports the AIManager "stuff" and then the AIManager.think() actually creates the kork guy.
wow... its amazing how trying to explain something to someone else helps you understand it better!
anyhow, so what I did was I took some of the bits and pieces of the aiPlayer and copy and pasted it into my addNewKork.cs. After a couple hours of fiddling around with it I came up with this..www.platinumcypher.com/torqueStuff/addNewKork.cs
www.platinumcypher.com/torqueStuff/player.cs
its an AI that when kork bumps into another AI the two will create another AI. Its doing some weird things right now, but I'm still working on it.
When the barebones.mis starts up its just me. I bring up the console and type add1(); that adds a kork with his getId() as his name.
I made some mods to the player.cs as well to track the number of babies each kork has had, if the kork has recently had a baby or not, and the collision stuff is in the Armor part, but I think thats where my issue lies.
07/04/2009 (11:36 am)
@ChrisI am in the same boat you are. Except Im not a boy genius like you are. haha
I was trying to figure out the same thing last night. I could't quite figure out where the barebones.mis actual called for Kork to spawn. which i belive is found here in the aiPlayer.cs
function AIPlayer::spawn(%name,%spawnPoint)
{
// Create the demo player object
%player = new AiPlayer() {
dataBlock = DemoPlayer;
path = "";
};
MissionCleanup.add(%player);
%player.setShapeName(%name);
%player.setTransform(%spawnPoint);
return %player;
}so to figure it out, i created a new file called addNewKork.cs in a testingScripts folder in the main folder and kinda started from scratch.
when I took out exec("aiPlayer.cs") from the game.cs, it stopped adding kork to the barbones mission. As I said before I didn't see a call for the spawn function in aiPlayer.cs, I did however find the following lines in the game.cs that might be where it comes from ...
under the startgame() function is says ...
// Start the AIManager
new ScriptObject(AIManager) {};
MissionCleanup.add(AIManager);
AIManager.think();I have done a lot of programming in AS2 and AS3 (not an expert in either by any means) but I believe the new ScriptObject(AIManager) the MissionCleanup.add(AIManager) imports the AIManager "stuff" and then the AIManager.think() actually creates the kork guy.
wow... its amazing how trying to explain something to someone else helps you understand it better!
anyhow, so what I did was I took some of the bits and pieces of the aiPlayer and copy and pasted it into my addNewKork.cs. After a couple hours of fiddling around with it I came up with this..www.platinumcypher.com/torqueStuff/addNewKork.cs
www.platinumcypher.com/torqueStuff/player.cs
its an AI that when kork bumps into another AI the two will create another AI. Its doing some weird things right now, but I'm still working on it.
When the barebones.mis starts up its just me. I bring up the console and type add1(); that adds a kork with his getId() as his name.
I made some mods to the player.cs as well to track the number of babies each kork has had, if the kork has recently had a baby or not, and the collision stuff is in the Armor part, but I think thats where my issue lies.
#7
Lotsa fun.
07/07/2009 (3:59 pm)
Cool idea! onCollision spawning a new ai. I tried it out and those Orc breed like bunnies *lol*Lotsa fun.
#8
I made some updates to keep them from getting out of control. I set a fertility rate so that once they have a baby it sets recentBaby to true and then schedules a function that sets the recentBaby back to false so that they can mate again. They will also die after 2mins. I made their names set to their parents IDs too.
I forgot I changed to spawn location near the %col.getID transform so that when they bump the new baby shows up near the parents.
The most I have had is a total population of 30. Then they start to die off.
www.platinumcypher.com/torqueStuff/addNewKork.cs
www.platinumcypher.com/torqueStuff/player.cs
My next endaevor is to have them create clans. I will post the outline for when I get it all down on paper and then update it with the code.
07/07/2009 (9:34 pm)
I know haha...I made some updates to keep them from getting out of control. I set a fertility rate so that once they have a baby it sets recentBaby to true and then schedules a function that sets the recentBaby back to false so that they can mate again. They will also die after 2mins. I made their names set to their parents IDs too.
I forgot I changed to spawn location near the %col.getID transform so that when they bump the new baby shows up near the parents.
The most I have had is a total population of 30. Then they start to die off.
www.platinumcypher.com/torqueStuff/addNewKork.cs
www.platinumcypher.com/torqueStuff/player.cs
My next endaevor is to have them create clans. I will post the outline for when I get it all down on paper and then update it with the code.
#9
www.platinumcypher.com/torqueStuff/addNewKork2.cs
www.platinumcypher.com/torqueStuff/player2.cs
The more I add, the deeper I want to go. I'm trying to come up with an algo to get the AI to need something, then choose to fullfill that need. Random is fun, but random with a purpose will be even better...
I just need to figure out how to the AI to sense objects. I found a couple forum posts that might be able to help
07/13/2009 (10:53 pm)
this next version adds to the last. They have a randomized maximum age, randomized maximum scale based on an exponential growth function, a randomized fertility rate.www.platinumcypher.com/torqueStuff/addNewKork2.cs
www.platinumcypher.com/torqueStuff/player2.cs
The more I add, the deeper I want to go. I'm trying to come up with an algo to get the AI to need something, then choose to fullfill that need. Random is fun, but random with a purpose will be even better...
I just need to figure out how to the AI to sense objects. I found a couple forum posts that might be able to help
Torque Owner Mike Rowley
Mike Rowley
To get a better grasp on how to get him to do other things, spawn on a path and shoot at you, guard something and shoot at you, etc... do a search for aiGuard or advanced aiGuard resources. Both work great.