Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423488

Untitled

Sign in to follow this  
Evil Steve

80 views

Hnng. Damn std::set.

I found that I kept getting asserts all over the place when TEH MMORPG!!1 shut down, to do with objects not being found in my scene graph. Since I'm using an almost RAII technique for adding/removing objects in my scene, I didn't know where this problem was comming from.

Well, I found it on the way home yesterday. My scene graph is a std::set, but the sort func was only sorting objects by type and priority. Which meant that it wasn't being sorted properly. After fixing that, I spent about 2 hours tracking down another problem. Because the scene objects are pointers, I was changing the XYZ position (Where Z is priority) in my GUI code, which caused the scene graph to no longer be sorted, meaning std::set couldn't find the right objects and was erasing incorrect objects when I requested an object be removed from the scene.
So, I have to reinsert the object to the scene graph after I change it's position.

However, while I've been writing this, I just realised I'm sorting by X and Y position as well as Z, which is totally pointless. I'll change to to just sort by Z and pointer value. That also means I don't need to reinsert the objects when their XY position changes. Whoops. That'd explain the enormous drop in FPS when you start moving stuff...


In other news, I've started playing OpenTTD. I used to play Transport Tycoon Deluxe, but it won't work on XP. And OpenTTD has cool new stuff. The upshot of all this is that I don't get early nights because it's surprisingly addictive. "Oh, I'll just finish this one transport route". Followed by "Well, it's busier than I thought. I'll make the rail take 2 trains". Then "Oh, now I have more trains on it, I might as well visit a couple more stops", and it goes on like that.

Anyway. Work.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!