Skip to content

redchew-fork/FWK

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3D game engine/framework in C.


Goals

  • Rich build system, Royaltie fee, Full featured, Fast, Modern C++.
  • Single-file header, Unlicensed, Small, Naive, Simple C.

Features ᕩ(ᐛ)á•€

  • Pipeline: configurable and integrated asset pipeline.
  • Embedded: single-file header, all dependencies included.
  • Compiler: MSVC, MINGW64, TCC, GCC, clang, clang-cl and emscripten.
  • Linkage: Both static linkage and dynamic .dll/.so/.dylib support.
  • Platform: Windows, Linux and OSX. Partial HTML5/Web support.
  • DS: hash, sort, array/vector, map, set.
  • Math: rand, noise, ease, vec2/3/4, mat33/34/44, quat.
  • Geometry: ray, line, plane, aabb, sphere, capsule, triangle, poly and frustum.
  • Window: windowed, soft/hard fullscreen, msaa, icon, cursor handling.
  • Input: keyboard, mouse and gamepads. input bindings.
  • Script: Lua scripting, Luajit/Python bindings.
  • Network: downloads (HTTPS) and sockets (TCP/UDP).
  • UI: button, list, slider, toggle, checkbox, editbox, dialog, color, image, menu, window, notify...
  • Font: TTF, OTF and TTC. Basic syntax highlighter. Glyph ranges. Atlasing.
  • Localization/I18N: XLSX and INI. Unicode.
  • Image: JPG, PNG, BMP, PSD, PIC, PNM, ICO.
  • Texture: KTX/2, PVR, DDS, ASTC, BASIS, HDR, TGA.
  • Texel: Depth, R, RG, RGB, RGBA, BC1/2/3/4/5/6/7, PVRI/II, ETC1/2, ASTC.
  • Audio: WAV/FLAC, OGG/MP1/MP3, FUR, MOD/XM/S3M/IT, SFXR and MID+SF2/SF3.
  • Video: MP4, MPG, OGV, MKV, WMV and AVI. Also, MP4 recording with MPEG-1 fallback.
  • Model: IQM/E, GLTF/2, GLB, FBX, OBJ, DAE, BLEND, MD3/5, MS3D, SMD, X, 3DS, BVH, DXF, LWO.
  • Render: PBR (metallic-roughness) workflow.
  • Render: Cubemaps, panoramas and spherical harmonics. Rayleigh/Mie scattering.
  • Render: Post-effects (SSAO,FXAA1/3,CRT,Contrast,Grain,Outline,Vignette...).
  • Render: 3D Anims, skeletal anims, hardware skinning and instanced rendering.
  • Render: 3D Debugdraw, batching and vectorial font.
  • Render: 3D Sprites, spritesheets, AA zooming and batching: ASE.
  • Render: 3D Tilemaps and tilesets: TMX, TSX.
  • Social: Steam/Steamworks.
  • Time: Hires timers, tweens, easings, constant-time spline/catmulls.
  • AI: Swarm/Boids, pathfinding, behavior trees (wip).
  • Compression: DEFLATE, LZMA, LZ4, ULZ, BALZ, BCM, CRUSH, LZW3, LZSS and PPP.
  • Virtual filesystem: ZIP, PAK, TAR and DIR.
  • Level data: JSON, JSON5, SJSON, XML, INI.
  • Reflection and serialization: JSON5, INI.
  • Object system.
  • Disk cache.
  • Scene handling.
  • Profiler, stats and leaks finder.
  • Editors (wip): scene, text editor.
  • Documentation (wip).

Roadmap ᕕ(ᐛ)ᕗ (in order of arrival; ✱: partial support)

  • Editor pass.
    • Basic: undo/redo✱, copy/paste, on/off (vis,tick,ddraw,log), vcs.
    • Script pass: DLL✱ (module->plugin/sys), Lua✱, Luajit✱, Teal✱ and TypeScript.
    • Network pass: netbased + offline rendering + virtual input.
  • World pass: Worlds and Object✱/component✱/systems.
    • Spatial partioning. BVH, PVS, occluders, frustum culling✱.
    • World streaming and level loading.
    • Level: volumes, triggers, platforms, level streaming.
  • Sub-editors
    • Sub-editor: Scene tree✱, properties✱ and gizmos✱.
      • Scenenode: node singleton display, node console, node labels, node outlines✱.
      • Debug: toggles on/off (billboards✱, materials, un/lit, cast shadows, wireframe, skybox✱/mie✱, fog/atmosphere, collide✱, physics).
    • Sub-editor: Timeline✱ and data tracks.
    • Sub-editor: Node graphs✱.
    • Sub-editor: Procedural content, brushes, noise and CSG.
    • Sub-editor: Animgraph, blendshapes, additive anims, head/foot/hand IKs. Math: Quat2
  • AI pass: actors, waypoints, behavior trees✱ (h/fsm,goap), and navmesh generation.
  • Network pass.
    • Message pipeline and replication.
    • Digital signals, message buffering and event polling.
    • Server/client architecture. Hybrid P2P.
    • NAT traversal. Socketless API, message API and pub/sub wrappers (enet/websocket).
  • Render pass: reverse-Z, automatic LODs, impostors, decals.
    • Materials: (colors✱, textures✱, matcaps✱, videos✱, shadertoys✱). Shadertoys as post-fx✱.
    • Lighting: Hard/soft shadow mapping (VSM,CCSM). Baked lightmaps. Refl probes. Integrated PBR.
  • Tools pass
    • Extend shaders + bindings. Per-platform✱, per-type✱, per-asset options. GIF, PKM.
    • Extend atlas (sprite/lightmaps). Fit packing (sprites).
    • Extend bindings and messaging: parse C headers during cooking stage.
  • API pass
    • Discuss API and freeze it.
    • Document everything.

Hello FWK

#include "fwk.h" // Minimal C sample
int main() {
    window_create(75.0, 0); // 75% size, no extra flags
    while( window_swap() && !input(KEY_ESC) ) { // game loop
        puts("hello FWK from C!");
    }
}
local fwk = require("fwk") -- Minimal Lua sample
fwk.window_create(75.0,0) -- 75% size, no extra flags
while fwk.window_swap() and fwk.input(fwk.KEY_ESC) == 0 do -- game loop
    print("hello FWK from Lua!")
end

Quickstart

  • Double-click MAKE.bat (Win) or sh MAKE.bat (Linux/OSX) to quick start.
  • MAKE.bat all (Win) or sh MAKE.bat all (Linux/OSX) to build everything.
  • MAKE.bat proj (Win) or sh MAKE.bat proj (Linux/OSX) to generate solutions/makefiles.
  • MAKE.bat help (Win) or sh MAKE.bat help (Linux/OSX) for a bunch of options.
  • MAKE.bat hello.c (Win) or sh MAKE.bat hello.c (Linux/OSX) to build a single executable.
  • Alternatively,
echo win/vc       && cl hello.c
echo win/clang-cl && clang-cl hello.c
echo win/tcc      && tools\tcc hello.c -m64
echo win/mingw    && gcc   hello.c -lws2_32 -lwinmm -ldbghelp -lole32 -luser32 -lgdi32 -lcomdlg32
echo win/clang    && clang hello.c -lws2_32 -lwinmm -ldbghelp -lole32 -luser32 -lgdi32 -lcomdlg32
echo linux        && cc  hello.c -lm -ldl -lpthread -lX11
echo linux/tcc    && tcc hello.c -lm -ldl -lpthread -lX11 -D__STDC_NO_VLA__
echo osx          && cc -ObjC hello.c -framework cocoa -framework iokit -framework coreaudio -framework audiotoolbox

Cook

  • Assets need to be cooked before being consumed in your application. The tools/ folder contains all the related binaries to perform any asset processing plus the cookbook to do so.
  • Your game will cook your assets on demand as long as the tools/ folder is next to your executable. Alternatively, cook them all just by invoking supplied tools/cook standalone binary.
  • In both cases, assets will be cooked and packed into .zipfiles next to your executable, then mounted before entering game loop. These .zipfiles plus your executable are the only required files when releasing your game.
  • Optionally, you could also run MAKE.bat fuse and merge your binaries and their .zipfiles all together. Redist ready.

Extra tips

  • Any ico/png file named after the executable name will be automatically used as app icon.
  • Similar to the ico/png case above, the cooked .zipfiles can be named after the main executable as well.
  • Dropped files into game window will be imported & saved into import/ folder.
  • Update the gamepad controller database by upgrading the gamecontrollerdb.txt file.
  • Depending on your IDE, you might need to browse to engine/split/ sources when debugging FWK.
  • Cook all existing assets on depot, as opposed to cook assets on demand, by using --cook-on-demand=0 flag.
  • Linux/OSX users can optionally install wine and use the Windows tools instead (by using --cook-wine flag).
  • Disable automatic cooking by using --cook-jobs=0 flag (not recommended).
  • Generate a project solution by dropping engine/fwk.h, fwk.c and fwk files into it.
  • Auto-generated Luajit and Python bindings can be found in the engine/ folder.
  • Windows Defender may tag as false positives some generated binaries with tcc. Use make tcc static instead.

Bindings

  • Auto-generated LuaJIT and Python bindings can be found in this folder.

Credits

Artwork and demos Butch, David Lam, Dean Evans, Raijin, FMS_Cat, Goblin165cm, Nuulbee, Pixel Frog, Quaternius, Rotting Pixels, Tom Lewandowski, Rye Terrell, Rxi, Tools Aaron Barany, Andreas Mantler, Arseny Kapoulkine, Assimp authors, Bernhard Schelling, FFMPEG authors, Imagination, Krzysztof Gabis, Lee Salzman, Leon Bottou, MartĂ­n Lucas Golini, Mattias Gustavsson, Morgan McGuire, Olivier Lapicque, Konstanty Bialkowski, Polyglot Team, Randy Gaul, Rxi, Adam Harrison, Sean Barrett et al., Sepehr Taghdisian, Tildearrow, Tomas Pettersson, Tor Andersson, Wael El Oraiby, Runtime Andreas Mantler, Barerose, Camilla Löwy, Dave Rand, David Herberth, David Reid, Dominic Szablewski, Dominik MadarĂĄsz, Eduard Suica, Evan Wallace, Gargaj+cce/Peisik, Guilherme Lampert, Guillaume Vareille, Haruhiko Okumura, Igor Pavlov, Ilya Muravyov, Jon Olick, Joonas Pihlajamaa, Juliette Focault, Kristoffer Grönlund, Lee Salzman, Lee Salzman, V.Hrytsenko, D.MadarĂĄsz, Libtomcrypt, Lua authors, Mattias Gustavsson, Mattias Jansson, Micha Mettke, Michael Galetzka, Morten Vassvik, MārtiƆơ MoĆŸeiko, Omar Cornut, vaiorabbit, Peter Schulman, Chris Willcocks, Dmitry Hrabrov, Rabia Alhaffar, Randy Gaul, Rich Geldreich, Ross Williams, Samuli Raivio, Scott Lembcke, Sean Barrett, Sebastian Steinhauer, Stan Melax, Cloud Wu, Stefan Gustavson, Sterling Orsten, Tor Andersson, Werner Stoop, Wolfgang Draxinger,

Unlicense

This software is released into the public domain. Also dual-licensed as 0-BSD or MIT (No Attribution) for those countries where public domain is a concern (sigh). Any contribution to this repository is implicitly subjected to the same release conditions aforementioned.

Links

Still looking for alternatives? amulet, aroma, astera, blendelf, bullordengine, candle, cave, chickpea, corange, cute, dos-like, ejoy2d, exengine, gunslinger, hate, island, juno, l, lgf, limbus, love, lovr, mini3d, mintaro, mio, olive.c, opensource, ouzel, pez, pixie, punity, r96, ricotech, rizz, tigr, yourgamelib

Issues Discord

Packages

No packages published

Languages

  • C 72.3%
  • C++ 25.2%
  • Lua 1.4%
  • HTML 0.9%
  • GLSL 0.1%
  • Shell 0.1%