Register

Proportion November Update

Zakary Strange
3 years, 10 months ago
Hello everyone, time for the monthly update! So, since last month I have not made much progress as I had HandmadeCon, and when I came back I was sick, but I still did a little bit of work! So throughout the last month I laid the entire windows platform layer, part of the Linux platform layer (because I was really tired of windows shit), and created the Renderer PushCommand system.

The Windows platform layer creates an OpenGL context, processes input from the keyboard, mouse, Xbox and PlayStation 3 & 4 controllers, creates an audio buffer to send to the game layer for mixing, creates a RenderBuffer to send to the game layer, processes render commands sent from the game layer and renders them via OpenGL. With all of these things I will call the Windows platform layer done for the time being.

The Linux platform layer currently just creates a window with an OpenGL context and processes render commands. So audio and input still need to be done before this is a usable platform.

A few cool things I did in the platform layer consist of:
  1. The executable and DLL both building without linking against the CRT
  2. Listening for buffer under runs and buffer overflows
  3. Restoring to a previous dll if the currently running dll crashes
  4. Switching audio output devices if you set a new default output device in the windows mixer
  5. hot-reloadable:
    • game code
    • controllers (so you don't have to restart the game when you plug a controller in, like you have to in most game)
    • shaders
    • textures

No CRT
A few notes on not linking against the CRT, as it might be interesting to some programmers.

To figure out how to just compile without the CRT I followed @mmozeiko's guide. Once I got it compiling I needed a few math functions – Sin, Cos, Exp and Log – so I could get HandmadeMath building without the CRT. As I really didn't feel like writing all of these I found a great piece of code online which had all of these written for me in SSE2 under the ZLIB license! So I took that and modified it, removing all of the stuff I didn't care about, then had HandmadeMath call those functions instead. And everything just worked!

Ah finally, since we are over all of the stuff I have done, time to talk about the stuff I'm working on now. Right now I am writing my own snprintf. As of last night I am parsing the format correctly according to the specification, and am now going through and inserting the data where it is needed. Overall this has been pretty easy so far, but I think that is mainly because I have not handled floating point numbers. However, I am prepared to handle them thanks to this paper which seems to have a nice way of doing it, so I plan on following that paper after I finish handling all of the format arguments that are not floating point.

Next month I will start streaming development on Proportion and hopefully I will have something to show. But that's all for now, folks! See ya in the next blog post!
Mārtiņš Možeiko
3 years, 10 months ago
For a good snprintf replacement I suggest to use c99-snprintf library: https://github.com/weiss/c99-snprintf It is very good. No dependencies on CRT (when you make it to ignore locale stuff). Similarly how good is ssemath library you use to replace trigonometry functions.
Zakary Strange
3 years, 10 months ago
@mmozeiko, good suggestion. Im gonna right my own and if i dont like it ill use that
Log in to comment