There are many good engines for making games such as Game maker or unity. I would recommend starting with game maker, then move up to learning programming with sdl.
A game engine can be very difficult depending on what capabilities you want it to have, for example: if you want 3d graphics, it will make things way more difficult, 2d graphics not so much, but thats just one aspect of a game engine. You should generally try to learn how to program before learning how to make a game engine, probably years of experience.
Okay, I get why global variables can be bad, but I still don't know how to replace them. In my example it was easy to set correct sound to be played. Now let's say I don;t want to use the global SoundSystem. I could make SoundSystem member of a Game class. But how do I set the correct sounds now, when the "Player" class inside the State, which is already inside the game class, doesn't have access to the SoundSystem. It was easy to check.. if(playerState==state_attacking) g_SoundSystem->PlaySound("swordfling.wav");
Another idea was to pass the m_SoundSystem(member of the game class), to the State->Logic, and then to the Player.Logic() but that makes no sense to me. Well, at least I have never seen a source code/example with such a solution.
Or maybe I don't need anything like SoundSystem? Maybe simple function playing sounds is enough? However I find SoundSystem much more useful, as it can track which sounds are playing so I don't get the "100000 sounds at a time" effect etc.
Any tips from more advanced coders? ;)
What I would recommend is making a base class for your entire game, and adding a SoundEngine object INSIDE the base class. If you ever want to use the sound engine inside an object, you pass it in as a parameter. I would look at the Rastertek tutorials for examples.
std::vector’s do not free their memory when you clear them. Just make sure the vectors themselves are not created and destroyed repeatedly.
I understand the vector itself doesn't get it's memory freed, i mean the objects stored in the vector. If I'm adding and removing thousands of objects per frame, isn't that supposed to be extremely slow? I've tried testing for framerates, but I haven't gotten that down yet.
Posted by Solid_Spy
on 08 September 2013 - 02:59 PM
hello, i've been trying to synchronize two threads, however once one runs, the other one never continues. I've been following tutorials online, but they don't seem to help. Can someone please tell me what i'm doing wrong?
Game programming can take years to learn, and is especially difficult if you're not at a game college where you can learn everything you'll ever need. Just a heads up, learn how to program in c++ first, then move on to using different API's like Win32 or SDL, Then, if you think your up for it, try to tackle the beast: Directx11.
I had something similar happen to me. I spent more than half a year learning Directx9 with the fixed function pipeline, blissfully unaware of how deprecated it actually was, and I wasted my time trying to memorize the graphic syntax. However, it wasn't entirely wasted. I learned a lot about how a graphics pipeline works and how games are made :3 I had a much easier time learning directx11 then I did the first time.
Posted by Solid_Spy
on 07 December 2012 - 07:15 PM
Alright, well if no-ones able to help me, i guess i'll just have to resort to using 3d quads. it would probably be better anyways since it would make it so that i can apply some cool 3d effects to it. However, i still wan't to learn how to make surfaces with alpha. Please help me.