-
Notifications
You must be signed in to change notification settings - Fork 0
Home
In order to support programmable behavior for a massive number of objects I am creating an opcode based turing engine for organisms (actor objects)
The goal of the opcodes are to enable behavior on a very large scale
- more than tens of thousands of objects on a device on par with
Nvidia Orin Nano
This means that there will be no room for traditional script (parsed) based programming running on CPU core(s)
Instead this must run in parallell on GPU.
Behavior, physics and appearance data
Each organism (sprite) has a number of data structures that define behavior, physics and appearance.
The data for each organism is accessed using load & store operators, via structures that are called builtin
variables.
Opcode design considerations
Arithmetic operators put result in accumulator, precision is determined by the opcode.
All opcodes are same size, probably 32 bits, this is to simplify branches and jumps etc.
Registers
By default registers are VEC4, 16 registers each for INT32, INT16, FLOAT16, FLOAT32
F16_0 - F16_15 - float16
F32_0 - F32_15 - float32
I16_0 - I16_15 - int16
I32_0 - I32_15 - int32
I8_0 - I8_15 - int8
Load & Store operators
These operators load or store values in or from builtin behavior structs.
LD DEST,SOURCE
ST SOURCE,DEST
LD F16_0, POS
- loads the object position into VEC4 float16
ST F16_0, POS
- stores the VEC4 float16 object position
Arithmetic operators
All arithmetic operators have a precision qualifier, this controlls the precision of the calculations.
Implicit conversion shall be avoided.
Builtin
Data structures that provide the organism data.
BODY
MASS - float
DRAG - float
MOVEMENT - vec4
FORCE - vec4
MAX_SPEED - float
TRANSLATION - vec4
ROTATION - vec4 [quaternion]
SCALE - vec4
F16_USERDATA
F32_USERDATA
I16_USERDATA
I32_USERDATA
I8_USERDATA