techkaczynski.dev / code

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xccproc.sh15
-rwxr-xr-xcompile.sh9
-rw-r--r--fgsf_spec.txt134
3 files changed, 158 insertions, 0 deletions
diff --git a/ccproc.sh b/ccproc.sh
new file mode 100755
index 0000000..05c66dd
--- /dev/null
+++ b/ccproc.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if cproc \
+ -D__FLT_MIN__=1.17549435e-38F \
+ -D__FLT_MAX__=3.40282347e+38F \
+ -D__DBL_MIN__=2.2250738585072014e-308 \
+ -D__DBL_MAX__=1.7976931348623157e+308 \
+ -D__FLT_EPSILON__=1.19209289550781250000e-7F \
+ *.c ext/*.c ext/tinyfiledialogs/tinyfiledialogs.c \
+ -L/usr/local/lib64 \
+ -fno-builtin \
+ -lraylib -lbox3d -lgcc -lm -lpthread -lX11 -lrt -g -o fungame_cproc
+then ./fungame_cproc
+else echo "build failed."
+fi
diff --git a/compile.sh b/compile.sh
new file mode 100755
index 0000000..c98170a
--- /dev/null
+++ b/compile.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if cc *.c ext/*.c ext/tinyfiledialogs/tinyfiledialogs.c \
+ -lraylib -lbox3d -lm -lpthread -lX11 -lrt \
+ -g3 -O0 \
+ -o fungame
+then ./fungame
+else echo "build failed."
+fi
diff --git a/fgsf_spec.txt b/fgsf_spec.txt
new file mode 100644
index 0000000..ce302ce
--- /dev/null
+++ b/fgsf_spec.txt
@@ -0,0 +1,134 @@
+FUN GAME SAVE FILE FORMAT VERSION 0.1
+ - little endian
+ - 32-bit IEEE-754 floats
+ - UTF-8 strings which are *not* null terminated
+ - units are metric and 1 unit is 1 meter
+ - quaternions are xyzw and need normalization
+ - pids start at 1 and are monotonic, 0 is reserved for null parent
+
+CHUNK LABELS
+ - ENTT
+ - TRFM
+ - MODL
+ - PHYS
+
+DATA RECORDS
+ - entity record
+ - transform component record
+ - model component record
+ - physics component record
+ - physics body record
+ - physics shape record
+ - box
+ - sphere
+ - cylinder
+ - capsule
+ - convex hull
+ - static trimesh
+ - physics joint record
+
+FILE HEADER
+ char[4] magic "FGSF"
+ u16 major
+ u16 minor
+
+CHUNK
+ char[4] label
+ u32 size
+ u8[size] data
+
+ENTT
+ u64 next_pid
+ u32 entity_cnt
+
+ repeat entity_cnt:
+ u64 pid
+ u32 name_len
+ char[name_len] name
+
+TRFM
+ u32 transform_cnt
+
+ repeat transform_cnt:
+ u64 pid
+ u64 parent_pid
+ f32[3] pos
+ f32[4] rot
+ f32[3] scale
+
+MODL
+ u32 model_cnt
+
+ repeat model_cnt:
+ u64 entity_pid
+ u32 key_len
+ char[key_len] key
+ bool(u8) draw
+
+PHYS
+ u32 physics_cnt
+
+ repeat physics_cnt:
+ u64 pid
+ u32 body_cnt
+ body[body_cnt]
+ u32 joint_cnt
+ joint[joint_cnt]
+
+PHYSICS BODY
+ f32[3] pos
+ f32[4] rot
+ f32 linear_damping
+ f32 angular_damping
+ f32 gravity_scale
+ u8 physics_mode
+ bool(u8) enable_sleep
+ u32 shape_cnt
+ shape[shape_cnt]
+
+PHYSICS SHAPE
+ u8 tag
+ f32[3] pos
+ f32[4] rot
+ f32 density
+ f32 friction
+ f32 restitution
+ u32 category_bits
+ u32 mask_bits
+
+ switch tag:
+ BOX
+ f32[3] sz
+
+ SPHERE
+ f32 radius
+
+ CYLINDER or CAPSULE
+ f32 height
+ f32 radius
+
+ CONVEX HULL
+ u32 points_cnt
+ f32[points_cnt][3] points
+
+ TRIMESH
+ u32 point_cnt
+ u32 index_cnt
+ f32[point_cnt][3] points
+ u32[index_cnt] indices
+
+PHYSICS JOINT
+ u8 tag
+ u32 body_a
+ u32 body_b
+ u32 flags
+ f32[3] anchor_a
+ f32[3] anchor_b
+ f32[3] axis_a
+ f32[3] axis_b
+ f32 lower
+ f32 upper
+ f32 spring_hz
+ f32 spring_damping
+ f32 motor_speed
+ f32 motor_force