Tag Info

Hot answers tagged

28

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 ...


16

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

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 ...


13

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. ...


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 ...


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

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, ...


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

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. ...


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

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

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) ...


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

"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.


6

If I understand your code correctly, you compensate for the collision by offsetting the ball by a fixed amount without affecting its velocity. The reason your ball acts jittery is that although its position is corrected based on the collision, its velocity is still aimed at the colliding object. Because of this velocity, the ball is still moving towards the ...


6

If you are using glBegin()/glEnd() in your code, especially if setting textures and states redundantly between frames (i.e., draw with texture 1, then 2, then 1, then 2, as opposed to 1,1,2,2), you probably are incurring driver overhead. Especially this is the case if you are noticing that a slow processor is chugging while it still has a good card. Using ...


6

First of all, what you're looking for isn't really an engine. You're looking for a graphics API or a graphics API Wrapper to do your drawing. I can recommend SFML. It's a C++ library that manages most of the basic things that everyone needs for you. It features a relatively powerful graphics part which wraps around OpenGL, but also includes basic support ...


6

In SDL, whenever you're not seeing things drawing, or in drawing in completely the wrong color, eg. white, your first thought should be, "What is wrong with my colour formats?". You'll want to check your bpp depth as well. I think due to changes from prior versions of SDL (could be wrong here) some sources say this is bits per pixel, others think it's bytes ...


6

Solution The solution was to use a monitor like v8::Locker locker;. Exactly this line must be entered the line before the creation of the HandleScope and it should work, although my code up there is crap. I have combined all variables etc. into one method without a setup method or the variables in ScriptingEngine. Long story short: the Locker object is ...


6

You are passing an unallocated pointer (manex) to a function that is expecting it to be allocated. In debug mode, you are passing (IIRC) the value 0xCDCDCDCD. In release, you are passing it a mystery value. Take out the * between FPSmanager and manex, like so, and use the addressof operator: FPSmanager manex = {0}; SDL_initFramerate(&manex); ...


6

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, ...



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