TINS Logo

Welcome, new user. Please log in or register.

elias Thu 31 Dec 20, 19:26

Congratulations on surviving 2020! I'm still stuck in 2020 for another 9 hours (and at work so no last-minute Krampushack fixes) but I'm hopeful now I'm gonna make it as well.

elias Thu 31 Dec 20, 18:07

I tried to create Windows and Macos binaries (also includes sources). They work for me but usually binaries depend on some local shared libraries and won't work for anyone else, I added some though this time I had forgot for TINS 2020 so maybe this time the binaries work:

http://elias.pschernig.com/DungeonSimulatorByElias.zip

elias Thu 31 Dec 20, 02:30

I just tried and .zip up my game - the resulting .zip file is over 200MB. Big trouble. Now I'm trying to reduce triangle counts. The dragon had to go from 50k triangles to just 1000 (see screenshot).

Unfortunately my characters are all made with a custom sphere-placing utility and so I have to edit them all by hand to reduce the triangle count. I still have no idea how much smaller the .zip will be, but very likely this will get it down to 20MB or so. After that I'll have to cut animation frames and the wall/floor variations I made :(

elias Sun 27 Dec 20, 23:08
(This post is marked spoiler. It will be hidden for some viewers)

The shadows keep coming back. I made it so shadows are rendered on separate threads so they don't affect the framerate but it turned out rather involved. I have three separate queues now, one with heroes who need shadows, one with shadows to be processes by worker threads and one with completed shadows to be applied to textures on the main thread. There's lots and lots of things I had to take care of, for example if a hero dies but still has shadows queued up I can't just free() the hero or the shadow could asynchronously get applied to a destroyed bitmap. Lots of thread synchronization and event listening code later I have it all working though!

To fulfill one of the wishes as part of the dungeon simulation the dungeon master also has to pay the utility bills. Drawing a bill can be quite involved but I think it's good enough for now (see screenshot).

It still have a lot to do, most importantly there isn't any real gameplay yet. And I think I may want some sound effects if I have time.

I also discovered that since the last time I tried to profile my Allegro programs oprofile has been improved a lot, much easier to use than I remember:
https://elias.pschernig.com/dungeonsim_profiler.svg

That shows me immediately that half of the time is spent in Allegro's al_draw_vertex_buffer - which means things are fine, it's where I want time to be spent :)

elias Thu 24 Dec 20, 00:43

I'm getting bogged down with small details. As part of the unavoidable feature creep I decided I'd let my heroes outfit themselves with extra gear. So as you can see in the screenshot they can now lose their sword, shield and helmet and then pick up a number of upgrades for each (no separate pictures yet).

Anyway, once that was working I realized the shadow algorithm I had made a few posts back didn't work anymore - the shadow always represented the version of the hero with no equipment. So I needed now, for each animation step, a rendering of the shadow of each equipment item while equipped. Then combine the shadow of the base hero with the shadows of any equipped items in their animated frame. With 4 separate heroes and 15 animation steps each that meant 60 base shadows plus an extra 60 shadows for each equippable item. That would add up to 100ds of shadow textures when I only have maybe 20 or 30 characters on screen at a time - so I changed the idea and now dynamically maintain a shadow for each character. Whenever an equipment item is changed they update their shadow texture. Well, 100ds of lines of code later it seems to somewhat work!

elias Sun 20 Dec 20, 22:04
(This post is marked spoiler. It will be hidden for some viewers)

Finally started with the actual game. I'm making a dungeon simulator. Heroes will enter and solve quests and battle monsters and so on - and your job is to keep everything running smoothly.

As for progress, I fixed a bug with the hex-distance (see how the light falloff is much more regular now!). I even have some unit tests now to double check those hex functions.

I also have a new monster, a giant rat!

And I detect mouse clicks now and show a menu in response.

elias Sun 20 Dec 20, 04:23

The troll can now kick and the knight thrust his sword forward! There is logic for the to spot each other when on adjacent hexes and to start fighting. They also both have health and a health bar is displayed and they will fight until one of them is knocked out.

I also added an archer, the logic to shoot arrows from two hexes away is working but there is no shooting animation or visible arrow particle.

I probably need to stop with graphics at this point though and start with gameplay.

elias Sat 19 Dec 20, 05:15

I didn't have much time to spend on this for a few days but this evening I made progress - both the heroes and the trolls now have shadows.

The way they are done is, when I load a model from its .obj file, for each animation step I create a shadow bitmap, then render the model with a camera straight above into that bitmap. Then I go through the pixels and color them all black if anything was rendered, otherwise transparent. Then finally I apply a Gaussian blur to the bitmap.

Now with the preparations done and a shadow bitmap for each 3D model frame when it comes to rendering the model later, I place a square quad at its feet, oriented the same direction as the model, with the shadow bitmap as texture. To avoid depth buffer problems I also shift it upwards by 0.01 and disable depth writes for the shadow.

It was a lot of work but I really do like my shadows. I completely forgot the 3 wishes I'm supposed to implement, I'll have to return to that another day...

elias Tue 15 Dec 20, 05:13

I'm completely ignoring the wishes for now so no spoilers yet :) I have a random hexagon dungeon and a hero with a sword and shield and helmet! There also is a path finder for the hero to traverse the dungeon (just turn randomly at any intersection).

In order to not be hidden behind walls I added a stream of black abyss to the south of any walkable tile.

Also the troll from my KrampusHack 2019 game makes a reappearance as the monster in the dungeon!

elias Sun 13 Dec 20, 17:32

I have ideas for all the wishes. Let's see how much of it I'll be able to implement. There is nothing very specific in my wishes so as long as I avoid some words I think I won't need spoiler tags for most posts.

I already made good progress - as you can see in the screenshot I'm going with a dungeon theme and a hex map! Not sure I ever used a hex map before so this will be interesting.

Until end of December sounds like a lot of time but I know that the 20 80 rule is always true - need to implement 80% of what I want at the end in the first 20% of time or I'll run out.

elias Fri 20 Nov 20, 17:22

My three wishes:

1. Holidays! There should be some holiday theme. (Could be any holiday, like christmas, dewali, hanukkah, chinese new year, ramadan... I also don't mind if it's one I didn't even know about.)

2. Lights! Lights are so pretty, I want the game to have some kind of lights.

3. No violence. I'd like a non-violent game, like maybe a peaceful puzzle game, or maybe a game where you have to avoid monsters instead of hurting or killing them. (I'm sorry if you're rmbeer.)