Tag Info

Hot answers tagged

30

My name is Kevin, and I'm a programmer/designer at Klei. I wrote a bunch of the animation stuff that we used in the Shank series, Mark of the Ninja, and Don't Starve. Our animators work in Flash. We have a concept of a character 'build' which is a set of body-part symbols with multiple views. Depending upon the fidelity of the given game, there are more or ...


17

This is a very broad question, but generally particle system features can be broken down into a few categories. Here are some general ideas for the sorts of things you might want to have. Emission features define how, when, and where particles are emitted. Continuously generate particles at a fixed rate, or generate a cluster all at once when triggered ...


15

SDL is a library. OpenGL is kinda library. DirectX is a collection of libraries. None of these are engines. Engines are built with some or all of these though. Understand that you are looking at this in a way which won't allow you to fully understand the scope of these technologies. The term library is thrown around a lot, and it does little here to help ...


14

What's being shown as "FPS based" there is . . . well, basically, it's awful. It's pinning the game's speed to the performance of one particular computer. If you upgrade to a nice fast computer, your game will suddenly run in turbo speed, if you downgrade to a slower computer you'll be grinding around in slo-mo. The real choice is fixed time step vs. ...


14

If your frame time is unpredictable (whether or not this is your fault; the OS may be using resources occasionally, etc), capping to a predictable frame rate that is somewhat lower than your achievable framerate will do a lot for predictable latency, which can make the game feel a lot better. Changing how long between when you process input and render ...


11

You talk about "multithreading difficulties" but what difficulties are you actually talking about? In a way you're citing a phantom problem which may not even exist. The real challenge is one you make for yourself - if you are absolutely determined to get every last drop of power out of a piece of hardware, that does involve using the hardware to best ...


11

Your iteration through your objects and removing them is incorrect for (i = 0; i < bullets.size(); i++) { if (!bullets[i].is_on_screen(screen)) bullets.erase(bullets.begin() + i); } Let's say you have 5 bullets. First iteration: Remove bullet at index 0. Now bullets.size() is 4 Second iteration: Remove bullet at index 1. Now bullets.size() is ...


11

You will end up using a lot less CPU (multi taskers will thank you) and people on mobile devices will appreciate this, too.


10

I haven't used SDL, and very little SFML, but the consensus I get is SFML is like SDL, but hardware accelerated and object-oriented. A quick google of your points gave me the following: enable double buffering VSync or Double Buffering in SFML load an image from path into something that I can apply to the screen apply an image to ...


10

While you can implement this using SDL_WarpCursor(), I've run into problems with that method on some platforms. I've had real problems with some platforms not reliably performing the WarpCursor() action, particularly when I've been calling it every frame. Also, remember that on many platforms, the cursor is handled at a higher frequency than your app. ...


10

An SDL_KEYDOWN event is only sent when the key is first pressed. You will receive an SDL_KEYUP event when it's released. You'll want to handle moving in code which gets called every frame, not in response to an event. Inside Avatar::handle_input, you'll instead want to set variables to tell you whether each key is up or down, and update those variables as ...


9

Split this into several layers. At the lowest layer you have raw input events from the OS. SDL keyboard input, mouse input, joystick input, etc. You might have several platforms (SDL is a least-common-denominator lacking several input forms, for instance, which you might later care about). You can abstract these with a very low-level custom event type, ...


9

Yes, it's possible. No its not a dumb idea. In fact many of the older racing games did something similar. Super Mario Kart is one example. The rendering uses 2d sprites in 3d space instead of polygons, but the physics engine is all 2d.


8

void Main::processInput() { Uint8* keystate = SDL_GetKeyState(NULL); //continuous-response keys if(keystate[SDLK_LEFT]) { } if(keystate[SDLK_RIGHT]) { } if(keystate[SDLK_UP]) { } if(keystate[SDLK_DOWN]) { } //single-hit keys, mouse, and other general SDL events (eg. windowing) ...


8

You could have a single public method in your Game class to serve as an entry point (e.g. a method called Run()). Then the only thing you'd need to do inside main() to get everything up and running would be to call that method - nothing more. The Run() method could start by initializing all subsystems and then proceed to enter the main game loop. It should ...


8

If you just want to avoid the singletons you could create instances of every game state you need in your initialization code. Then add these to a map inside the CGameEngine class - for example: game.AddGameState("Intro", new CIntroState()); game.AddGameState("Menu", new CMenuState()); ... You could than add a method to the CGameEngine to retrieve the game ...


8

I have never seen much resources on this subject either, but the best one I've found is probably the: Final Fantasy VII Enemy Mechanics FAQ It provides insight into the enemies AI such as this: AI: Setup { TempVar:TurnsUntilGrenade = 3 TempVar:GrenadeAmmo = 4 } AI: Main { If (Stage == 0) Then { If (TempVar:TurnsUntilGrenade == 0) Then ...


8

"What should I be concerned about in terms of rendering when I do this?" - not much. A co-ordinate system is just a convention, not a hard-and-fast rule, and this is a perfectly legal and valid thing to do. Just make sure that you are consistent in your own usage and everything will work fine.


8

The SDL documentation says that SDL_BlitSurface saves the final rectangle to dstrect after blitting. Reseting the where variable fixes the problem.


8

Your clock code comes from #include <ctime> and OutputDebugString comes from #include <windows.h>. OutputDebugString will not print anything if there is no debugger available. If you want platform independent code you might want to take a look at boost timers. If you don't like boost and need nano precision on multiple platforms, the keyword ...


8

As wished by the thread starter, I elaborate on event managers. They are a good way to handle input I think. An event manager is a global class which allows to both register callback functions to keys and to fire keys. The manager stores registered functions in a private list under their key. Each time a key gets fired, all registered callbacks are ...


8

You should never, ever, ever, ever, ever use Sleep to control framerate. This has been gone over before and I'll refer you to the other question for discussion of the reasons why. One thing not mentioned there is that at the typical modern refresh rate of 60Hz, and with the typical 1 millisecond granularity of Sleep calls, it's actually impossible to Sleep ...


7

Only SDL version 1.3 provides support for creating an OpenGL 3.3 core context. So you should upgrade. And if you're having a problem upgrading, that's something you need to get worked out. However, if you want to use a 3.3 compatibility context, all you need is recent drivers. Well, that and 3.3-capable hardware (anything advertised as DX10. Except from ...


7

Yes, you absolutely can use libRocket with nearly any rendering system (There is libRocket apps in most Desktop systems, iOS and Android. ) libRocket uses an abstract render interface internally. libRocket is a library that is ready to parse text into internal structures, and then push its geometry into that abstract renderer. So, nothing is rendered at ...


7

No. The C++ and SDL combination is fairly low level, but not so much so that a beginner can't make good progress with it, and you can't really get much more 'high level' than SDL unless you use a premade engine.


7

A singleton for your main engine class is perfectly normal. It's even quite acceptable to have one singleton for each of your game's major systems, like graphics and input. I personally prefer a single Engine singleton with all systems as members of that object, but really there's very little difference. A singleton can just be a static global object, ...


7

Do you think it would be a good idea to have each part of the screen (game session) handled by different thread? When it comes to rendering: No! OpenGL and multithreading don't mix well. It's best practice to keep all OpenGL operations to one single thread.


7

You could use the TMX map format used by the Tiled editor (as well as several other map editors). Even if you don't use Tiled yourself, the TMX format supports all the functionality you mentioned and it has several existing loaders/parsers for a variety of languages. It's also very easy to understand the format and extend it for your own game.


7

On tile based GPUs (commonly seen in mobile hardware) it is beneficial to clear the renderer, as it allows the GPU to dispose of the existing cached frame data. Here's a quote from OpenGL Insights, dealing with the benefits of clearing the framebuffer on a tile based renderer: "On a tile-based architecture, avoiding clears can be disasterous for ...



Only top voted, non community-wiki answers of a minimum length are eligible