Jump to content

  • Log In with Google      Sign In   
  • Create Account


Postie

Member Since 28 Nov 2010
Offline Last Active Jul 21 2014 07:50 AM
-----

Posts I've Made

In Topic: (c#) list of lists of lists or outside helpers?

06 June 2014 - 07:34 PM

I agree with frob.

 

Using unique integer ids also simplifies the process of serialising your gamestate (either for save games or network transport ie multiplayer).


In Topic: Why is infinite technically not a number.

01 June 2014 - 06:37 PM

In a certain sense, Infinity can't be *a* number, because it is all numbers at once. There is no single value for infinity, There are also multiple infinities, and some infinities are demonstrably larger than other infinities. Eg, take the set of all odd integers and the set of all even integers. Clearly they are equal in size, but if you take the set of all integers, it is the sum of the odd integers set and even integers set, and is thus larger than either of them.


In Topic: 2D physics in a game.

01 June 2014 - 02:36 AM

Game physics is something that only works correctly if you update it at a constant, predictable rate, independent of the rate you're rendering to the screen. The way this is commonly achieved is to define how often you want to update your physics, eg, 20 times a second, and then calculate the elapsed time between each rendering frame. Accumulate that over several frames until you reach 1/20th of a second, then do a physics update, using 1/20th of a second as your time parameter in all your physics equations. This means that your physics updates are all done with the same time difference (or delta), and they happen predictably, which means the motion of your objects will be smooth.

 

I highly recommend you check out "Fix your timestep!", the seminal work on the topic.


In Topic: 2D physics in a game.

30 May 2014 - 10:50 PM

Typically, you'd apply a force to an object, which would cause that object to accelerate. Over time, acceleration alters the object's velocity. Over time, velocity alters the object's position.

 

Force, Acceleration, Velocity, Position and Time. Those are the 5 things you need to worry about. If however, you also want your object to rotate, then you have Torque, Angular acceleration, Angular velocity and Orientation to worry about.

 

Though it seems like 2D physics should be pretty easy compared to 3D physics, the concepts are actually the same, but some of the formulae are simpler since they involve one less dimension. 

 

I wrote a simple 2D physics engine in C# about 4 years ago, and Chris Hecker's articles on rigid body dynamics were an invaluable resource.

 


In Topic: Statistic algorithms for ECS

10 May 2014 - 04:54 PM

What ApochPiQ and swiftcoder said is exactly how I implemented my ECS. I don't have any caching stats I can point to that prove its better doing it that way, but I can say that it was relatively straightforward to implement, and gives you quite a few interesting advantages.

 

The biggest downside is that it becomes a little more difficult to list all components for a single entity, since each component is stored far away from the others. 


PARTNERS