48 votes

How can bays and straits be determined in a procedurally generated map?

Here's a rough idea using image processing transformations to isolate the features of interest: Apply a flood fill from an ocean cell to make a mask of all ocean cells. Depending on how your rivers ...
user avatar
  • 112k
30 votes
Accepted

How can bays and straits be determined in a procedurally generated map?

The way Dragons Abound identifies bays is to walk along the coastline and find two spots on the coastline where the straight-line distance between the spots is less than the distance along the ...
user avatar
  • 416
29 votes

Transmission implementation in a car game

this is because there is no inertia in your speed computation. you just compute it as an absolute consequence of engine rpm and gear. but when you compute the new rpm after gear shift up, you ...
user avatar
  • 2,343
17 votes
Accepted

Transmission implementation in a car game

Calculate the new RPM based on the new gear and current speed of the car. speed = (int) ((float)rpm / (float)maxRPM) * (float)maxSpeedsPerGear[gear - 1]); so: ...
user avatar
  • 814
15 votes
Accepted

How can I simulate a floating character in Box2D?

UPDATE: over the years I've become a bit more knowledgeable, and I realized Setup 2 can be modeled in a simpler way. I've added Setup 3, which I believe is the best solution. Your question inspired ...
user avatar
  • 1,685
7 votes
Accepted

Non linear scaling to show a sol system

Use a logarithmic scale where drawnRadius = log(actualRadius). You then end up with a spacing like this which shows all the planets quite neatly separated: (this ...
user avatar
  • 111k
7 votes

How can I simulate relatively realistic weather?

Fake it. At least to some extent. There is a field of programming that is concerned with simulating weather, as you're probably aware. It has come a long way, and we have very accurate weather ...
user avatar
6 votes
Accepted

physics engine without time steps

The problem is this only works if movement is linear and there is no possibility of other moving objects hitting one another. As soon as you have multiple forces changing the direction in non-linear ...
user avatar
6 votes

How can bays and straits be determined in a procedurally generated map?

Basically, you need to think about what you mean, precisely, by a bay or strait, and why you want to differentiate them (is it for AI calculations, or to label landmarks, or something else?). Play ...
user avatar
  • 161
6 votes
Accepted

What technique can I use to animate interaction between tiny objects in a sim game?

More often than not: it's all for show. In Stone Librande's GDC 2013 talk "Simulating a City, One Page at a Time" he illustrates this with the original SimCity, where even on those primitive ...
user avatar
  • 112k
5 votes

How do I calculate legal moves in a travelling board game?

One solution is to use a recursive function (Video explaining recursion). So for example the player is on the red square and he can do 5 moves : The function should see that the square on the right ...
user avatar
  • 1,718
5 votes

Transmission implementation in a car game

Gears are used as a reduction mechanism. Using a simplified transmission with just two ratios in the gearbox, one input gear (the engine) and one output gear (one of the ratios of the gearbox) we ...
user avatar
5 votes

How is structural analysis done in games (e.g.: bridge building, Dig or Die, and 3D)?

I am the dev of Dig or Die, so I can give a little more details about the game physics Indeed the most crucial point was the performances, as in the game you can build thousands of physical blocks, ...
user avatar
  • 151
4 votes
Accepted

Simulation of ball movement in a 3d landscape. The easiest way?

The first step in implementing a physics engine is to model the movement of each object in form of a 3d velocity vector. Each object has current velocities in x, y and z direction. Each logic tick of ...
user avatar
  • 111k
4 votes

Height field/Shallow water eqation water simulation with ground height

In a nutshell, what makes a shallow water equation a shallow water equation is that the water height is not zero and it assumes no variation in the seafloor. Note: No fluid dynamics equation will ...
user avatar
  • 1,740
4 votes

Transmission implementation in a car game

Keep in mind that an engaged manual transmission is a two-way device. The engine can accelerate the vehicle, just as the vehicle (more specifically its momentum) can accelerate the engine. This was a ...
user avatar
4 votes

How is structural analysis done in games (e.g.: bridge building, Dig or Die, and 3D)?

I've personally had good success with Iterative Relaxation. I think it follows the laws of physics quite nicely when dealing with objects made of aggregates of blocs. I believe the BridgeBuilder ...
user avatar
  • 421
3 votes

Simulating Smartphones on PC with Unity

Unity Remote exists for this purpose. Quoting their description: Unity Remote is an application that allows you to use your target device as a remote control for your project in Unity editor. ...
user avatar
  • 15.6k
3 votes

How do I run a physics simulation in the background, to determine possible future outcomes?

In most game engines, physics objects live in their own world, and are connected to game objects through some special logic, responsible, for instance, for copying transformations and notifying about ...
user avatar
  • 1,251
3 votes

Simple Water surface simulation problems (GDC2008 Matthias Muller- Hello World)

The error is in the slide, the correct implementation is: ...
user avatar
  • 2,826
3 votes

How can I simulate a floating character in Box2D?

NauticalMile's answer is great (and bonus points for the killer animated diagrams). To give an alternate suggestion that doesn't suffer from the same problems (the wheel collision stopping you from ...
user avatar
  • 6,008
3 votes
Accepted

How should I efficiently store faction relationships?

You could keep the factions in a dictionary inside your scenario/map/level instance, using ("groupA", "groupB") tuples as keys to store the relations between groups....
user avatar
3 votes
Accepted

What are the practical differences between discrete and continuous simulations?

(I apologise for the length hereof, but I'd like to clarify a few things to give you solid footing.) All digital computer simulations are actually discrete in nature. This includes everything from a ...
user avatar
  • 29.1k
3 votes
Accepted

How to make a noise gradient?

Here are two different ways I might approach this problem, showing how they change as the effect intensity is cranked up & down. The outermost column on each side is just my gradient, computed as ...
user avatar
  • 112k
3 votes
Accepted

Applying friction force not working correctly

When velocity is 0, friction becomes a zero vector and you can't normalize it, that's why it becomes NaN
user avatar
  • 14.5k
3 votes
Accepted

Effective & Efficient Way to Simulate a Desert

Notes: I know this is about Egypt, but I will not make this specific to Egypt... because people coming here may find this question and its answers useful for other desert simulations. I am trying to ...
user avatar
  • 17.9k
3 votes

gravity simulation implementation

@Bramm has the right answer. To be more specific, if you want a circular orbit, the planet starts at distance \$r\$ from the black hole and the acceleration is \$a\$ you want to give the planet an ...
user avatar
2 votes
Accepted

Throwing a ball and estimating its path using a Physics engine

Well I think it's possible to solve parabola/shape intersection equations. But first the problem is; I think it would be tricky to solve for more complicated shape and the intersection algorithm ...
user avatar
  • 12.5k
2 votes

Throwing a ball and estimating its path using a Physics engine

Unless you are in a situation where you NEED to optimize, don't waste your time on it. Avoid unnecessary premature pessimism, and premature optimization. For the sake of submitting some ideas I had ...
user avatar
  • 1,988

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