Leftium
  • Member for 11 years, 5 months
  • Last seen more than a month ago
1 answers
137 votes
94k views
What should a main game loop do?
Accepted answer
131 votes

The main game loop handles three major tasks: Get user input Update the game state Draw the game A simple game loop just mushes these three tasks into one while loop. This has some undesired results:...

View answer
2 answers
15 votes
2k views
Multiplayer Implementation, Can I implement it later if I chose to?
Accepted answer
24 votes

Here is sound advice taken from the Zoidcom networking library manual: If your project is in the planning stage, it is advised to design the project for networking right from the start. ...

View answer
5 answers
25 votes
19k views
Collision Resolution
Accepted answer
16 votes

Daniel Kodicek covers this topic in great detail in his book, Mathematics & Physics for Programmers. Kodicek does two things to achieve natural-looking collision resolution: His collision ...

View answer
1 answers
24 votes
3k views
Determine position of a rotated element in Tetris
Accepted answer
16 votes

The situation you describe is called a "wall kick". A wall kick happens when a player rotates a piece when no space exists in the squares where that tetromino would normally occupy after the ...

View answer
3 answers
17 votes
11k views
Resolving a collision with forces
Accepted answer
15 votes

First, I recommend using a free, open-source physics library like Box2D and just focusing on the aspects of your game that make it unique! If you insist on re-inventing the wheel, read on... note all ...

View answer
3 answers
9 votes
7k views
How would one determine the position of a participant in a racing game?
Accepted answer
12 votes

Shawn Hargreaves describes how MotoGP used a special track-relative position system. Ignoring the vertical y position, the x/z Cartesian coordinates are translated to a track-relative system. This had ...

View answer
4 answers
8 votes
12k views
How to create a Raining Effect(Particles) on Android?
11 votes

Conserve your precious CPU/GPU cycles! You can inexpensively approximate rain (and rain splats) without using particles. The rain drops and splats don't even have to move or be aligned! Basically, ...

View answer
3 answers
8 votes
3k views
Efficient data packaging for a client-server network
10 votes

First, confirm you actually need a a fancy, efficient protocol before wasting resources developing it. Don't forget debugging/modifying your game will be more difficult and time-consuming due to your ...

View answer
5 answers
4 votes
5k views
Handling random with unique chance in Python
Accepted answer
10 votes

You want to use a weighted choice algorithm. Here's some code. (I modified my own working code to fit your case, but it should work): Ignoring the definition of WeightedChoice() for the moment, using ...

View answer
4 answers
9 votes
11k views
How do 3D game engines render 3D environments to a 2D screen?
Accepted answer
10 votes

3D sprites get a new Z axis that stores depth, scaling size and movements in the X/Y plane. A sprite that is farther away has a bigger Z value. Now, divide sprite's size and X/Y axis movements by the ...

View answer
7 answers
51 votes
10k views
2D Platformer AABB collision problems
Accepted answer
9 votes

OK, I figured out why the XNA AppHub platformer demo doesn't have the "jumping" bug: the demo tests the collision tiles from top to bottom. When up against a "wall" the player may be overlapping ...

View answer
2 answers
8 votes
2k views
How can I factor momentum into my space sim?
8 votes

Instead of manipulating the velocity directly, add another variable: acceleration, that gradually, smoothly alters the velocity: From classical physics (Newton's laws of motion): a = F/m // a ...

View answer
5 answers
15 votes
9k views
How can I get rid of "missing DLL" problems?
7 votes

I use Dependency Walker to track down missing DLL's: Dependency Walker is also very useful for troubleshooting system errors related to loading and executing modules. Dependency Walker detects ...

View answer
3 answers
10 votes
5k views
Storing a hex grid
6 votes

Personally, I would prefer simplicity over saving memory. Don't optimize until needed! If you're still bent on saving a few bytes, here's how you can do it: Slice the parallelogram in half to form ...

View answer
5 answers
12 votes
4k views
2D Level design/editing/saving questions
5 votes

A lot of games use an open source application called Mappy. It has its own format that supports multiple layers and other features. You probably want to associate several types of data with a given ...

View answer
4 answers
22 votes
11k views
What is some good examples about creating 2D fluids?
5 votes

Practical Fluid Mechanics Very detailed explanation with C++ code and pre-compiled binary. You can interact with the demo, like creating new smoke and stirring the smoke with your mouse. The image is ...

View answer
15 answers
67 votes
12k views
How might I eliminate asymmetrical gameplay caused by turn order?
4 votes

The Thue-Morse sequence is the fairest way to share [turns] between (two) players: AB BA BA AB BA AB AB BA BA AB AB BA AB BA BA AB BA AB AB BA AB BA BA AB AB BA BA AB BA AB AB BA BA AB AB BA AB BA BA ...

View answer
5 answers
4 votes
1k views
Collision detection performance problem
4 votes

Here are some tips, from simple to more complex. All these optimizations can be used together. The more complex optimizations will probably yield greater performance improvements, but add them only if ...

View answer
5 answers
4 votes
3k views
Good resources for 2.5D and rendering walls, floors, and sprites
4 votes

Here's a very detailed tutorial: Creating pseudo 3D games with HTML 5 canvas and raycasting. The key search term is "pseudo 3d game." Also I posted the text of the tutorials scgrn mentioned. (I ...

View answer
1 answers
1 votes
927 views
Math for Game Developers
4 votes

I highly recommend Daniel Kodicek's Mathematics & Physics for Programmers. Great sample code and detailed, illustrated explanations of everything. Google books page for 1st edition. Table of ...

View answer
6 answers
7 votes
4k views
How to implement a component based system for items in a web game
Accepted answer
4 votes

It looks like you are using relational modeling. There is an alternative method: property/prototype modeling, which Steve Yegge used to create his "ultimate extensible" MMORPG, Wyvern. Basically, each ...

View answer
2 answers
3 votes
2k views
Why does my position interpolation code result in "jumpy" motion?
3 votes

Problem: Your computer can achieve the target fixed physics framerate, but your phone cannot. Solutions: Reduce the physics framerate (Increase FIXED_TIMESTEP). Reduce the physics calculations ...

View answer
3 answers
14 votes
916 views
PC game update systems
3 votes

May be overkill, but RakNet includes an autopatcher system: The autopatcher is a class that manages the copying of missing or changed files between two or more systems. It handles transferring ...

View answer
5 answers
17 votes
2k views
How can I produce heatmaps based off of player reported data?
3 votes

Echo Chamber is a free logging and visualization tool specifically made for games. Visualize SQL based data files that contain information generated by a c++ application. Information can be log ...

View answer
6 answers
35 votes
9k views
Implementing a wrapping wire (like the Worms Ninja Rope) in a 2D physics engine
3 votes

Check out how the ninja rope in Gusanos was implemented: The rope acts like a particle until it attaches to something. Once attached, the rope just applies a force onto the worm. Attaching to dynamic ...

View answer
3 answers
17 votes
11k views
Resolving a collision with forces
2 votes

In the real world, there is no force that "pushes" one body outside of another body because objects don't ever penetrate each other. The closest thing is the normal force: created at the moment of ...

View answer
14 answers
14 votes
710 views
Are game manuals worthwhile anymore?
2 votes

I just found this game that is "manual-ware." It's an interesting model... The game is free, but you can support it by buying a manual: The 12-page, full-color printed manual for Sanctuary 17 ...

View answer
2 answers
3 votes
2k views
Server reconciliation for multiplayer games
1 votes

Your 3rd link answers your question: This screenshot was taken on a listen server with 200 milliseconds of lag (using net_fakelag), right after the server confirmed the hit. The red ...

View answer
1 answers
1 votes
433 views
Determine the bullet / particle reflection off of a circle in node js using SAT lib functions
1 votes

No need to use dot() or reflect(). Use the conservation of energy to calculate the new velocity of the ball after collision with a stationary object. A ball hitting a circle acts as if it hit a line ...

View answer
1 answers
1 votes
57 views
Help understanding the parkour tutorial in Cocos2d
1 votes

This is to keep the player centered on the screen (while maintaining the illusion of motion). The player is moving (right) relative to this.gamelayer. If this.gamelayer is shifted to the left the ...

View answer