003 - Aug 19, 2018


This past week I was supposed to make some changes to our networking code and get a 3d model rendering.

I also started to notice how much of a positive impact keeping this journal has had on my development process. More on that at the bottom.


Since we've moved away from JavaScript and we're instead using Rust + WebAssembly for our web client we no longer needed to use protocol buffers and we can instead just serialize a client's known world state on the server side and then deserialize it on the client side.

This meant moving away from .proto definitions and instead using serde with bincode for serialization/deserialization of plain old Rust structs / enums.

Most of the Components in our Entity Component System were unfortunately quite a bit coupled to structs that were generated by rust-protobuf, so I needed to do quite a bit of refactoring in order to remove the rust-protobuf dependency.

Refactor ECS

I must have spent around 10 hours fixing compile-time error after compile-time error and there is still some work left.

By Friday 8:30 AM I had made a ton of progress but realized I wouldn't finish in time for this week's dev journal entry if I was going to also get a 3D model rendering.

But also realized I didn't need to finish.. A lot of this backend code gameplay functionality that doesn't matter right now because there is no frontend client to make use of it.

Fortunately we have a solid number of unit / integration tests in place so I'll comment the code back in and get it working little by little over the coming weeks.

For what it's worth I'm very glad that I got pretty far here because while trying to change basically every data structure that the game server uses I went over a few failed iterations before I landed on something that felt like it fit.

If I had switched away from protocol buffers without trying to make changes across the codebase and instead commented everything out immediately I would've landed on one of my earlier terrible data organization / access approaches not realizing that it would become my nightmare in a couple of weeks.

Rendering a Model

Earlier today I got a 3D model rendering in the Rust WebGL game client! You can see for yourself on www.akigi.com!

Rendering something Successful rendering!

WIP Capuchin The blender File

A month or two ago I wrote a Rust + WebAssembly + WebGL demo for rendering blender models, along with an exporter for exporting Blender meshes and armatures - so my work here mainly boiled down to copy pasting from that demo and leveraging my open source exporter.

Lessons learned from keeping a journal so far

Knowing that I need to have this journal entry up for you every Sunday evening has turned my prioritization up to a level I've never known possible.

I'm loving keeping a dev journal and more generally having a weekly deadline for something that people can see / play with. It's forcing me to not be able to spend time digging into technical things that don't matter right now and instead re-focus on gameplay and stuff that players care about.

This is useful for me because I have a tendency to get absorbed in the technical aspects of building a game and by the time I look up I've done more than was needed and still haven't shipped anything.

For example, I didn't optimize the WebAssembly builds or compress them so I'm basically serving a 2Mb non --release wasm module in production right now (that should be much, much, much smaller when I run it through wasm-opt and use a --release build).

I was just racing to get something live. Sure it would've been an extra hour or so tops to make sure that release builds are much tinier, but the amount of opportunities that I've had this week to spend an extra hour on something that wasn't a blocker must be at least a dozen or two.

I think it comes down to when you're working alone easily to justify things in your mind or just brush them over, but when you have to explain it to others (you!) it becomes very clear when you're wasting time. A lot of things that I might've dove into and tried to solve are becoming TODOs and I'm sure that I'm going to get an alpha out more quickly because of it.

Here's me writing a TODO instead of spending 30 minutes doing something that I just don't need to do right now:

TODO Example Leaving a TODO to save that extra 30 minutes of unnecessary exploration.

Actually as I type this I'm realizing I might not even need this.. maybe I can set a header for cloudfront & the browser to take care of this for me. Anyways - a future problem.

Next Week

By next week I'll start sending down real state updates to the client and rendering placeholder meshes at the locations of all of the entities that are in game state. I won't worry about delta encoding state updates for now - that can come when there is an actual game to play...

I'll also add arrow key controls (desktop) and touch controls (mobile / tablet) for making the camera orbit your character.

See ya next time!