Archived

This topic is now archived and is closed to further replies.

ThomasSauder

about game programming

Recommended Posts

ThomasSauder    122
Would I have to full understand the purpose of fib() to program games? because it seems irrellivent to me right now Same question with recursion [edited by - ThomasSauder on October 3, 2002 7:27:42 PM]

Share this post


Link to post
Share on other sites
ThomasSauder    122
Boosting this to top for game developpers that migth take a look at my question. Just going to restate it: Does fib() or Recursions get used a lot in game programming? or should i just learn the basics of those topics and that''s it?

Share this post


Link to post
Share on other sites
Cold_Steel    835
Well, I''m not a professional game programmer, but I have experience writing a lot of code. Recursion most likely isn''t used in games all that much. This is mainly because recursion is slower than iteration due to more function calls, and it uses more memory.

However, it is useful to have a solid grasp of recursion. For one, there are a lot of problems where recursion is the simplest, most elegant solution. Iteration may be faster, but it won''t be as pretty a lot of times. Take for example the Fibonacci sequence. You can calculate fib numbers without recursion, but the formula is not really that obvious. The recursive solution is much more understandable.

However, there are some problems(even in games) where recursion really is the best solution. For example, I''m working on a skeletal animation system, and in my system, each bone has its own mesh in the model file. Loading the hierarchy of bones is very simple using recursion, but I don''t even want to think about what it would be like to write without recursion(might be impossible).

In short, recursion might not be used that much in games, but it can be really helpful to know.

Share this post


Link to post
Share on other sites
ThomasSauder    122
Ok Thanks, I was just asking this because as being a new programmer, the concept on how it works is hard for me to understand right now. Hopefully I''ll understand it in the future

Share this post


Link to post
Share on other sites