Sunday, 12 August 2012

Technical difficulties

Many problems in the source code are in a form of a logic problem. There is a bridge problem which is introducing facing when the engine has no support for that for game objects. You can cross the bridge when walking but how about when swimming and trying to move on a bridge? It should block moving, but there is no default way to prevent that since bridge has no blocking value. I was able to solve that by checking when the player is swimming and block moving when there is a big enough object in that space. I guess it's not a perfect solution and may cause some unwanted side effects.

Another example is the pit problem which has troubled me quite a lot and I have mentioned it earlier. You can push a movable in the pit, but you can't push anything on top of that movable or you shouldn't be able to walk across the pit without falling into it. Then again, you should not be able to be on same spot with a large movable object. It's somewhat difficult problem to solve without producing strange side effects.

1 comment:

  1. You make an excellent point about the bridge! I had been recently considering exactly the same thing, and the problem really amounts to being "in" the flooring vs "on" the flooring.

    I see two possible solutions there.

    1) Boolean for in vs. on and blocking according to current status.

    2) swimming takes place in the water one z-level below the bridge, and either it can then be swam under, or a blocking "bridge support" item can prevent movement

    Solution 2 also works for the pit, although if you want walking-across behavior, you'd have to tag the large object as creating a floor above it in some way.

    In relevance to my own work, I'm glad you mentioned this because while I have moving large objects, I hadn't considered providing for walking across the top of them explicitly.