Problems with multiple enemy instances
by Oriol "Orgarus" Garcia · in TGB Platformer Kit · 01/29/2009 (10:53 am) · 4 replies
Hi there,
I'm one of the horde of PSK owners and I was in the beggining excited with this tool. The chance to make platformer games without expending a lot of time coding. BUt yesterday I went to sleep a "little" dissapointed. The story is:
I tried to make a little demo where there was a player character in a corridor and a few enemy objects walking . I started to put a Scene Object with the Spawn Point behaviour assigned. The first time it put onto the scene one enemy moving. As I expected it worked.
The follow step was to change the parameter of NumberToSpawn to 10 and the game worked awfully. I saw in the debug banner that the FPS fell under 10 with only 10 enemies in the game! I decided to reduce the number of enemies to 5 and it worked relatively well. I thought, that probably the game engine had to train and gain muscle, or something. I increased the enemies one by one. Nothing. Didn't work. The game started to cough from the seventh entity and in the tenth aparition the game became asthmatic (Asthmatic = ~10 FPS)
OK, let start to investigate and to try different options:
0.-Search for some information in the forums, if I'm not mistaken it seems that by the moment I'm the one who has problems with this (on the other hand I doubt that nobody make a game with less than 10 enemies).
1.- Take a look to my Computer: P4 2.8 Ghz, 2 RAM GB, Video Card ATI Radeon 9600, not bad (it could be better of course)... it should be enough. It's not the king of the Computers but it isn't a C64 (without (any) intention of offending, I'm a 8 bitlover).
2.- Reduce size of the source images and reimporting them to the TGB resources.
3.- Test the game with the player and the enemies only.
4.- Start a new the project with the platformer template as usual and do the pertinent modifications to some files(i.e: append six lines of code to the datablock.cs file.), as usual too.
5.- I close all applications (except TGB, obviously).
5.1.- Reboot computer. Start TGB. Test. Nothing.
6.- I try to put 10 enemies in PSK Dragon's demo, born from O'Shea's tutorial from TDN that I follow step by step. I test this in two ways: generating the enemies from a spawn point and the other making copy/paste of the enemy (the famous Drill) ten times.
The test result was always the same: the FPS draggin across the ground and for this reason the game was totally unplayable.
I get a few of positive things of that experience just by beating my head to the table, one of them is that I've rescued an old and unfinished plataformer project made with Torque two years ago where I tested this problem and where I used the spawning behaviour (that is downloadeable in the behaviors listing on TDN TGB). In this test I can see 100 enemies walking and the FPS are over 80. The animation tiles of the enemies are 256x256. There are two background tilemaps armed to the teeth. When all the objects are loaded in the level the counter marks 125 and the FPS are ~80. So, what happens? what am I doing wrong?
I assure you that I like how the PSK treats the collision detection and the actors movement and how allows to you the possibility of generating levels quickly. There's a lot of good work behind the PSK, for this reason I want to think that there are a 99% of possibilities that I'm making something wrong with it (bad practices, forgot to modify something in some place... who knows? me not, you can bet for it). Sincerely, I don't want to believe that a game made with this kit gets stuck with ten enemies on the scene.
In this situation I'll continue working with my old platformer.
And that's all (at the moment, I hope).
Waiting for your responses, comments, suggestions...
Best regards to all.
Bye.
PS.-To avoid that common question: the TGB's version that I'm using is 1.7.4.
I'm one of the horde of PSK owners and I was in the beggining excited with this tool. The chance to make platformer games without expending a lot of time coding. BUt yesterday I went to sleep a "little" dissapointed. The story is:
I tried to make a little demo where there was a player character in a corridor and a few enemy objects walking . I started to put a Scene Object with the Spawn Point behaviour assigned. The first time it put onto the scene one enemy moving. As I expected it worked.
The follow step was to change the parameter of NumberToSpawn to 10 and the game worked awfully. I saw in the debug banner that the FPS fell under 10 with only 10 enemies in the game! I decided to reduce the number of enemies to 5 and it worked relatively well. I thought, that probably the game engine had to train and gain muscle, or something. I increased the enemies one by one. Nothing. Didn't work. The game started to cough from the seventh entity and in the tenth aparition the game became asthmatic (Asthmatic = ~10 FPS)
OK, let start to investigate and to try different options:
0.-Search for some information in the forums, if I'm not mistaken it seems that by the moment I'm the one who has problems with this (on the other hand I doubt that nobody make a game with less than 10 enemies).
1.- Take a look to my Computer: P4 2.8 Ghz, 2 RAM GB, Video Card ATI Radeon 9600, not bad (it could be better of course)... it should be enough. It's not the king of the Computers but it isn't a C64 (without (any) intention of offending, I'm a 8 bitlover).
2.- Reduce size of the source images and reimporting them to the TGB resources.
3.- Test the game with the player and the enemies only.
4.- Start a new the project with the platformer template as usual and do the pertinent modifications to some files(i.e: append six lines of code to the datablock.cs file.), as usual too.
5.- I close all applications (except TGB, obviously).
5.1.- Reboot computer. Start TGB. Test. Nothing.
6.- I try to put 10 enemies in PSK Dragon's demo, born from O'Shea's tutorial from TDN that I follow step by step. I test this in two ways: generating the enemies from a spawn point and the other making copy/paste of the enemy (the famous Drill) ten times.
The test result was always the same: the FPS draggin across the ground and for this reason the game was totally unplayable.
I get a few of positive things of that experience just by beating my head to the table, one of them is that I've rescued an old and unfinished plataformer project made with Torque two years ago where I tested this problem and where I used the spawning behaviour (that is downloadeable in the behaviors listing on TDN TGB). In this test I can see 100 enemies walking and the FPS are over 80. The animation tiles of the enemies are 256x256. There are two background tilemaps armed to the teeth. When all the objects are loaded in the level the counter marks 125 and the FPS are ~80. So, what happens? what am I doing wrong?
I assure you that I like how the PSK treats the collision detection and the actors movement and how allows to you the possibility of generating levels quickly. There's a lot of good work behind the PSK, for this reason I want to think that there are a 99% of possibilities that I'm making something wrong with it (bad practices, forgot to modify something in some place... who knows? me not, you can bet for it). Sincerely, I don't want to believe that a game made with this kit gets stuck with ten enemies on the scene.
In this situation I'll continue working with my old platformer.
And that's all (at the moment, I hope).
Waiting for your responses, comments, suggestions...
Best regards to all.
Bye.
PS.-To avoid that common question: the TGB's version that I'm using is 1.7.4.
About the author
Recent Threads
#2
06/02/2009 (4:35 am)
Hi, I am potential buyer, has this problem been corrected or is it still there? Its been 5 months since it was raised, if it has not been fixed since then, will it ever be?
#3
You have to remember that there are always limits on the number of AI you can have processed at any one point in time, and you will need to find limits that suit your game. Not every platformer game uses AI that can behave like the player can, take Metroid or Mario for example. This can definitely simplify the problem and allow you to include many more AI units.
That being said, I have been able to spawn about 10 AI units with only a drop of 3-4 fps. I have also been able to spawn roughly 40 AI units and maintain a playable FPS (30+).
06/02/2009 (5:03 am)
The move to source definitely helps this issue. However, it doesn't remove it altogether.You have to remember that there are always limits on the number of AI you can have processed at any one point in time, and you will need to find limits that suit your game. Not every platformer game uses AI that can behave like the player can, take Metroid or Mario for example. This can definitely simplify the problem and allow you to include many more AI units.
That being said, I have been able to spawn about 10 AI units with only a drop of 3-4 fps. I have also been able to spawn roughly 40 AI units and maintain a playable FPS (30+).
#4
Also I just asked a question in your blog, if you could please read it and respond:
http://www.garagegames.com/community/blogs/view/16313
06/02/2009 (5:18 am)
ok that sounds good :) Another question then: is it possible for me to add weapons to player characters, would shooting ammo slow things down?Also I just asked a question in your blog, if you could please read it and respond:
http://www.garagegames.com/community/blogs/view/16313
Associate Phillip O'Shea
Violent Tulip
The problem lies with the "updateOnGround" function in ActorBehavior. This function essentially handles collision detection via Torque Script and as a concequence is rather slow to process. There are no solutions to offer up (at least, I haven't thought of any) other than to move the code to source.
I know it isn't the best news, but in order to target as many people as possible, the PSK was built in script only. I am working on a source upgrade and I will do my best to distribute binaries for non-source owners.