Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Oct 2013
Offline Last Active Today, 08:32 AM

Posts I've Made

In Topic: Attempting a proper 2D game engine, always find myself out-of-scope

21 October 2016 - 07:26 PM

In my programs I have only ever included .h files, never .cpp

Include the .h files, but include them in .cpp files when possible.


Forward declare when possible, include when you must. Look up forward declaring if you're not familiar with it.


Your master class sounds like a bad idea. It sounds effectively like a global, which is generally considered a code smell. If everything can access and talk to everything else from anywhere, tracking code flow becomes a huge issue as the project grows.

In Topic: Assigning slots in formations

21 October 2016 - 04:57 PM

Could you just ignore inter-regimen collision while moving? Maybe not do this if moving in to engage an enemy, only when moving normally.


Could each part of the regimen remember its current position in the formation (I'm at slot x), and go to the same slot in the rotated formation?

In Topic: Rendering an object with multiple subsets

19 October 2016 - 01:21 PM

Do you have any idea why this is happening?

If it shows up twice, you're rendering it twice. Why is anyone's guess without code access.


My suggestion is to just put a breakpoint in the render function and see where it's being called from.

In Topic: Why is visual studio giving me a bunch of false errors?

14 October 2016 - 06:30 AM

All my headers files have #pragma once in them though, is it still possible to create a circular dependency?




If class A contains an instance of class B, and class B contains an instance of class A, you will run into problems, unless you can forward declare some stuff.

Only include in header files if you need to. If you can get away with forward declaring in headers and including stuff in the .cpp files, that's A Good Thing™.

In Topic: Improving collision query?

14 October 2016 - 04:44 AM

I tried checking collision on +2000 objects and my game dropped to 2 FPS from 5000 without any rendering...   I think this is the problem.

In addition to what Kylotan said...

1) Will your game have close to 2000 objects, or did you just try a high number to see? In your initial post you mentioned "hundreds". Every game can be slowed down to a crawl if you tell it to do too much. If the game is too slow at 2000+ objects, and fine at 200, that's fine if all you need is 200.

2) Don't guess where the problem is. Use a profiler (google if you aren't familiar), and know. Profiling will also allow you to measure and verify that changes you make actually help.