Skip to content

Instantly share code, notes, and snippets.

View mlarouche's full-sized avatar

Michaël Larouche mlarouche

View GitHub Profile
@mlarouche
mlarouche / SaveGameManagement.md
Last active March 29, 2023 21:15
So you want to handle save games ?

So you want to handle save games ?

Most games once reaced a certain size will need to persist data between game sessions. In our game dev jargon, we call this data a Save Game.

Your first reflex would be to think: oh this is easy, we only need to find the user's documents or data folder and use simple file read and write operations to handle the save data.

Assumming we are using the Zig programming language, our favorite here at Cold Bytes Games, and the library known-folders, a naive save game serialization code could look like this (this code has not been tested).

const known_folders = @import("known-folders");
@mlarouche
mlarouche / d3d11.zig
Created April 14, 2020 20:00
Direct3D sample usage in one of my projects
const DxContext = struct {
device: ?*dx.ID3D11Device = null,
deviceContext: ?*dx.ID3D11DeviceContext = null,
swapChain: ?*dx.IDXGISwapChain = null,
mainRenderTargetView: ?*dx.ID3D11RenderTargetView = null,
};
var dxContext: DxContext = undefined;