Thursday, November 29, 2007

Distribution

I've made a whole lot of progress on the gameplay. So far it's a ton easier than it was the last few iterations, I think due to my increased experience and the improvements in the design. The design is much better.

The toughest part before (and one of the biggest overhauls this time around) was the distribution of the people. When a person reaches the end of a segment and has multiple directions to go (including turning around), he picks based on which way needs more people. This requires some math thinky.

However, if all the lanes are full, he can't pass through. Determining that also takes some more code piled on top of the previous.

What if the route isn't fully built? We have to increase its length and turn the person back around.

What if the segment is retracting? We have to turn the person around.

What if there are multiple people passing through at once?

These don't sound like huge problems, but I had them all in one method in the node class. Even people that don't reach the node are run through it because the node contained all distribution code. Piled on top of each other, they made a mess and the code became hard to manage. Coding this portion took alot of debugging the last few times around.

However, this time I'm cutting it in half and putting the first half in the segment class. This code will be concerned with everything that doesn't involve the node, such as building and retracting.

I've already completed (yet to test) the node's distribution code, and now I have to write the segment's.

If you've noticed, I've started calling sections segments. I've changed the official name because segment is more fitting. Section was invented as a "for lack of a better word", but now I've found a better word. Segment.

Vids of the last iteration will be posted soon. Patience, grasshopper.

Suggestions? Questions? Singing praises?

clevceo

No comments: