Skip to content

phil-stein/mooh_engine

Repository files navigation

-- mooh --

engine, game and level-editor for a simple 3d farming / exploration game.
written in c

still under development | unstable

using: glfw3, glad, stb_image & stb_ds, nuklear, thread.h
and my own: math-library, global-defines, serialization-library, physics-engine

main resources:

current capabilities

logo

-- todo --

next steps

-> X important
-> WIP work in progress

buggs

  • glfw mouse button & scroll callbacks
    • works in nuklear, look at that
    • actually nuklear is stealing our callback from glfw
  • obj sizes are different than in blender
    • there is a apply transform option but its experimental
  • [?] some shader sometimes buggs, my have been caused by the point below, weird matrices and such
  • terrain-chunks dont get culled properly
  • minimizing window to sys tray causes framebuffer crash also mentioned here
  • freeing cubemap doesnt seem to actually free any memory
  • changing WINDOW_MIN, _MAX, _FULL doesnt work
  • changing THREAD_MAX in threadm.c doesnt affect its speed also mentioned
  • mesh loading blender coord sys to mine, gizmo is fcked also mentioned
  • getting entity_t to 256bytes makes physics no longer work
    • le what mate
  • if sizeof(entity_t) > 255 physics break
  • vs19 project no longer works
  • glfw uses qwerty, no matter the actual keyboard locale, i.e. qwertz in my case
    • i remapped z to y as a hotfix
    • maybe make key_locale array that mapps qwertz, etc. to qwerty

optimizations

  • multithreading
  • use textures with r = roughness, g = metallic, ...
  • change the white tex for no normal
  • occlusion culling
  • batch renderer WIP
    • keep track of draw calls
    • keep track of all template ents
    • mark static, in template / editor ?
    • instanced draw all static templates
  • lod system ?
  • octree or something for chunks, for entities / phys_objs
  • custom asset formats
    • cubemaps
  • custom asset archive files | not in use
    • all textures, etc. back to back in one file with a simple header
    • type specific or agnostic ?
      • i.e. just serialize a bunch of buffers or have mesh/texture
    • screws with multithreading, kind of, also very big files
    • maybe just a couple at a time ?
    • textures | not in use
    • meshes
    • shaders
  • only clear outline buffer when deselecting
  • memory allocation optimization
    • read game engine architecture page 427-
    • stack allocator ?
    • frame allocator ?
    • pool allocator ?
    • chunk allocator ?
    • randy memory pool ?
  • figure out why core_data_init() is taking so long: shaders
    • shader spir-v ?
  • undo/redo -> john jackman or some on yt pixeleditor
  • [text batch rendering](#in-game ui - mui)
  • [mui batch rendering](#in-game ui - mui)
  • m_lerp(), vec3_lerp() arent working correct see program.c

sus amogus

  • when parenting broke and i fixed it by setting 'is_moved' in 'state_update_global_model()' it worked before and something changed in the code that made it no longer work that way what exactly changed ???
  • ENTITY_SET_POS() doesnt work properly in program_sync_physics(), need to set velocity to 0
  • zip archive not faster than straight files

organization

  • release system
    • package assets & exe
      • obv, just the custom / needed assets
      • archive if done yet
    • set asset_path to cwd/assets
    • maybe check if folder build_01 exist and name build_02, etc.
    • put date in folder / exe name or .txt file or some
  • seperate save_sys.c into terrain & entities
  • program_app_default_logic() -> cant do debug stuff in game
    • setting defines in makefile gives error
  • implement glfw opengl debug context, learnopengl page 439 ?
  • check shaders via reference compiler, page 444, debug_opengl.h
  • framebuffer debug, page 444, debug_opengl.h
  • add missing P_TYPE() funcs to global.h
  • add icons to exe
    • texture_view
    • editor
  • make global submodule again, check if phys, serialization are still submodules
  • remove pos maybe also cast_shadow, etc. from dir light
  • add tracing
    • either figure out a way to decode function pointer to names in app, print on ERR()
    • or do it in a file like the tutorial
  • add profiling, tutorial
  • make most funcs dbg error checked ? (tracing would make this redundant)
    • use dbg funcs for materials in assetm ?
    • make dbg check a macro to set easy and compile out ?
      • when compiled out file & line cause errors
      • are file & line impacting performance ?
    • state
    • etc.
  • go through all files check for unecessary header includes, to remove clutter
  • make functions with entity->id as arg have entity_t* version also, i.e. state_entity_remove(entity_t* e)
    • state_entity_remove(entity_t* e); INLINE state_entity_remove_id(int id) { state_entity_get(id); remove }
  • finish math_test.h WIP
  • make state.c world_arr & world_arr_len available in core_data as pointer
  • move structure save/load from save_sys.c to editor_save.c ?
  • track memory allcations through MALLOC(), FREE(), etc. and stb_ds.h

tools

  • binary dump
    • empty scene
    • empty terrain
  • "model-viewer/-editor" for shaders / materials / anim / particles
  • tracing / profiling ?

base

  • asset manager
    • free assets
    • load shaders from zip ?
    • load cubemaps from zip ?
    • handle missing assets
  • hot-reload shaders
  • make seperate editor map file so f.e. structures can be stored special and edited all at once ?
  • setup 32bit (-m32) : tdm docs
    • reset all dynamic objects ?
      • this way we don't have to reload the entire thing
      • not sure if needed in final game though
      • requires restructuring probably
      • reload suprisingly fast
    • game saves system
      • single map file, never changed
      • multiple variants of that with changes
        • i.e. 'save01.scene', 'mygame.scene', etc.
  • billboards
  • particle system
    • cpu / gpu side or mix ?
    • pooling
    • billboards
    • different spawn "shapes"
      • circle
      • cone
      • sphere
      • cylinder ?
    • animated textures
    • integrate trail renderer
  • trail renderer
  • debug tools
    • make debug_draw_circle() func use mat4 and vec3 instead of pythag WIP
      • precompute x, y, z circles for axis aligned, like sphere collider
    • add profiler also mentioned
  • controller support ?
  • keep_transform when parenting / un-parenting
  • multiple meshes per entity WIP

renderer

  • blending
    • learnopengl weighted blending 'OIT'
    • [[file:C:/Users/phili/Documents/#04_LearnOpenGL/#guest_01_OIT/learnopengl-com-Guest-Articles-2020-OIT-Introduction.pdf|introduction]]
    • [[file:C:/Users/phili/Documents/#04_LearnOpenGL/#guest_01_OIT/learnopengl-com-Guest-Articles-2020-OIT-Weighted-Blended.pdf|tutorial]]
  • cascaded shadows
    • from cherno video
    • also on learnopengl
  • ssao
  • bloom
  • custom anti aliasing, i.e. fxaa
    • try built in again
      • dont work, white around objs
  • water

entity system

level editor

  • pause mid game
  • generate struct literal for
    • materials
    • entities
    • shaders
  • particle system editor
    • seperate ?
  • make gui less shit
  • ask to save if unsaved changes
    • use operation.c
  • seperate windows into their own .c files
  • undo WIP
    • keep track of changes
  • redo
  • deselect on play, reselect after
    • save custom editor info to file

physics engine

  • sphere
    • proper debug draw for sphere
  • aabb
    • parented aabb's dont change pos correct
    • change aabb in editor
  • plane
  • obb (replace aabb, or use aabb as optimization)
  • fix buoancy in resolution, actually in phys_debug_draw() ?
  • sweeping collision
  • organize in grid, octree, etc ?
    • only checking collisions in the same/neighbouring grids
    • dorment objs if camera to far away
  • cylinder / capsule
  • raycasts ?
    • octree & ray v. triangle ?

multithreading

  • maybe make abstraction for thread stuff ?
  • add profiler first
  • architecture
    • main (input, gameplay, etc.)
    • worker (asset-loading, terrain, etc.)
    • renderer
    • physics
  • asset loading
    • textures
      • changing THREAD_MAX in threadm.c doesnt affect its speed also mentioned
      • experiment with thread count
      • load textures with pbo's, is supposed to be faster WIP
      • multithreaded when not loading arr
    • meshes
    • shaders
    • scene ?
    • terrain
  • physics
  • rendering ?
    • decouple entities from main-thread
    • duplicate world, etc. -> merge
  • terrain

audio system

  • using miniaudio, soloud, sokol, etc.
  • clips
  • loops
  • sfx ?
  • system
    • queue bg music, ambient, etc.

animation system

  • learnopengl.com
  • system
  • blending animations

artstyle look-dev

  • draw sketch of scene
    • the base: old wooden house, trees, rusty equipment, overgrown
  • make 3d polished scene
    • stones
      • small
      • middle
      • big
    • trees
      • normal
      • big (fucked normals)
    • bush
    • fence
    • old hut

terrain generation

  • normals & tangents on edges
    • button in gui to calc for all chunks

in-game ui - mui

  • text (already wrote lib)
  • mui_text_f(0.5f, 0.75f) funcs
  • hook rendering into core
  • draw quads
    • scale with screen
    • textured quads
  • aligned group hierarchy
    • row / column
    • centered
    • left / right
    • up / down
  • batch rendering

game design

  • game design doc
  • ...