diff --git a/README.md b/README.md index 8a9f7ce..14a04a2 100644 --- a/README.md +++ b/README.md @@ -93,3 +93,7 @@ A lot of things should be hidden to the player, the player shouldn't know everyt -Henry Petroski ``` +## Threading : + +Each step should have if possible an array of data, that can then be sliced and dispatched to multiple thread that do the same action (ex physique that have a thread for each local coordinate or for each entity and resolve collision later or before). maybe i could also make this work for spliting for each AI it's pathfinding into 2 but maybe not usefull?? + diff --git a/include/core.h b/include/core.h index b53a0eb..00cbfbc 100644 --- a/include/core.h +++ b/include/core.h @@ -12,8 +12,12 @@ #include #include +#include + #include +#include +#include #include #include diff --git a/source/debug.c b/source/debug.c index 20a2e6d..3194162 100644 --- a/source/debug.c +++ b/source/debug.c @@ -1,5 +1,4 @@ #include -#include /* Time Manipulation @@ -45,7 +44,9 @@ void DataInspector() { /* Debug Console + + INFO: may not be needed to thread this as input may only be available in main thread */ -void DebugConsol() { - __thread static char user_input[256];//need to be allocated for thread safety +void DebugConsole() { + char user_input[256]; } diff --git a/source/main.c b/source/main.c index c7941b9..1cbbe39 100644 --- a/source/main.c +++ b/source/main.c @@ -44,20 +44,18 @@ void UpdateInput() { } } +//may be able to dispatch it void GameLoop(const double tick_time) { - static double time = 0; + __thread static double time = 0; time += GetFrameTime(); if (time >= tick_time) { // interaction // simulation - //dispatch all thread then - //wait all thread end time = 0; } } - int main(void) { double tick_time = 0.4; SetTraceLogLevel(LOG_ALL); @@ -66,8 +64,8 @@ int main(void) { SetExitKey(KEY_NULL); while (!WindowShouldClose()) { UpdateInput(); - //DispatchWorker ComputeIntent(); + //DispatchWorker GameLoop(tick_time); //joinWorker Rendering(); diff --git a/source/render.c b/source/render.c index 2e6c01a..4d31cad 100644 --- a/source/render.c +++ b/source/render.c @@ -95,7 +95,7 @@ void LoadPipeline() { rlEnableDepthTest(); rlEnableBackfaceCulling(); TraceLog(LOG_INFO, "Render Pipeline Built"); - SetTargetFPS(240);//may change + SetTargetFPS(120);//may change } void UnloadPipeline() { @@ -127,17 +127,15 @@ void Rendering() { //Light Pass and forward pass; //I should build a shader that take every light in the scene and make a 3D heightmap of lighting then compute it once for all static light allowing to cheat computing everylight //light is computed into a scalar field - BeginShaderMode(ctx.shader.filter); + + //Light Pass + + //Screen Filter Pass + BeginShaderMode(ctx.shader.filter);//may be good to have this disabled for accessibility //DrawTextureRec(); EndShaderMode(); //render ui - //if (ctx.hud_on) { - // UserInterface(); - //} - //if (ctx.debug_on) { - // DebugInterface(); - //} EndDrawing(); } @@ -151,5 +149,5 @@ void LoadAssets() { } void UnloadAssets() { - + }