Jump to content

  • Log In with Google      Sign In   
  • Create Account

ASnogarD

Member Since 30 Sep 2010
Offline Last Active Jul 23 2013 07:38 AM

Posts I've Made

In Topic: What exactly is a Game Engine?

06 September 2012 - 04:28 AM

In short , a game engine is a set of tools that allow you to craft a game using those tools provided.

It makes more sense when you actually make a small game, and then another small game... you can take a few things from your first game and use them in the second game... in C++ and SDL that would be your initiating SDL functions, blitting functions, loading art functions, probably your text functions... stuff that doesnt change that much and each game can use.
The more games you make the more 'tools' (tricks, techniques, methods) you aquire and the more you put into your next game... eventually you have a nice set of tools.
A Game Engine allows you to bypass that building up of your tool collection and presents you with the tools (but you do now have to learn how to use the tools as you didnt aquire them normally).

A Game Engine is usually coded in a more robust manner concentrating on ensuring the interfaces provide only the actions that were intended, and not allow for unintended calls... proper encapsulation, whereas most beginner coders are more concerned with getting damn thing to run and dont worry if someone else uses the code.

In Topic: OpenGL book for beginner

02 September 2012 - 04:35 AM

See if http://www.arcsynthesis.org/gltut/index.html helps, its at least free and may be of use...at the very least it may have some references for you to chase up.

In Topic: Using New and Delete in inherited classes and stored pointers to the new object

23 August 2012 - 09:08 AM

Well I am happy to report that the problem is sorted... as best as I can tell I am clearing every bullet and the element in the entity store that was holding the pointer to the bullet.
I have a static counter counting bullets as the constructor is called, and taking one off each time the destructor is called... and the numbers are consistant, I also check the number of elements in my vector ( basic int variable counts 1 each time an element is called , reports total count after loop, then resets ) and it show 1 for the player and the number of bullets consistantly.

.... plus the FPS dips when there is a LOT of bullets fired (over 98 in one trial, with keyboard repeat enabled ) but returns to the usual values when the bullets are cleared... I assume if there is a lot of bullets lost in the system it would degrade performance.

I basically got the same code in but the approach was different. I basically wrote the player and bullet as thier own classes without inheriting the entity class , then got both to behave properly as seperate classes... then I created the entity class and got the player and bullet classes to inherit from it and set everything to work via polymorphic inheritance.
In short I got the 2 classes to work properly before I made them into a fancy inherited polymorphic tree to eliminate inheritance issues and polymorphism bugs.

Finally... now I can add enemy entities, finish off the level editor ...and a ton of other shite... why do I do this again for ? :P

In Topic: Using New and Delete in inherited classes and stored pointers to the new object

22 August 2012 - 05:04 PM

That may of been a cause for sure, however I deleted those classes to re-write them so I cant go check now... however I am pretty certain I resorted to a delete this in the cleanup after the delete Entity::EntityList[i] seemed to cause crashes, but as I tried a number of things in a rush I cant remember for certain.

I will ensure that it doesnt do both in the new re-write I am busy with, thanks for the help... I do appreciate the effort, and the links .

In Topic: Using New and Delete in inherited classes and stored pointers to the new object

22 August 2012 - 10:06 AM

The element in the vector that held the pointer is erased after the OnCleanup() call, using :

Entity::EntityList.erase(Entity::EntityList.begin() + (i --));

I was under the impression that erasing the element holding the pointer would remove the pointer from the system ?

What really makes it confusing is the crash is pointing to the part of the code that control the game states ( ie menu or in game, or in the editor )... and that is pretty basic, I cant see how creating and deleting entities in the ingame state would crash the state manager... and when I remove the statemanager and all the states so the game is called directly by the main loop ...it crashes there, but not in the for loop that runs through the EntityList vector.

I am re-writing the player entity code, same stuff but checking each line more carefully ( had re-wrote the whole lot a few times and got lazy in some sections ).

PARTNERS