Skip to content

Instantly share code, notes, and snippets.

View SanderMertens's full-sized avatar
🐥
Feeding flecs

Sander Mertens SanderMertens

🐥
Feeding flecs
View GitHub Profile
using flecs.script.*
using flecs.components.*
using flecs.game
// "Terraced canyon & lava vein" — stepped mesas + deep cut + glowing lava river
const Resolution: 185
const Scale: 44 / Resolution
const Size: 58
const Height: 2.4
using flecs.components.*
using flecs.script.*
const Size = 100
const Res = 200
const Scale = 10
const P = Size / Res
const M = Size / Scale / P
using flecs.script.*
using flecs.components.*
using flecs.game
const Resolution: 175
const Scale: 40 / Resolution
const Size: 50
const Height: 1.8
const CellW: Size / Resolution
@SanderMertens
SanderMertens / perlin.flecs
Created February 3, 2026 20:04
perlin.flecs
using flecs.script.*
using flecs.components.*
const xMax = 250
const yMax = 500
const xCenter = xMax / 2
const yCenter = yMax / 2
const sand = Rgb: {0.92, 0.86, 0.55}
#include <prefab_storage_tests.h>
#include <stdio.h>
ECS_COMPONENT_DECLARE(Position);
ECS_COMPONENT_DECLARE(Rotation);
ECS_COMPONENT_DECLARE(Velocity);
ECS_COMPONENT_DECLARE(Transform);
ECS_COMPONENT_DECLARE(TransformRef);
ECS_COMPONENT_DECLARE(Parent);
ECS_COMPONENT_DECLARE(Children);
using flecs.script.*
using flecs.components.*
using flecs.game
const Stone = Rgb: {0.4, 0.3, 0.3}
const SideWalk = Rgb: {0.4, 0.4, 0.4}
const Concrete = Rgb: {0.3, 0.3, 0.3}
const Door = Rgb: {0.1, 0.07, 0.04}
const Frame = Rgb: {0.7, 0.7, 0.7}
const Awning = Rgb: {0.06, 0.08, 0.05}
@SanderMertens
SanderMertens / bevy_bench.rs
Last active June 6, 2025 00:06
Bevy benchmark
// Code uses a custom benchmarking solution (vs. criterion) so that the numbers
// are comparable to the Flecs benchmarks in this repository:
// https://github.com/SanderMertens/ecs_benchmark
use bevy_ecs::prelude::*;
// use bevy_hierarchy::*;
use bevy_ecs::world::CommandQueue;
use std::hint::black_box;
use rand;
// Test for importing script from URL
using flecs.components.*
using flecs.game
using assemblies
town :- Town{}
#include <c_app.h>
#include "flecs.h"
#include <stdio.h>
#include <stdlib.h>
#define STARS (1000)
#define PLANETS_MAX (10)
#define P_PLANET_WATER (0.1)
#define P_PLANET_OIL (0.005)
#define P_PLANET_COPPER (0.05)

Clang

8

size_t pretty_type() [T = Position]
size_t pretty_enum() [E = Color, C = Red]
size_t pretty_enum() [E = Color, C = 3]