Tag Info

Hot answers tagged

7

A* would work fine for this task, but since your map is small, Breadth First Search would work too, and it's even simpler than A*. These are “graph search” algorithms, which require you to tell them what the allowed moves are. They are not limited to grids. In your case you would tell it that the allowed moves from (x,y) are to (x+1,y-1), (x+1,y), and ...


6

Best practices: One central loop in main / rendering thread which also handles sound, network buffering etc. - basically, this centralises communication with OS and other threads. All processor-intensive tasks (for example, mesh building, AI, physics) may be submitted ad-hoc, in bite-sized work units, to existing worker threads. These threads are kept ...


2

I've been implementing some very similar collide-and-slide collision detection and resolution. http://metareal.net/blog/wp-content/uploads/2015/08/2015-08-21.jpg The main key I found was to handle X and Y separately. So, your code might be modified something like this (a little freeform but you should get the idea): // step 1, modify X prevX = x; x += ...


1

I don't know why people automatically jump to premature generalization/optimization when questions like these pop up. There is something to be said about being preemptive and realizing when a component in a system is likely to be swapped out. All of the answers about "don't worry and code away till you need to change it" generally get people into trouble in ...


1

A quick search returns: 0xc00007b – the application could not start correctly. This may be because you are mixing up a 32bit environment with a 64bit one Ensure the SDL you have is correct for your program, and that the program targets the correct Windows version (i.e. set Visual Studio to build for x86 if the computer runs 32 bit versions of Windows).


1

By using SDL_RenderCopy you can do all the zoom in/out or scaling stuff, by using non null values for the srcrect and dstrect parameters. Here is the prototype of the function : int SDL_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect) ...


1

There's three members of a D3D11_MAPPED_SUBRESOURCE: a pointer to the beginning of the data; the number of bytes from the beginning of one row of data to the next row of data; the number of bytes from the beginning of one depth slice of data to the next depth slice of data. As none of these members communicate anything about the actual extents of a row ...


1

A* will certainly work for this. Linked below is an excellent tutorial on how to implement it. 1) Add the starting square (or node) to the open list. 2) Repeat the following: a) Look for the lowest F cost square on the open list. We refer to this as the current square. b) Switch it to the closed list. c) For each of the 8 squares adjacent to this ...


1

You could try putpixel (void putpixel(int x, int y, int color)) Although I'm not really sure that's going to be fast enough. You're using <graphics.h> which is a very old library designed for when many computers were running DOS and had resolutions like 320x200 - a quarter of your target. On Windows it would be using GDI under the hood, not exactly ...


1

I found this tutorial on the OpenGL wiki a month ago. It explains the basics of skeletal animations; but I hope it is good enough for what you are trying to do, if not, you can also search skeletal animation opengl on google, because there is much more on the opengl wiki about this topic.



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