How far can you go?

Started by
4 comments, last by pinacolada 18 years, 7 months ago
This is a programming problem, but doens't have anything to do with code. I'm attempting to write a simple graphics engine, and right now, I'm going fairly well. I downloaded the Irrlicht engine, version 0.1, the first release, and, I'll admit that a lot of my code is fairly similar or almost exactly the same simply because I couldn't think of better ways to do things than the author has. Right now, I'll be in the middle of something (happened twice tonight) and I realised that I couldn't go on until I wrote something else. So I went and wrote this thing from scratch, and then continued on with what I was doing. I've found that so far, half the work I've currently done has interrupted my scene graph. I was writing it, and realised that I needed this, which needed this, which needed this, etc, etc, ad infinitum. But here's my problem/question. How far down this line have you guys gone while still remembering where your original interruption point was?
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
Advertisement
Far enough to realize I should design first.
Quote:Original post by Illco
Far enough to realize I should design first.


That's definately a fair point, but because I have practically no experience in making something this big, I don't really know everything that's needed.

I mean, don't get me wrong, everytime I have to write something new, I actually sit down and design what I need for that, often going so far as to write all the code out so I end up thinking the whole class (or whatever) through, and that goes fine. I just can't design for the larger scale yet, I need more experience to know what's needed.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
IMO its quite common to begin coding something and discover that you require something else before you can continue. Often this happens because the concept wasn't properly designed before-hand (using UML-diagrams can help in this case). Eventually you will code down to a more fundamental level - such as a vector3d class or something and then you can begin working back up until you finish what you had started and begin the next task.

Since you mentioned Irrlicht, I would point out that its not the best-built engine I've ever seen and it suffers from numerous design flaws. The engine seems to be quite brittle on a whole.
A more stable freely available engine Ogre, although I dont much like its design, I think that certain patterns - such as the Singleton pattern and multiple inheritance - are far too abused and the engine is clearly not designed for maximum performance with the liberal use of virtual functions. Irrlicht is probably a culprit of similar design flaws.

If you are justing going to copy the irrlicht engine then why not use the engine and learn how it works - then write your own fresh engine once you know what can be improved, and try to make a design plan so you have a better idea of how things fit together.

Edit: also design with modularity, design small components and then design larger systems with those building blocks, keep it up until you have a complete engine or game.
I remember the original interruption?

I actually don't find such interruptions too bothersome. For example, I recently re-started work [from near scratch] on a turn based 4X game. Work started on the server side first, just getting basic networking, infrastructure and unit oganization done. Once the thing got too big to debug nicely in the console, I started work on the client, which required gui constructs....

Anyways, I did eventually have to go back to the server code. Enough time had gone by that I could once again view it more objectively, and see that the unit orginization code was fairly horrendous. 3 steps forward, 1 step back isn't perhaps the best coding practice, but it tends to produce better code overall [for me at least]. And it tends to keep me just fixing code rather than trashing it and picking out the good bits.
I think my brain can only go like 2 stack frames deep. Maybe 3 or 4 if the bottom tasks are quick fixes that have become automatic (like adding an accessor for a variable).

But I find jumping around like that isn't the most effective way to get things done. Usually I try to finish the function I'm working on, and if I realize I need something, I pretend it's already there and add it to a mental list of "things I need to do next".

And anyway, most IDEs come with a free tool that can search for things you forgot to write: just press F5 =)

This topic is closed to new replies.

Advertisement