• izzy

    Posts: 7

    Joined: 1st Apr, 2015 9:15pm

    Progress Sharing #36


    We had a pretty good two weeks work, and did a huge amount of stuff. Most work (3 days) went into adding


    Procedurally generated cave geometry

    So what is a procedurally generated cave geometry? It is dungeon building algorithm that will generate cave walls, turnaround, T-junctions on the fly and randomize it's geometry and texture to give each level a different feel. For now only walls were procedurally generated, but now caves are generated as well.

    Here it is how it looks vs wireframe type. And how it works? Well, I subdivide 3D geometry in 3 pieces vertically, then subdivide each chunk in another four pieces. Each vertex is then randomly offseted on x or y coordinate. After randomization I just ensure that some vertices are on same position (start and end vertex on each z level), just to have seamless transitions between two type of walls.

    On those screenshots I do only 3 different distorted type of walls, mainly because of speed. Caves look good enough, and complete level generation, with procedurally generated walls AND caves is around 0.5-2 sec.

    As post processing I recalculate normals on each face, then manually darken or lighten those faces.


    Lightmaps

    I had some nasty lightmap issues, where certain map areas were in complete dark. Basically, this bug is some leftover from ASCII engine, when certain tiles have foreground color and black background, and it was reflected into HD engine as well. This is how it look when the bug was fixed.

    Unfortunatelly, I had to change a complete lightmap handling. Although it sounds as a lot of work, it took me less than half hour :). Now I am using lighmap generation from ASCII version, and complete game started to look different. Complete level got different shade and some parts even different color. There were nice side effects like here where lava is illuminating walls, so they get reddish color (yes, ASCII version is doing the same effect). Another side effect was that water got bluish and self illuminated color. It doesn't look so bad, I will leave it for now.

    Another big game change was to reduce light radius for player to 5-6 tiles. The game got some mystic feel, and it was much more pleasurable to play. Off course torches and other light sources illuminate dark part of the dungeon, so you can see far away in a straight line. The end solution will be to add torch in player's hand, so removing torch will leave player in darkness, but that is a task for stealth part of the game.

    Another issue with lightmap was that transition between two tiles was not smooth. Here is slowed down example:

    After fixing some math issues:

    • ASCII
    • HD which got smoothed edges, but animation was not perfect. Final result looked pretty decent.


    Delayed Conditional Events

    One really big change was involving attacks that happen in middle of animation. Like hitting, dodging and similar. Look at this example. Barrel is destroyed on beginning of animation. This was off course normal, because everything was descended from ASCII version and in one ASCII roguelike you usually don't have animations. When actor initiated attack combat sequence looked like:

    • Game determined attacked and defender, attack animation started
    • Run through combat simulator
    • Dependently on outcome, hit, death or dodge animation is fired.
    • All combat effects were applied

    Solution was to add Delayed Conditional Events. Now the combat sequence looks like:

    • Determine the outcome of the combat
    • Start the animation and add Delayed Conditional Event bound to animation that will trigger on middle part of animation
    • Game goes on, everything works as usual
    • When the animation reaches middle frame, combat simulator is triggered
    • Dependently on outcome, hit, death or dodge animation is fired.
    • All combat effects applied

    Now, the trick is that these Delayed Conditional Events also work in ASCII game. It was really tricky to incorporate these events into the game, to work in ASCII and HD. It works similarly to promises in javascript, only in C++ :) and without threads.


    Quality of life improvements

    • Message window fades out after 5 sec. Game screen is more visible.
    • Added loading screen
    • Added main menu screen but it is not yet finished. Transitions between menu and game were created.
    • Message window is now rendered in separate FBO which gave me 25% improvement in speed :)
    • I should have done this sooner. Actions like healing will not deselect current power. It will heal you, but selection will remain on your current spell. Done in ASCII and HD.
    • Dead enemies are always visible on map and minimap


    Bug fixes

    • Casting heal on floor crashed the game.
    • Fixed issue with frame skipping. On beginning of each walk/run cycle, player started with moving immediately, which resulted in small jumpwhen player moved in between of two tiles.
    • I was adding pickup item listeners, on each item pickup. After 10th pickup I got 10 event listeners attached to player.
    • In some cases, door orientation was bad due different tile types being set on the side of the door. This is fixed good orientationof the doors.

    Reply
    You are not signed in. You need to sign in if you want to post.
    STATISTICS

    Total posts • Total topics • Total members • Our newest explorer is