Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

mk1x86

Member Since 16 May 2007
Offline Last Active May 16 2013 05:30 AM
-----

Posts I've Made

In Topic: Particle parameter interpolation strategies

26 April 2013 - 02:55 AM

Ah, polynomials, of course, how can I be so stupid :S One question though, how do I calculate a polynomial from a set of points and tangets? I slightly remember how it could go by points, but tangents? Not a clue...

Well, given you have f(x) = ax3+bx2+cx+d you can start with your starting point and end point. Say you interpolate from 0 to 1 in a timespan from 0 to 1 (time is x) then for your starting point you know that a*0+b*0+c*0+d = 0. It follows that d = 0.

Same for the end point. For time x = 1 you know that a + b + c + d = 1

Now you can start using the tangents of your start and end point. For that you have to derive the polynomal, which results in g(x) = 3ax2+2bx+c

If you enter values for the start and end point you get two further equations. Now we have four equations and four unknown variables. All you need to do is add and subtract the equations from each other until you finally get all variables (if you're unfamiliar with it, take a look here).


In Topic: Particle parameter interpolation strategies

25 April 2013 - 08:16 AM

Usually a third degree polynomial is sufficient. You can edit it by changing the tangents of the start and end point. Then there's (B-)splines obviously, but that requires a fair amount of calculation time. You can also take a look at Lagrange interpolation.

 

The best thing you can do is to write an editor that allows different interpolation types for pieces of your timeline.


In Topic: getting better at c++

05 February 2013 - 04:10 PM

Something you should learn is design patterns (see gang of four). Then you could try to implement an advanced algorithm like A* pathfinding. While the basics are easy (this tutorial is excellent imo and covers all the basics) there's much room for optimization. You can also try to write an advanced number class, which supports imaginary numbers. That way you learn overloading operators.

 

When you're done with, try out some APIs, maybe get into game programming using a free game engine (irrlicht is a good engine for beginners). You'll learn a lot about good api architectures just by using others.


In Topic: about "delete" and "delete []"

15 January 2013 - 03:13 AM

The only difference between delete and delete[] is, that in the latter case the object destructor isn't called for the pointer address only but all subsequent "positions" in the array until the end of the memory block is reached. In theory it should be save to always call delete[] since the memory block would have only sizeof(object). But it's better to follow the rules to ensure compiler compability. You should also consider using dynamic arrays like std::vector which does the gritty things for you.


In Topic: batch draw!

10 December 2012 - 02:37 AM

If your atlas exceeds the supported texture size you must split it into two atlas textures. You should gather sprites, that are likely to be close to each other in game, in one atlas. If you have different themes (e.g. desert & ice) you should place all desert sprites in one atlas and all ice sprites into the other.

As for shaders, you can draw different textures, but you won't get any performance gain from that as you still need to load both textures to vram. On "how" to do that I suggest getting a book on shader programming since this isn't explained in a few sentences and - depending on what you want do - requires a fair amount of advanced mathematics.

PARTNERS