April 12, 2020
In the previous journal entry I experimented with the hitpoints display above characters' heads using a 3D heart mesh.
It looked wonky and didn't feel intuitive - so at the start of this week I moved to a more traditional health bar.
Scrapped the health bar experiments from the last journal entry and went with a more traditional health bar.
I got that done on Monday, and from there my goal was to get both water and shadow mapping working in the engine.
I spent a couple of days re-jigging the data structure that describes what needs to be rendered to have the notion of multiple render targets.
In the case of WebGL, these render targets map to different framebuffers. The
WebGlRenderer iterates through these
RenderTargetJob one by one and renders them.
For the water I needed to add two framebuffers, one for the reflection and one for the refraction.
I didn't end up working on shadow mapping this week - but when I do it will be built on top of this ability to render to multiple targets. So hopefully that turns into a one to two day's effort for tests and implementation.
By Thursday I had my water tests passing and was ready to move towards rendering water in game.
When adding a new rendering capability to the engine I'll start by a writing test case.
It took until Sunday to get everything working in the
RenderSystem. If the testing quality of the rest of the codebase is a B+, the RenderSystem is at a C-.
This was on full exhibit throughout the weekend as I would spend two hours figuring out an issue that would've been caught had the system been better tested.
I did some clean up during this past week and we'll continue to improve the testing in the
RenderSystem over time.
Rendering water in the game. I'm not entirely happy with the look right now so I'll have to come back to it at some point.
I started thinking about how to quickly add terrain and scenery to the world.
As part of thinking through different approaches I experimented with designing multi-textured terrain in Blender that I could then export to a blendmap PNG file to be used in the game.
Got a blendmap in Blender's node editor working the same way that they work in my engine.
Cleaned things up using Blender's node groups.
I ultimately scrapped this approach. As it felt a bit laggy when I started to deal with 250k vertices in Blender.
One guiding principle for future tooling is that, to the degree possible, editing the games look should happen inside the real game engine.
An example of this would be the world editor. This should involve firing up the game and switching to a world editing mode.
The idea is that spending more time in the game leads to tooling and visual improvements that help the game - instead of investing into improving other tools.
Within reason though - modeling will always happen in Blender because it would take years to write a comparable modeling solution.
I think the way to bridge the gap could be hot reloading. If I can edit a heightmap in Photoshop and have it update the terrain in the game in real time I get most of the benefits of being able to edit it in the engine without needing to implement that just yet.
I'm going to give this some more thought - but it seems like a potential direction forwards for the terrain.
- While refactoring some parts of the
RenderSystemas I added the notion of multiple render targets, I noticed that my refactoring skills have improved since the big client side refactor from the top of this year. I had better intuition around when to delete something and work through the list of 30 compiler errors vs. when to incrementally get the new approach working before deleting the old one. The end result is the same, but managing the mental burden that comes with refactoring multiple parts of a system is a skill that I'll need to continue to hone over time.
This past week was focused on things that you can see. I'd like to focus this week on things that you can do / interact with.
I'm going to give some thought to the world editor to get a sense of where I'd like to go directionally.
If there are any quick steps that I can take - I'll take them. But this will be a longer term iterative effort.
I'll be doing more work on the Hand to Hand skill. Things like adding in some animations, adding in a skills tab to view your experience, and generally experimenting with the feel of combat in order to land on something that feels fun.
I'd like to properly heightmap the terrain and add a few textures to blend onto the terrain, but that might have to wait until next week.
Cya next time!