Jump to content
  • Advertisement
Sign in to follow this  
Daivuk

3D Space Shooter Simulation (Thousen of ship) Sorting problem

This topic is 4844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. I have a complex problem for you all ;) I will try to explain it clairely. I'm from Montreal and my english suffer a little :o Ok, I'm making a space combat simulation. Probably to take a ship after this and play in it, but for now its just an Ai test. My goal : 1000 entities (asteroid, capital ship, fighters, bombers, etc) If I can get 10 000 I will love it :). But I think its not possible, and 1000 is enough ;) Ok, why i'm saying its not possible 10k? Because I have 1k and I have a frame rate of ~35. (I update the scene 30 times per seconde, and redraw it 60ps) But 10k can be cool ;) First, the problem is not graphical. I use ogl and LOD and tested it high poly also and never got lag with thousen of ships I got lag when they do action. Lets go back in time : A years ago, I made something similar, it supported 500 ships without lag. I used simple colored triangles for the ships. They can do formation, stuff like that. But the code was pretty simple, all in the main.cpp with no function call and no OOP at all lol. Just one little struct. For collision, I used an dynamic octree. I recomputed the octree each frame. This was a test for a game I wanted to make. I started this game with OOP and function call to modulate it to maximum. And got an FPS of 2 :| I got all the function call in the main method and become with a fps of 40 with 200 ships... So now, i'm making something bigger. FULLY OOP. less than 10 if per ship.. And it lag with 1k... ~35.. And i dont have collision yet!! For collision optimisation I computed OABB and AABB for each ship each frame (when it moves, so anytime lol) and I got around ~1fps!! So I just dont compute OABB and AABB each frame (I can use sphere detection for first test and compute BB if it is). So now I go up to 35fps. For partionning, building an octree each frame cause to much lag. I create a tilling system... 40x40x40.. Each tile can hold one or more ship and each ship have reference on each tile he's in it. But computing all this cause lag of course... So now, if anyone have an Idea of HOW i can optimise all this mess : Please, reply ! 10k entites would be VERY great...

Share this post


Link to post
Share on other sites
Advertisement
in order to optimize you need to figure out where the bottlenecks in your code are. You want to profile you code so that you can figure out what parts of your code are causing the slowdown. Once you find those bottlenecks look for a different algorithm for that part of the code, barring that look to optimize the code itself.

There are a number of freely available profiling tools that can help with this. Search around on the site, try google, or just wait for someone who remembers the software name to reply. =)

-me

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!