Tag Info

New answers tagged

1

I'm not sure if this question is appropriate for this site, but I'll give you my take. First, kudos on making your game! I am all for doing stuff yourself if you can't find anybody else to do it. You are certainly going for the pixel art retro look, and that is pretty cool. Make your game in the way you like it the most, and take people's advice just as ...


0

Actually, I think driven by the question in this post, Adrian "Flafla2" Biagioli has created a very well written and explained post/answer on this same topic. Here: http://flafla2.github.io/2015/02/14/bunnyhop.html The product of the post is a C# implementation of the system: // accelDir: normalized direction that the player has requested to move (taking ...


1

Visual Studio Professional has a "Setup project" type of project that creates a Windows Installer (msi) setup program. For versions up to 2010, it was bundled, and for 2013, there is an extension which does this. As it is bundled with Visual Studio, it has only the most basic features, but can make a complete installer that will install prerequisites, do ...


0

Since in OpenGL, by default, negative z is out towards the 'camera' and positive z is forward You're wrong. OpenGL uses a right-handed coordinate-system where x is right, y is up and z is into the camera, therefore negative z is forwards.


0

Spatial partitioning is most definitely the way to go. The book 'Game Programming Patterns' has a very accessible chapter on the subject (http://gameprogrammingpatterns.com/spatial-partition.html) so I'd highly suggest reading that, as well his chapters on the game loop and update method. Also, if I understand your comment correctly, each different type of ...


0

What you're looking for is "spatial partitioning". You want to break up your world space into smaller chunks to cut down on how many objects you detect collision against. Since you're just doing 2D you'll probably want to use a "quad tree". There are other options including BSP trees but in my experiences quad trees are the best all around solution. As for ...


0

If I understand your intention correctly, you are trying to figure out how to reduce the number of collisions to check for, which is basically in the realm of 'potentially collidable set reduction'. If so, you'd do well to research spatial subdivision and/or nearest-neighbour search algorithms (such as octrees, KD trees, BSP and the like). One (or more in ...


0

Well, I finally got it after messing around with the math for awhile I kinda understand it. If anyone wants the code here it is. double dcx = double(cx) / double(w); double dcy = double(cy) / double(h); double dcw = (double(cx)+double(cw)) / double(w); double dch = (double(cy)+double(ch)) / double(h); glBegin(GL_QUADS); glTexCoord2f(dcx, dcy); ...


2

I know they're planning to un-hardcode Gravity [Source: I'm a moderator on the official Unreal Engine forums, I know things ;)] but the best way is to either add force in the direction you want or set the player to "Flying" mode and push him about with Launch character / Add force. This is the only way without altering source code (Until they un-hard code ...


0

I don't quite understand what your problem is, since you're not being very specific. But I'll try. Your code seems fine to me. glVertex2f() controls where you want to render your quad to the screen. glTexCoord2f() controls what part of the texture you want to apply to the quad. So obviously if you increase the size of your quad but don't increase the part ...


0

The problem is probably the exporter. According to official docs: aiString aiAnimation::mName The name of the animation. If the modeling package this data was exported from does support only a single animation channel, this name is usually empty (length is zero). Try to find one which does support multiple animations channel.


1

You can not change the direction of the built-in gravity, it always points to the negative z-axis. You can also not change the gravity for single actors, only globally. But why do you need that, you can always just increase the mass of your actor. You can easily turn off gravity completely for any actor, just look for "gravity" in the blueprint options of ...


1

Store the keys from the last frame and compare in the current frame. if(!old_keys[key] && keys[key]) { /* pressed since last frame */ } if(old_keys[key] && !keys[key]) { /* released since last frame */ } if(old_keys[key] && keys[key]) { /* held since last frame */ }


4

Agner Fog's optimization guides are excellent. He has guides, tables of instruction timings, and docs on the microarchitecture of all recent x86 CPU designs (going back as far as Intel Pentium). See also some other resources linked from http://stackoverflow.com/tags/x86/info Just for fun, I'll answer some of the questions (numbers from recent Intel CPUs). ...


1

You should draw everything, and swap the buffer (display), at most once per frame (usually 1/60th second). You should definitely not call window.display() more than once per frame. If nothing at all has moved, you might choose to skip drawing and displaying entirely for that frame, especially on a mobile device to conserve power. On a desktop, typically, ...


0

I am working on an OpenGL Shader Engine from www.MarekKnows.com and the framework is setup as follows: An Engine Class that is part of a static library with other helpful and important classes. Then there is the main startup project where the Game Class resides along with Game Properties. This structure is to keep all Engine code separate from Game code. The ...


0

Honeybunch answered for video memory I believe, I'm not that familiar with GL. But to store a map like that in memory and eventually on disk you need to think about what you want with the map. If you have less then 256 types of tiles and nothing else simply use a unsigned bytes in a array (vector in c++ right?). Having thousands of tiles is not that special ...


0

Load each image once then bind the texture before you draw the tile. Efficiency can be improved if you only draw tiles that will be visible or partially visible by the camera. http://docs.gl/gl4/glGenTextures http://docs.gl/gl4/glGenerateMipmap http://docs.gl/gl4/glBindTexture void init() { //load geometry //load textures //Setup entities ...


0

I'm using SDL-2 also. Your code, at a basic reading, looks all correct to me. To help debug it, you could put a switch or printf right in the main loop, like while(GameState == RUNNING) { while(SDL_PollEvent(&Event)) { printTheEventIfItsKeyUpOrKeyDown(&Event); // as needed Handle(&Event); } A modifier key down also ...


0

Your best bet is probably Thought 1: A simple tile map and sprites. Unless you're going full-blown OpenGL then doing things like texturing quads is a bit overkill since you're already using a graphics library. Also, you don't need to make a polygon for your hitboxes; a simple rectangle will do in most cases.


0

In addition to Trevor Powell's iteration speed which is really important, here are some other useful considerations: Its like good code... A lot of IFs in there. The more solid the concept the less you need to toy around. If you know what the meat of you are trying to do is, prototyping becomes - what to put and how to arrange things in relation to the ...


1

glOrtho( 0.f, viewWidth, viewHeight, 0.f, 0.f, 1.f ); Assuming that you're starting from an identity matrix, this glOrtho() call will give you a traditional window coordinate system with 0,0 at the top left corner, such that one unit in OpenGL space corresponds exactly to one pixel in the view which contains the OpenGL-rendered image. Man page for glOrtho. ...


0

I'm personally not a fan of C++, and I prefer Java. However, most people in the industry do use it and it's the easiest language to convert to other platforms without wrappers and virtual machines. However, sometimes other languages work out pretty good for game development. I use Java with LWJGL and it is amazing. So if you want to start with 3D ...


1

So @tkausl's answer worked, the player now moves smoothly along the predefined path, here is the updated code: Edit: Bonus WebM of it working if (pathFound) { // A path has been found const float unitsPerTick = 8; // Speed in Units per tick auto waypoint = waypoint_queue.front(); // The waypoint in use Vector2i movementVector = ...


2

Your problem is, you're applying all waypoints in the same frame, which makes the character appear at the last waypoint directly, without moving at all. What you have to do is take on waypoint per frame and move only this one step. Or, better yet, move a bit in direction of the first waypoint, then, if you're near enough, discard the first waypoint. ...


1

The error message indicates that you are mixing static libraries built with one version of Visual C++ (VS 2013) with code built with a different version (VS 2015). This is because the Standard C++ Library cannot be 'mixed' in the same application. If you are using VS 2015, then you should pick the appropriate vcxproj for your platform and toolset using ...


0

You're passing the Render instance to your cube class by value. This is probably copying or reinitializing a bunch of state. Remember that you can make classes non-copyable for cases like this. I always make systems/module classes like that non-copyable to avoid bugs like these. For things like your cube you'll also have problems (you'll end up deleting ...


0

Answer: IDirect3DDevice9::SetTexture


0

Since you have a spherical panoramic photo it isn't too difficult luckily (: Basically what you need to do is make a sphere, texture it with your picture, then render 6 times from the center of the sphere, once with the camera facing each of the directions of the cube. You just need to make sure and give the camera a 90 degree field of view when rendering ...


0

Ok I decided to help you on your way. But we are simply not doing homework for you. UDK documentation seems down for maintainance but I have found this: http://www.moug-portfolio.info/udk-projectiles/ example. You should read it completely since it helps you understand projectiles. Towards the bottom they explain projectiles. Let it be clear that I have no ...


2

To let your footsoldiers share a tile you should simply position them correctly after the pathfinding found the tile. If you are smoothing your path then each step should lead to the correct position for that unit within the tile. You can also have a look at flocking. It basically finds a single path for a group of units and moves them as a group. ...


1

You can use CheckDeviceFormat to determine if a given D3DFORMAT is suitable for the device's backbuffer; it's unlikely that particular format will be. Instead, try creating the device with any old acceptable backbuffer format (D3DFMT_X8R8G8B8 for example); it doesn't matter since you won't be rendering to it. Then create a new texture with the desired ...


1

The short answer is that DirectX CreateDevice will simply fail without a HWND. However, a HWND can easily be created with this: HWND dummyHWND = CreateWindowA("STATIC", "dummy", NULL, 0, 0, 100, 100, NULL, NULL, NULL, NULL);


0

Looks not too bad to me. Only thoughts are to consolidate your camera to have a setMVPUniform(GLuint uloc, matrix model) or similar function. Likewise make similar classes for Lights, textures, VAOs, etc. Wrap anything you find yourself copypasting into a function. As long as you keep your things public you'll still have low level access where needed. ...


2

For a really good and in-depth article on this subject, just read Fix Your Timestep. There's also a ton of existing questions about this subject, although addressing different angles. But in really simple terms, this is how you get a fixed physics (or anything, really) frame rate despite the rendering frame rate being unpredictable: loop check how long ...


1

To do this, firstly you need to define a physics update time period (say, evry 16ms) and then you need to handle the case of when your game runs too fast, and when it runs too slow. When the game runs too quickly (faster than your physics update period) you need to interpolate between the last physics frame data and the next physics frame data based on what ...


0

If you're using SDL 2 you should just be able to port to mobile quite easily. SDL 2 has support out of the box for mobile. It won't be a 2-click port but it will be very possible to do. Check out the download page: http://www.libsdl.org/download-2.0.php#source There are versions of SDL 2 for iOS and Android that you can build from source. SDL is very well ...


2

DXGI_FORMAT_R32G32B32_FLOAT is not 16 bytes, that's the first problem after a quick look. Either declare it 12 in your layout or specify D3D11_APPEND_ALIGNED_ELEMENT instead. Or Make it DXGI_FORMAT_R32G32B32A32_FLOAT instead depending on your matrix.


0

I highly recommend serialization as well, whether you use boost or your own magic. But, if you want to keep it simple for maybe prototyping sake, you could use streams like you are. You could even make this really easy on yourself and do space delimited. Since you know the format your saving, you simply have to parse it back the same way into whatever vars ...


0

It may work to write it on your own like that but that isn't a very flexible approach. If you add variables to the save file, you have to update them twice. This isn't preferable. Also, if you want to change formats, you need to restructure the entire thing. Personally, I would use the Boost.Serialization library. It is a very flexible library with more ...


1

The issue you're describing is due to a lack of Vertical Sync (v-sync). Your drawing is not in sync with your monitor's refresh rate. From my research there is no way in the Windows API by default to force VSync in anything but a DirectX application. http://stackoverflow.com/questions/2448831/how-to-eliminate-tearing-from-animation You have two options as ...


0

If you want to check which of your body sides collided with obstacles, you can create your box-shaped body consisting of four b2EdgeShape sides having independent fixtures instead of single b2PolygonShape (in case you are using b2PolygonShape). In this way, while your are checking for contacts, can easily determine which fixture of my body is currently in ...


0

Here is an example with a very simple tile/sprite sheet. Each tile is 32x32 and the red line marks the left and the upper corner of each tile. You always want to use sheets like this when rendering tiles. Switching textures is much more expensive than drawing a bunch of vertices. You can either index it either by using a 2D vector or just a number. To ...


1

Shortly after posting I tested this out a bit more and found that the assert will fail. GetFixtureA() may or may not return a fixture belonging to playerPhysicsBody. I'm now using this convenience function to safely find the fixture that I want: inline const b2Fixture *contactFixtureFor(const b2Body *body, const b2ContactEdge *contactEdge) { return ...


0

You'd draw a tile map in OpenGL the same way you'd draw a sprite that has multiple frames in a single texture; by adjusting the texture coordinates such that you only drew a portion of the texture onto the quad that represents the tile. A rough way to do it would be to create a mesh of quads/triangles that represents your tile map; each tile's world ...


1

Velocity is speed and direction, and the only tricky part is the direction. Your question cuts right to that problem. This kind of vector math is linear algebra 101. However, since Wikipedia offers its usual incomprehensible notation for otherwise simple mathematics, here's a quick summary. The vector from P1 to P2 can be found by subtracting: v = ...


0

I found a solution. I cannot really explain why it changes the outcome since all UV's are in the [0;1] range. Yet, addin the lines glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); Just after loading the texture solved the problem just fine.


0

Looks like you have some problems with references. Strictly saying, you cannot return local object as a reference, nor you can bind non-const reference to a temp object like this: Add("something", GameObject()); I wonder how did you get it to compile... If you want to remove references be sure that they are not destroyed (e.g. by goingout of scope). ...


1

This is a classic collision detection problem. Thinking about it in pixels isn't the right way of going about it though. What you need to do is have a geometric representation of your player and the boundaries of your tile map. This might be as simple as just having a bounding box on your player and on each tile. When the player's bounding box intersects ...


0

It appears there are syntax differences between HLSL for DX9 and DX11. I'm pretty such the above script was written for DX9, so it won't work as-is on DX11. http://stackoverflow.com/questions/2853997/directx-9-hlsl-vs-directx-10-hlsl-syntax-the-same EDIT: After doing research, HLSL is supported both in DX9 and DX11. You generally pre-compile HLSL with ...



Top 50 recent answers are included