Jump to content

- - - - -

Rumors of my death are greatly exaggerated (if not entirely unwarranted).

4: Adsense

It's been quite a while since my last post. I am making progress, if slowly. Here is some of that progress.

Day/night cycles.
The game keeps track of time of day and, when outdoors, the ambient lighting adjusts to appropriate levels. Walking into a bed triggers sleep which will pass time. Sleep will reset spell cooldowns and recharge energy and health, but the characters' hunger continues to increase while asleep.

Posted Image

Night falls.

Animated tiles and room fade.
The engine now supports animated static tiles, which should make the world feel a bit more alive. Also, when indoors, the walls get in the way. In searching for a solution I decided it was best to simply fade out the entire exterior area when entering a building or room within a building.

The engine can now serialize entities, saving state of dungeons and outdoor areas when moving between, and making it possible to save/load games. To avoid "save scumming", however, the game will only have 1 save slot per game, and saving will occur automatically when certain events occur.

Compiler bugs?
I don't lightly accuse my tools of being the problem, but I don't know what other conclusion to draw in this case. The problem first exhibited as some sort of heap corruption; the Marmalade system would get arbitrary read or write violations when flushing the GL buffer. I thoroughly examined every piece of code that touched the heap. I commented out large swaths of code but was having trouble correlating the absence or presence of code to the absence or presence of the bug. I searched the marmalade forums, I upgrade marmalade and uninstalled Visual Studio patches. Nothing worked. Finally, while commenting/uncommenting code trying to manually narrow down the source once again, it dawned on me that maybe it wasn't the procedural code per se but the variable declarations -- I located a rather large structure that was allocated on the stack in the top-level rendering function and moved its declaration outside the function. Boom, worked perfectly every time, the problem was gone. I never bothered to root cause the true source of the bug, but I'm pretty sure it's an issue with the VS compiler. Somehow, it was allowing the stack to collide with the heap undetected. This only happened in debug mode. The problem never occurred in release and did not occur in ARM builds (which are built with gcc). Anyways this was a huge waste of time.

Ranged attacks.
Unsatisfied with the idea of the game automatically choosing targets of all ranged attacks/spells/skills, I bit the bullet and implemented ranged target selection. The system allows a selection of a varying radius and maximum range.

Posted Image

AOE Target Selection

Particle effects.
I really didn't want to have to draw death animations for every sprite, and I did want to implement more effects to make combat more satisfying. I realized that a particle effect engine could solve both problems very nicely.

Posted Image

And boom goes the dynamite.

As the game is played, the characters become hungry. I want the gameplay focus to be on survival, as many roguelikes are. Actions have consequences, and once of those consequences is increasing hunger and the need to procure sustenance. I've implemented hunger and a (perhaps too complex) food item system. Food decays over time. Cooking can decrease decay rates and increase flavor (characters' willingness to actually eat the food). Prepared foods have different ingredient components: e.g., meat, plant, minerals. This may (eventually) affect different characters differently. Prepared foods may also have additional effects aside from just sustenance.

Posted Image

Details of Fried Bacon item. Also note the exterior area around the room has faded out, giving a much clearer and cleaner view of the contents of the room.

- I redid the font. I can't figure out where the old one came from and I think it's just a Windows font anyways.
- Combat mechanics are partially implemented. Details to come in a future post.
- Title screen and menu is implemented. I'm trying to come up with a good title.
- My focus right now is on getting an actual game playable. It won't have a ton of content immediately, but that can be added as time goes on.
- I'm going to try to make updates more frequent. Minor feature implemented? Screenshot+update. As is I was having trouble remembering everything I had done.

Nov 10 2012 02:22 PM
Very nice!!! Reminds me of Tibia.
Nov 11 2012 06:21 AM
Thanks! I hadn't seen Tibia before, it looks pretty cool.
Nov 11 2012 01:19 PM
I remember causing much trouble in that game online, haha! Was a bit of a troll. ;)
Nov 14 2012 08:05 AM
I am following your project closely. I was afraid you had stopped doing journal updates, glad to see you back :) the particle effect looks great! How do you handle the particle collisions and response. Any physics library involved? Keep it up, looking forward to future updates!
Nov 15 2012 09:17 PM
Thanks :) The particle effect engine is pretty simple, I just track position/velocity/acceleration of groups of particles. Transformations to velocity, color, size, etc., can occur and the particles are rendered as either solid rectangles or bitmaps. Both the 'explosions' and the fire are particle effects. For efficiency, the fire calculations are the same for every instance of the effect, but after some testing I think I can make them completely independent without creating a large CPU burden. Because they can then start and stop independently, I should be able to 'start' the fire when the effect is started and then 'extinguish' the fire shortly before the effect times out.

Note: GameDev.net moderates comments.