Tag Info

Hot answers tagged

10

We have a similar case with our RTS Remake. All units and houses are sprites. We have 18 000 sprites for units and houses and terrain, plus another ~6 000 for team colors (applied as masks). Long-stretched we also have some ~30 000 characters used in fonts. So there are some optimizations against RGBA32 atlases you are using: Split into many smaller ...


7

This is called vsync (vertical sync), which traditionally means that your rendering rate is synchronized with the vertical refresh rate of your monitor to avoid tearing. Nowadays LCD screens don't have "vertical" refresh rates, just simple refresh rates, but it's the same thing. As others have said in the responses, your video card driver settings cause ...


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


5

The Problem is that you draw your text on the screen and then blit the doublebuffer over that. Simply change the first argument to textprintf_centre_ex from screen to buffer and it works like a charm.


5

If I had to choose from that list, I'd definitely gun from SFML as it has a simple API and allows you to implement much of it yourself, a great learning experience. I'd like to just chime in and say SFML is simpler and sticks to what it needs to do. A base framework for rendering things. I think you should also consider the new contender MonoGame ...


5

So you have two coordinates or vectors, one is the center of the screen (C from now on) and the other is your object (P from now on.) If you know some math, you might know that a line can be expressed as an origin and a direction vector. The origin is your screen-center, while the direction vector can be found subtracting C from P. This equation can also be ...


5

I'll try to address your specific questions. Is this the best way of drawing a sprite? Is it suitable? It's suitable, and it works, but it's not the best way to do it. What gl* calls really do What you are doing is sending commands to your video card. Just about any function you call that begins with 'gl' does so . Thraka did a fairly good job of ...


5

Based on your description it appears key[LEFT] = false; and key[RIGHT] = false; are never reached. The if-condition for that piece of code reads if(ev.type == ALLEGRO_KEY_UP), however the key down handling code's condition looks like this: if(ev.type == ALLEGRO_EVENT_KEY_DOWN). Without knowing any Allegro, I suggest you use ALLEGRO_EVENT_KEY_UP in the key ...


4

"He who would learn to fly one day must first learn to stand and walk and run and climb and dance; one cannot fly into flying..." You appear to want to draw a sprite that is always facing the mouse, correct? Then your first task must be to draw a sprite that is always facing something. Pick an arbitrary point and then do the math to draw the sprite so that ...


3

First of all you need to use more, smaller texture atlases. The less textures you have the more difficult and rigid memory management will be. I would suggest a atlas size of 1024, in which case you would have 128 textures instead of 2, or 2048 in which case you would have 32 textures, which you could load and unload as needed. Most games do this resource ...


3

It sounds like a bug with caching glyphs. These sorts of glitches generally are only applicable to video memory, so if you switch to a memory bitmap font by calling this before loading the font you can work around the issue: al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); You'll need to clear the flags after you load the font, or else all subsequent ...


3

You're on the right track; you just need to throw in a system to regulate the timing with which the sprite is updated. The exact model you use is up to you - essentially whatever concept you like working with. In the example I will provide you can specify the speed of the animation in frames per second (independent from the FPS of your game, of course). ...


3

Finding a balance between hardening code against the future and completing your current project is often challenging. You don't want to waste time over-engineering solutions to problems you don't actually have, but you also don't want to create a massive amount of technical debt for yourself. Some practical considerations: Other APIs almost certainly will ...


3

I've never used OpenGL and I'm not that good at the other things I've used in the 3D world. But basically the way programming works in 3D is that you give render instructions to the graphics card. If I interpret your code it's saying glBindTexture(GL_TEXTURE_2D, gl_image); -- I'm going to use this texture glBegin(GL_QUADS); I'm going to draw quads to the ...


3

I see two problems right off the bat, the first has to do with the marked line below: void UpdateBullets() { for(unsigned int index = 0; index < bullets->size(); index++) { if (bullets->at(index)->Y < 0) //<-- HERE { bullets->at(index)->Update(); } else { ...


2

Allegro 5 is quite adept - I like it personally. The initialization code is simple to use, and easy to stuff away in a class or an Init() function. Really, if you write a wrapper function or class, you won't even have to directly call anything from any of these libraries. Are you interested in game graphics or game development? Because if you want to ...


2

The problem you're running into is that 100,000,000 is a big number for a 32-bit floating-point value. There are two approaches to fixing this. First, consider whether you actually need such big unit. Do you really need a world 100,000,000 pixels across? Can you consider a system where 1px == 100m or something along those lines? Simply scaling down your ...


2

I think that the following part of your code is problematic: if(accumulator > accumulator_max) { accumulator = accumulator_max; } You are basically doing a clamp() here, saying that every time difference which exceeds five steps should be disregarded, since accumulator_max = step_duration * 5; Should one iteration of your game loop require more ...


2

g++ allegroTemplate.cpp -o allegroTemplate You aren't linking with Allegro. With Allegro 4, it's recommended to use the allegro-config command, like g++ souce.cpp -o game $(allegro-config --libs) If you are just getting started, you really should take a look at Allegro 5 instead. It has integrated OpenGL support and is actively being developed, ...


2

Without knowing anything about your framwork: You used al_show_native_messagebox and al_show_native_message_box. al_show_native_message_box was used first and does not result in an error so I guess the second one should be al_show_native_message_box too?


2

Running the debugger pointed to the textprintf line being the culprit. You have an extra parameter 10 in there that should not be there. Fixing that solved the problem. HOWEVER, there are other problems with the code: You are using the old version of textprintf use the new version like so: textprintf_ex(screen, font, 0, 0, Text_Color_Red, -1, "Screen ...


2

What you need to do is create a method that gets the amount that the player overlaps the tile by. You would make a copy of this method for each axis. When you are moving the player, you first move the player on the X axis. Then you check for collision. If you find a colliding tile, you get the player's offset into the tile and subtract that from the player's ...


2

This is by design: rect() is a specifically optimised version for axis-aligned rectangles. I suggest doing two calls to triangle() instead, splitting your rectangle along one of its diagonals.


1

Firstly find the most efficient texture format that you can while still being happy with the visuals of the game whether this is RGBA4444, or DXT compression etc. If you are not happy with the artifacts generated into a DXT alpha compressed image, would it be viable to make the images non-transparent using DXT1 compression for the colour combined with a 4 or ...


1

Wow, that is a hefty amount of animation sprites, generated from 3D models I presume? You really shouldn't be making this game in raw 2D. When you have fixed perspective a funny thing happens, you can seamlessly mix pre-rendered sprites and backgrounds with live-rendered 3D models, that has been used heavily by some games. If you want such fine animations ...


1

I believe that the best approach is to split the texture in many files and loading them on demand. Probably your problem is that you're trying to load larger textures that you would need for a complete 3D scene and you are using Allegro for that. For the big zoom-out you want to be able to apply, you have to use mipmaps. Mipmaps are lower-resolution ...


1

You need to know two basic things: The size of your screen, in whatever units you are most comfortable with (that is, tiles or pixels, or whatever -- as long as all your measurements use the same unit you're basically fine). This is essentially the size of the "viewport" into your level or world. The position of the focus point of your view (that is, where ...


1

After dealing with similar project over the last 2 years (as an amateur game developper) I had to face the fact that this method was totally outdated, and somehow more complicated in time than others. I would advice you reviewing totally the format of your map and the way you handle layers. A good example is the Tile Map Format .TMX(Tmx Map Format ...


1

Okay, I entered -lalleg in the Project/Project Options/Parameters/Compiler and added the lalleg.dll.a library in the Linker and everything turned out alright. Leftium helped with the GFX_AUTODETECT_WINDOWED. The solution was probably made by creating a diffferent project for every individual source code though.


1

You need to define the static variables explicit: static long* xc1; static long* yc1; static long* xc2; static long* yc2; In the implementation file (.cpp), try adding this code: long* Line::xc1 = NULL; long* Line::yc1 = NULL; long* Line::xc2 = NULL; long* Line::yc2 = NULL; More info at: http://www.learncpp.com/cpp-tutorial/811-static-member-variables/ ...



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