Bot movement, only one bot showing....
by arteria3d · in Torque Game Engine · 01/02/2005 (2:05 pm) · 32 replies
I have just been going through the tutorials by Kevin Harris of which i am finding very useful.
I have just completed the bot movement tutorial and decided to add an extra bot and make a separete movement path.
For the second bot i made its own datablock, rather than copying the players again - this was done because of the problem i am about to explain.
When i run the program, the second bot i made is placed on screen and walks around, but i cannot see my first one? which worked fine earlier.
I then went to Game.CS, and swapped around in which way BOT1 and BOT2 loads. So now... i am loading BOT1 second and BOT2 first in the game.cs file. - Now Bot 1 apears, but Bot 2 doesnt!!
After looking in Game.CS again at the following which i needed to add as part of the tutorial:
new ScriptObject(AIManager) {};
MissionCleanup.add(AIManager);
AIManager.think();
i noticed that in my second bot.cs that i made - i was making the same call to think() - therefore i thought that because two separate scripts where calling the same function, thats why only one of the bots was showing, and this was dependent on which way around there line was in game.cs
thought of changing the think() function in the second bot to something different, but that didnt work.
I know this may sound confusing - i have tried to explain exactly as is...
How come only one bot is showing, and which one of the two, is dependent on its heirachy in the game.cs file. i.e. If as follows:
exec("./bot1.cs");
exec("./bot2.cs");
bot2 loads and displays on screen
If as follows:
exec("./bot2.cs");
exec("./bot1.cs");
bot1 loads and displays on screen
Thanks
Steve
I have just completed the bot movement tutorial and decided to add an extra bot and make a separete movement path.
For the second bot i made its own datablock, rather than copying the players again - this was done because of the problem i am about to explain.
When i run the program, the second bot i made is placed on screen and walks around, but i cannot see my first one? which worked fine earlier.
I then went to Game.CS, and swapped around in which way BOT1 and BOT2 loads. So now... i am loading BOT1 second and BOT2 first in the game.cs file. - Now Bot 1 apears, but Bot 2 doesnt!!
After looking in Game.CS again at the following which i needed to add as part of the tutorial:
new ScriptObject(AIManager) {};
MissionCleanup.add(AIManager);
AIManager.think();
i noticed that in my second bot.cs that i made - i was making the same call to think() - therefore i thought that because two separate scripts where calling the same function, thats why only one of the bots was showing, and this was dependent on which way around there line was in game.cs
thought of changing the think() function in the second bot to something different, but that didnt work.
I know this may sound confusing - i have tried to explain exactly as is...
How come only one bot is showing, and which one of the two, is dependent on its heirachy in the game.cs file. i.e. If as follows:
exec("./bot1.cs");
exec("./bot2.cs");
bot2 loads and displays on screen
If as follows:
exec("./bot2.cs");
exec("./bot1.cs");
bot1 loads and displays on screen
Thanks
Steve
About the author
Owner of uk based Ltd company ArteriaMediaLtd. with a trading name of Arteria3d Website;arteria3d.com
#22
Change
//Bot2
//%bot = AIPlayer::spawnOnPath( "Bot_2", "MissionGroup/myPath2/Path2/path" );
//%bot.followPath( "MissionGroup/myPath2/Path2", -1 );
to...
//Bot2
%bot = AIPlayer::spawnOnPath( "Bot_2", "MissionGroup/myPath2/Path2/path" );
%bot.followPath( "MissionGroup/myPath2/Path2/path", -1 );
Then test it again... That should be the problem once again...
If it still doesn't work then I shall keep looking, there is no need to post the whole bot.cs file, only post the AIManager::spawn datablock.... Ok?
Max
01/04/2005 (9:42 pm)
No, Burning thats not his problem still, Steve you still have the code wrong on the last thing I told you... Change
//Bot2
//%bot = AIPlayer::spawnOnPath( "Bot_2", "MissionGroup/myPath2/Path2/path" );
//%bot.followPath( "MissionGroup/myPath2/Path2", -1 );
to...
//Bot2
%bot = AIPlayer::spawnOnPath( "Bot_2", "MissionGroup/myPath2/Path2/path" );
%bot.followPath( "MissionGroup/myPath2/Path2/path", -1 );
Then test it again... That should be the problem once again...
If it still doesn't work then I shall keep looking, there is no need to post the whole bot.cs file, only post the AIManager::spawn datablock.... Ok?
Max
#23
01/04/2005 (9:46 pm)
He has No bots now... He should have at least one with the standard starter.fps.
#24
Max
01/04/2005 (9:59 pm)
Yes, That is true... He said he had them before if I recall corectly... Steve are you using the demo or started.fps?Max
#25
%bot = AIPlayer::spawnOnPath( "Bot_1", "MissionGroup/mypath" );
%bot.followPath( "MissionGroup/mypath", -1 );
so my bots are on the right paths - cos thats the path i made in the game. I tried this file in startes.fps. ; also other versions.
Thing is - it worked before didnt it - with the way i did it - its just that the other bot wasnt showing.
Also when i leave the other bot line in as follows and remove the // remark comments - the main bot apears, and then that bot keeps respawning itself so there are like 50 versions of it - and more if i let it run!
%bot = AIPlayer::spawnOnPath( "Bot_1", "MissionGroup/mypath" );
%bot.followPath( "MissionGroup/mypath", -1 );
//Bot2
//%bot = AIPlayer::spawnOnPath( "Bot_2", "MissionGroup/myPath2/Path2/path" );
//%bot.followPath( "MissionGroup/myPath2/", -1 );
return %bot;
}
Please not that although looking back on my .cs files i have pasted, the mission marker information didnt match up - all paths are now corrected on screen - but still the problem remains. Max i will send you the original file i was using - and see if u can just make that spawn two bots. I really do wish that there was more documentation on this!
Steve
01/05/2005 (5:12 am)
Max - check the line in my code above - its as follows as u see:%bot = AIPlayer::spawnOnPath( "Bot_1", "MissionGroup/mypath" );
%bot.followPath( "MissionGroup/mypath", -1 );
so my bots are on the right paths - cos thats the path i made in the game. I tried this file in startes.fps. ; also other versions.
Thing is - it worked before didnt it - with the way i did it - its just that the other bot wasnt showing.
Also when i leave the other bot line in as follows and remove the // remark comments - the main bot apears, and then that bot keeps respawning itself so there are like 50 versions of it - and more if i let it run!
%bot = AIPlayer::spawnOnPath( "Bot_1", "MissionGroup/mypath" );
%bot.followPath( "MissionGroup/mypath", -1 );
//Bot2
//%bot = AIPlayer::spawnOnPath( "Bot_2", "MissionGroup/myPath2/Path2/path" );
//%bot.followPath( "MissionGroup/myPath2/", -1 );
return %bot;
}
Please not that although looking back on my .cs files i have pasted, the mission marker information didnt match up - all paths are now corrected on screen - but still the problem remains. Max i will send you the original file i was using - and see if u can just make that spawn two bots. I really do wish that there was more documentation on this!
Steve
#26
This is by far THE MOST documented resource that I've ever seen in GarageGames resources---you just need to read it!
01/05/2005 (5:27 am)
@Stevie: Did you look at the documentation provided? He has almost half a meg of documentation in the directory.This is by far THE MOST documented resource that I've ever seen in GarageGames resources---you just need to read it!
#27
As mentioned previously in other posts of mine - its okay documentation being available - but if i dont comprehend it - then its useless to 'me' - not everyone else, just 'me'
As you know i do have a good working knowledge of other areas, which i wont mention, of fear that someone will jump down my throat - but here with torque i do have dificulty.
Max is kindly helping me and doing a good job, without prompting me to documentation - lets just leave it like that - as i am grasping what Max is saying, there is just a little something i am doing wrong possibly.
I coouldnt bare it if yet another of my posts starts going sour........
01/05/2005 (6:10 am)
Stephen - please lets not start another argument - about the why and whats.As mentioned previously in other posts of mine - its okay documentation being available - but if i dont comprehend it - then its useless to 'me' - not everyone else, just 'me'
As you know i do have a good working knowledge of other areas, which i wont mention, of fear that someone will jump down my throat - but here with torque i do have dificulty.
Max is kindly helping me and doing a good job, without prompting me to documentation - lets just leave it like that - as i am grasping what Max is saying, there is just a little something i am doing wrong possibly.
I coouldnt bare it if yet another of my posts starts going sour........
#28
It also indirectly states that you didn't read the documentation! All I'm saying is that making general statements like that tends to frustrate people, especially those that do put the incredibly hard effort into making documentation, and it is important not to alienate folks.
01/05/2005 (6:37 am)
Sorry man, but when you make a comment like that:Quote:I really do wish that there was more documentation on this!it tends to burn people a lot. I can about guarantee that Max's temperature went up several degrees when he reads that, simply because he did provide the best documentation of any resource out there, bar none.
It also indirectly states that you didn't read the documentation! All I'm saying is that making general statements like that tends to frustrate people, especially those that do put the incredibly hard effort into making documentation, and it is important not to alienate folks.
#29
01/05/2005 (6:43 am)
Man - for God sake - please stop picking up every word i say. I never meant the comment 'i wish there was more documentation' concerning Max's statement - i meant on this site - documentation that i can undertsand (please stop splitting hairs as the expression goes). i cannot believe that u picked me up on this - STOP NOW.. NOW i say - i have had enough of getting into fights with people and being cautious what i say. I left School 16 years ago
#30
01/05/2005 (6:46 am)
And Stephen i read, read read rread read - believe me i do. I spend so many hours learning right now.. my head is bursting. You dont know me,, and dont know what i do here - so it BURNS ME when people like u have a go at me. People make assumptions, by the text people write sometimes.... and as u know... text can be read in many different ways.
#31
Stephen, Not to worry my tempature didn't raise and if it did it would only have gone up to the normal tempature that I should be (I'm too cold). :)
Steve, Why don't ya send that file over to me and I shall take a lookie at it and fix it up for you, when you do send the game.cs file over too because I might have put a line or two in there for some reason to get this working, I don't remember but I shall see.
Such a contraversiol forum isn't it now. (I know I can't spell :P)
Max
01/05/2005 (6:53 am)
Oh, Do calm down now all no need for all of this, it is just a simple little problem. Stephen, Not to worry my tempature didn't raise and if it did it would only have gone up to the normal tempature that I should be (I'm too cold). :)
Steve, Why don't ya send that file over to me and I shall take a lookie at it and fix it up for you, when you do send the game.cs file over too because I might have put a line or two in there for some reason to get this working, I don't remember but I shall see.
Such a contraversiol forum isn't it now. (I know I can't spell :P)
Max
#32
01/05/2005 (7:06 am)
Thanks Max - u said the best words anyone could say. We should all take a leaf out of your book friend...
Torque Owner James Laker (BurNinG)
Do you still have this in your game.cs?
new ScriptObject(AIManager) {}; MissionCleanup.add(AIManager); AIManager.think();Are you loading the bot/Aiplayer.cs in games.cs? eg. exec("./bot1.cs");
Did you go through your console to see if there were any errors? Is your bot1
compiling? (See if the dso file is there)... Delete your game.cs.dso and see if it gets recompiled correctly by looking at your console output.