• he/him

Coder, pun perpetrator
Grumpiness elemental
Hyperbole abuser


Tools programmer
Writer-wannabe
Did translations once upon a time
I contain multitudes


(TurfsterNTE off Twitter)


Trans rights
Black lives matter


Be excellent to each other


UE4/5 Plugins on Itch
nte.itch.io/

erysdren
@erysdren

Updated my QuakeC Virtual Machine with a fully fleshed out game example, using SDL2 as the rendering and input backend! The game logic is entirely written in QuakeC and interpreted at runtime. It's... A PONG clone.

A screenshot of a PONG clone game.

You can browse the code of QCPONG here:

https://github.com/JaycieErysdren/QCVM/tree/main/examples/qcpong

I also wrote a document on how to use the QCVM API:

https://github.com/JaycieErysdren/QCVM/blob/main/USAGE.md


You must log in to comment.

in reply to @erysdren's post:

currently it uses 5 malloc calls:

  • one for the main QCVM struct
  • one for the raw memory pool of the entire QuakeC module
  • one for the tempstrings buffer (optional)
  • one for the entities buffer (optional)
  • one for the C exports buffer (optional)

by my estimation it allocates about 16 kb of memory across those 5 calls, depending on the size of compiled QuakeC module. it could probably all be folded into one allocated pool, if that's what you mean. for the purpose of optimization, this might be a good idea!

sorry if i misunderstood your question! please follow up if you have further questions :D

No that was exactly it, thanks! I wasn't sure if it relied on dynamic reallocation, but it sounds like you could easily replace those malloc calls with references to a custom allocator if need be* :)

  • Please don't rewrite the memory management on my account, benchmarking QuakeC VMs feels excessive