Hello there fellow #gamedev
I recently started to participate in a gamedev challenge (#100daysofgamedev) to try to keep me motivated and forcing me to post updates somewhat regularly.
Until now, i posted only on discord, but i think it might be better to do it in here instead. I don't really like that stuff like that gets lost on hard to search, not indexable discord servers...
So i'll try to duplicate the first days here in a thread (maybe?) and keep adding new ones as i go :)
Cheers
Day 001: Hello world.
My order is on the way so i thought i'd start this challenge by playing around with the Playdate (an indie handheld game system) and their SDK.
So i've made a small hello world example using the Odin language (via their C API) and i'll keep going from there for a couple of weeks and see where this goes, nothing huge planned for now
If anyone is curious, here is the hello world code: https://github.com/colinbellino/playdate-odin-hello-world
Day 002: Deep dive into the Playdate SDK, reading hardware specs & design docs, code hot reload.
Not a lot of visible progress today, but managed to implement a basic code hot reload feature so i don't have to reopen the simulator every time i change some code. Slowly but surely getting back into it ^^
Related links:
- Designing for playdate: https://help.play.date/developer/designing-for-playdate/
- C API: - https://sdk.play.date/2.0.3/Inside%20Playdate%20with%20C.html
Day 003 (1/3): For the past few months i've been working on my own game engine that fits my very specific needs: small, 2d games, mainly pixel art, low level language (odin & c), etc
The goal is to learn as much stuff as possible for the engine side, and be able to then make all my future games in a codebase i own myself (i don't plan on making it public).
I should be able to start working on that full time in the following weeks, so this is exciting
Day 003 (2/3): The platform and rendering layers are "good enough for now" ™ so i started working on recreating of my old jam games (https://colinbellino.itch.io/snowball) in the new codebase. The game is a very simple tactical RPG so it's a good fit (not too big, not too small).
Day 003 (3/3): Today was spent mostly coding some battle systems like a turn order for the units and starting to prepare stuff for player movement and targeting. Trying to think of a better control scheme that works well with mouse, keyboard and gamepad.
I still have a good chunk of my day tweaking the engine more than the game code, but that's the point: dogfooding so i can make it better for myself later.
Day 004: Didn't get much time to work this week but i'm still working on the battle systems.
Today was move/cast range and some code underneath to search/filter tiles with some conditions.
Also added more dev tools and in game cheats so i can test this stuff quickly while still implementing real constraints (like valid targets for abilities, range, etc).
Day 005-006: Not much gamedev done, mainly debugging/fixing bugs and working on animation system (easing between values, changing sprites, etc).
Day 007: A couple of hours implementing the logic to a bare-bone animation system and some debug UI for it.
Day 008: More animation code work.
Also updated my editor theme and fixed some memory leaks in it. Color scheme "totally not stolen" from Isa's IMGUI config in https://github.com/isadorasophia/murder
Day 009: I now have working animation for sprites and colors and with different easing methods.
Next i want to animate transforms (position, scale & rotate) but i'll probably want to change how my entities are stored if i want the parent transforms to affect their children But that's a problem for future me!
Day 010-011: Plug the animation system with my entity system so i can animate units. Animation works for color, scale, position and sprite/texture, still haven't done rotation because i'm not sure i actually need that.
Still chipping at the project 1 hour at the time, I can't wait to be able to spend more time on this haha.
Day 012-013: Making the animation system work on units and plug that into the battle system to have some (very) crude unit movement. The pathfinding isn't plugged in and the animations are obviously placeholders, but hey, it's progress
Day 014-015: Fixed some rendering issues, memory leaks, and upgraded DearImGUI to the "docked" branch.
Day 016: Updated the engine to allow nesting transforms components into their parents so i can scale/move only the parent (unit) and have the children (hands) scale and move accordingly.
Also got back to unit walk animation which i'll be able to showcase here soon.
Day 017: Lost half the day trying to open a 2 years old Unity project because everything that could go wrong, did just that (multiple crashes, asset references lost, bugs, missing packages, etc). Finally got it running after 3 hours of madness.. I do not miss working with Unity haha.
Rest of the day i spent working on my server, slowly starting to move my git projects to it because i don't want to depend on Microsoft for that anymore...
Day 018 (1/2): Investigated a memory leak in one of the libraries i am using, i think it's probably me doing something really dumb in my DearIMGUI or Tracy calls haha.
So i'm putting tools in place to track allocations that are done in C/C++ libs (everything is already tracked and budgeted in my Odin code) and hopefully i'll report back on this tomorrow
Day 018 (2/2): I wanted to spend more time on the actual game and less on the tools but i'm thinking long term so i have to resist and make sure i make the tools i need along the way. I'll get there ^^
Day 019-022 (1/2): was sick for the last week or so but managed to get some work done here and there.
Managed to integrate Tracy (frame profiler) with my tools so i can track cpu usage and memory usage of my arenas. Right now i have just two memory arenas (one for the engine and one for the game data), but that will change soon as i add more game systems. And a small one for scratch data, that i clear at the end of the frame.
...
Day 019-022 (2/2): While doing that i found some issues on my architecture and managed to fix a lot of them, but at that point i have to resist very hard not to spend too much time rewriting it again.
Should be back on game systems tomorrow if i'm well enough to work, i have more work to do for the units movement animations
Here is what it looks like in tracy (https://github.com/wolfpld/tracy), highly recommend this frame profiler.
Day 023: Spent some time moving the animation system to the engine code and make a simpler API.
It's not much but that allowed me to prepare some stuff for the next step which is: to chain unit animations (walk, climb, jump, change direction, etc) and loop/repeat them when needed.
Day 024: More animation work. I updated the system to be able to easily queue animations and wait for them to complete (ie: during battles and cutscenes).
It's not looking great because the path finding isn't plugged in yet and i'm still using placeholder animations, but the code is there at least.
Also, I had to spent half the day fixing my work environment (OS and editor :/) because it's one of those days where everything decided to fail... *sigh*
Day 025: I've been experimenting a little with DearImGUI docking branch and having the game run inside a window, so i can move, resize and dock it like any other.
Not sure i'm gonna keep it like that, but it was interesting to investivate and see how that would work.
Day 026: Add unit facing direction and flip animation during movement. Some minor work on dev tools for animations and rendering.
Edit: Eww, mastodon is converting videos to gif and the quality is awful :/
Day 027 and 028 are linked below, because i fucked up and didn't attach them to the thread
027: https://mastodon.gamedev.place/@colinbellino/111258097842896167
028: https://mastodon.gamedev.place/@colinbellino/111263222471535720
Day 029: Started implementing audio playback in the engine today.
I wanted to try out both sokol_audio and sdl/sdl_mixer so i coded a small prototype in both and i think i'm gonna stick with SDL2 for now. The SDL3 branch also looks super interesting with that new audio system (but not diving into that now haha). So far i got a simple wav file loading and playing with some basic mixing, next i'll integrate that into my existing asset pipeline and see how this goes.
DAY 030: Updated my build script to handle audio files and plugged the audio system into the asset pipeline. So now i can load/unload sounds like all my other assets, hot reload too (though i haven't used this in a while tbf). I need to work on having different load options for audio files next, since i'll probably need to handle small sound clips differently than big music files.
Here is a short clip of how it works right now in my ugly assets UI :
Day 031: More audio work, i think it's good enough for now. I've added battle music and the first sound effects into the game (and engine). Everything is now handled like other assets by the engine and can be called from game code easily when i need to.
Day 032: Still under the weather today but managed to work a couple of hours, so i added events into the animation system so i can play sounds at any point during an animation.
Day 033: Added CPU controlled entities and time_scale so they can battle without me \o/
This is just a first pass, so the CPU is just choosing random targets at the moment and not really planning its turn. And now i can increase the time_scale and the battle goes brrrr!
Also, did some clean up of the animation system and queues, and fixed an audio issue on Windows.
Day 034: Migrated more code from the game to the engine and rework the entity/component code to make it easier to use in game code.
I don't need a full blown ECS, just components and entities, so i'm going for something simple (inspired by https://github.com/NoahR02/odin-ecs)
Day 035-036: Had to rework a some code after the entity/component changes because i didn't want to lose quality of life features like code hot reloading just for this system.
Day 037: Back to game code so i added ability damage, death animation, win/lose condition detection and color palette swap to differentiate teams during battle.
Day 038-040: Didn't work much because of health reason but managed to: fix some issues in my components system, fix transition between world map and the battle scenes, add current unit indicator on top of the current unit.
Edit: oh boy, mastodon does NOT like this gif...
Day 041-044: Struggling a bit on shader work and plumbing internal to the engine but still managed to get some things done. Nothing worth a screenshot though ^^
- Added devtools to better work with shaders (hot reload, preview window, etc)
- Added in game console to visualise logs (and input commands later down the line)
- Started working on a line renderer
Day 045-047: A few hours here and there but got the shader done.
- Learn more things about fragment shaders and matrices math because i'm very bad at it :3
- Draw unit move path and ability line of sight during battles
- Fix frame drops due to me doing dumb things with my CPU AI (it was quick and dirty placeholder code, but waaay more on the dirty side...)
Day 048: Back to full time game dev this week \o/ Did a few things on the game:
- Prevent movement on cells occupied by units
- Update battle code to use set seeds for everything random
- Replace temporary path finding and flood fill code by something performant
- Improve the script that builds my game and bundles the assets
Day 049: Did not work much on what i planned today because i found some bugs to squash in the engine
- Revert some part of the pathfinding code so units can jump slopes again
- Fix entity/components code moving blocks of memory around and leaving invalid pointers in animation system
- Fix some edge cases in the flood fill code that were super slow
- Add some unit tests to my math library
Day 050: Rework the code used by the CPU controlled units to work the same as when a player is controlling a unit.
Made some changes to my animation system so i can chain animations, play them in parallel and have events spawn new animations in the queue.
Day 051: Finally took the time to change big chunks of my code to use arena allocators that are allocated on startup, so no more memory allocation during gameplay. This was also the occasion to fix some small memory leaks because i wasn't pushing into the arena that was cleared at the end of the turn. (screenshot shows the few memory arenas i now work with)
Really like #odinlang, having arena and allocators built in the language make it very nice to work with.
Day 052: I simplified how to initialise the different engine modules because i now have enough usage code to understand what i need exactly.
For example, this is how initialising the engine and opening a window via code now looks like:
Day 053-055: More engine work and finally back to game features:
- More work on memory arenas and internal stuff
- Made some optimization to the CPU code preparing data for the renderer (from 1.5ms to 60μs, mostly due to a better data layout and sort)
- Autorun the game at x100 speed, this is super useful for soak testing and AI debugging.
- Made a quick shader to draw the board grid as an overlay for debug
- Now import all layers from map files (.ldtk)
Day 056-070 (1/2): I worked on and off on the project and forgot to post in a while so i'll summarise what i did in the last few weeks:
- Made it so we can work properly with larger maps, move the camera and zoom like you would expect, cull out of bounds sprites and entities, etc
- Started to experiment with line of sight and fog of war for funsies (still very early days)
Day 056-070 (2/2):
- Various improvements to the engine (renderer, entities, animations, etc)
- Read a lot on text rendering and Immediate Mode GUI, but decided to push the implementation to later (highly recommend this series:
https://www.rfleury.com/p/ui-series-table-of-contents)
- Did the first week of advent of code but it became a chore really quick
- Started to stream gamedev on Twitch again \o/
Day 071-073:
- Abilities that can push units & fall damage
- More work on line of sight / fog of war
- Load units & abilities from asset files
- Spawn new units as the player discover them in the fog of war
- Quick and very placeholder UI for the turn order haha
Day 074-085:
When implementing the fog of war i noticed my renderer was very slow for some simple tasks, of course it was the first time i played with OpenGL so it was to be expect, i am still learning after all.
I decided to scrap the renderer and started work on a very thin layer on top of sokol_gfx (great lib by the way, highly recommend it!).
There are still some part of the game code to port but it's working great so ;)
Quick demo: https://youtu.be/toQelBElnW8
Day 085-100:
Made a small game over the span of 2 weeks with @tillerqueendev & FlipPixel.
It was a good way to do some dog-fooding on the engine i have been building for a while now. A lot of cool new features to add and bug to squash, so i think this went well :)
The game can be played here:
https://colinbellino.itch.io/the-legend-of-jan-itor
This also concludes the #100daysOfGameDev challenge for me. It was nice to chronicle what i did for a while, i might continue doing it in a more relaxed format.