i am so tired

This commit is contained in:
Emilia(SleepeeSoftware) 2026-02-09 15:41:12 +01:00
parent 7ad7b1eea1
commit 83d93f7803
18 changed files with 288 additions and 162 deletions

View File

@ -84,9 +84,9 @@ A lot of things should be hidden to the player, the player shouldn't know everyt
# Good Idea and ressources: # Good Idea and ressources:
- [RPG Myths by Timothy Cain](https://www.youtube.com/watch?v=x-438XTmFBE) - [RPG Myths by Timothy Cain](https://www.youtube.com/watch?v=x-438XTmFBE)
- [paper by Eric Chan Mit](https://people.csail.mit.edu/ericchan/papers/) - [paper by Eric Chan Mit](https://people.csail.mit.edu/ericchan/papers/)
- [Motivational Talk About Art and IA](https://www.youtube.com/watch?v=mb3uK-_QkOo)
# Quote i like or find fun:
# Quote i like:
``` ```
“The most amazing achievement of the computer software industry is its continuing cancellation of the steady and staggering gains made by the computer hardware industry.” “The most amazing achievement of the computer software industry is its continuing cancellation of the steady and staggering gains made by the computer hardware industry.”

View File

@ -20,9 +20,11 @@ void BaseDefense() {
} }
void BaseAssault() { void BaseAssault() {
} }
void Diplomacy() { void Diplomacy() {
} }
void Dungeon() { void Dungeon() {
@ -52,6 +54,9 @@ void Harvesting() {
void Gathering() { void Gathering() {
} }
void World_Exploration() { void World_Exploration() {
} }
void SlimeDungeonAdventure() {
}

View File

@ -9,11 +9,9 @@
#include <stdio.h> #include <stdio.h>
//#include <stdarg.h> //#include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <pthread.h>
#include <complex.h> #include <complex.h>
#include <math.h> #include <math.h>
#include <pthread.h>
#include <raylib.h> #include <raylib.h>
#include <raymath.h> #include <raymath.h>

View File

@ -107,11 +107,40 @@ typedef enum {
QUEST_COMPLETE, QUEST_COMPLETE,
} QUEST_STATE; } QUEST_STATE;
typedef enum {
ACTION_FORWARD,
ACTION_BACKWARD,
ACTION_LEFT,
ACTION_RIGHT,
ACTION_PRIMARY,
ACTION_SECONDARY,
ACTION_USE,
ACTION_GRAB,
ACTION_JUMP,
ACTION_DASH,
ACTION_SKILL1,
ACTION_TOOLBAR1,
} PLAYER_ACTION;
typedef enum {
DENDRITIC_VOLTAGE,
LAZENBYCOMP_LIQUID,
LAZENBYCOMP_SMOOTH,
POTRA,
} FONTS_ENUM;
# endif # endif
#ifndef ENGINE_STRUCT #ifndef ENGINE_STRUCT
# define ENGINE_STRUCT # define ENGINE_STRUCT
typedef struct {
Font fonts[4];//
Texture textures;//
Model models;//
Sound sound;
} Assets;
// Render // Render
typedef struct { typedef struct {
@ -134,50 +163,48 @@ typedef struct {
void* window; void* window;
//RenderTexture rendtex; //RenderTexture rendtex;
GBuffer gbuffer; GBuffer gbuffer;
Camera3D camera; Camera3D camera3d;
Camera2D camera2d;
ShaderRD shader; ShaderRD shader;
bool hud_on, debug_on; bool hud_on, debug_on;
} RenderCtx; } RenderCtx;
// Event // Event
typedef struct { typedef struct {
EVENT_TYPE type; EVENT_TYPE type;
int value; int value;
double time;
char* info;
int initiator;
int actors;
int actions;
} Event; } Event;
//cities
//hideout
//tiles
//level
//npc
//clan
//army
//team
typedef struct { typedef struct {
} Damage; } Damage;
// Storage
typedef struct { typedef struct {
EVENT_TYPE trigger;
} Inventory;
// Entity
typedef struct {
int id;
} virtualEntity;
typedef struct {
int id;
} physicalEntity;
typedef struct {
EVENT_TYPE trigger;
ACTIVITY_STATE required_state; ACTIVITY_STATE required_state;
bool (*condition)(virtualEntity e, Event ev); bool (*condition)(int e, Event ev);
void *(*effect)(virtualEntity e, Event ev); void *(*effect)(int e, Event ev);
} virtualRule; } virtualRule;
typedef struct { typedef struct {
EVENT_TYPE trigger; EVENT_TYPE trigger;
ACTIVITY_STATE required_state; ACTIVITY_STATE required_state;
bool (*condition)(physicalEntity e, Event ev); bool (*condition)(int e, Event ev);
void *(*effect)(physicalEntity e, Event ev); void *(*effect)(int e, Event ev);
} physicalRule; } physicalRule;
typedef struct { typedef struct {
@ -204,13 +231,14 @@ typedef struct {
} Limb; } Limb;
typedef struct { typedef struct {
Limb limbs[10]; Limb limbs[10];
BodyStats body_stats;
MentalStats mental_stats;
} Body; } Body;
typedef struct { typedef struct {
Body body; Body body;
BodyStats body_stats; int faction;
MentalStats mental_stats;
ENTITY_STATE state;//can be multiple flag ENTITY_STATE state;//can be multiple flag
} Entity; } Entity;
@ -218,17 +246,17 @@ typedef struct {
typedef struct { typedef struct {
int number; int number;
int description;//ref to item description table int description;//ref to item description table
int name;//ref to item name table int name;//ref to item name table
int rarity; int rarity;
int flags; int flags;
int stack; int stack;
} Item; } Item;
typedef struct { typedef struct {
int size; int size;
int capacity; int capacity;
Item *storage; Item storage[100];
} Inventory; } Inventory;
// Player // Player
@ -236,7 +264,7 @@ typedef struct {
typedef struct { typedef struct {
char *name; char *name;
char *gender; char *gender;
char *nickname;//can be changed, what npc refers to, also npc do not know you until you interact with them char *nickname;//can be changed, what npc refers to when talking to you, also npc do not know you until you interact with them
} Identity; } Identity;
typedef struct { typedef struct {
@ -246,13 +274,13 @@ typedef struct {
Entity entity; Entity entity;
Identity identity; Identity identity;
Skill skills[10]; Skill skills[10];
Inventory inventory;
} Player; } Player;
//give more enphasis on the character than the item used (~60% ,~30%) //give more enphasis on the character than the item used (~60% ,~30%)
// Quest & Task // Quest & Task
typedef struct { typedef struct {
int id; int id;
int prerequisite; int prerequisite;
int objectiv; int objectiv;
int status;//unknow, known, accepted, achieved, completed, unavailable int status;//unknow, known, accepted, achieved, completed, unavailable
@ -262,25 +290,18 @@ typedef struct {
// Other Struct // Other Struct
typedef enum {
ACTION_FORWARD,
ACTION_BACKWARD,
ACTION_LEFT,
ACTION_RIGHT,
} PLAYER_ACTION;
typedef struct { typedef struct {
int key[4];//should be the number of action in PLAYER_ACTION int key[4];//should be the number of action in PLAYER_ACTION
int button; union {
int mbutton; int key;
int pad;
int mouse;
} press;
Vector2 mouse_pos; Vector2 mouse_pos;
Vector2 mouse_delta; Vector2 mouse_delta;
//int mouse_pressed[2]; //int mouse_pressed[2];
} Input; } Input;
# endif # endif
# ifndef ENGINE_PROTOTYPE # ifndef ENGINE_PROTOTYPE
@ -289,12 +310,10 @@ typedef struct {
//Render //Render
void LoadPipeline(); void LoadPipeline();
void UnloadPipeline(); void UnloadPipeline();
void Rendering();
void LoadAssets();
void UnloadAssets();
//UI //UI
void UserInterface(); void UserInterface();
void Menu(); //void Menu();
# endif # endif

71
source/client.c Normal file
View File

@ -0,0 +1,71 @@
#include <engine.h>
Assets* LoadAssets() {
Assets *asset = (Assets *)calloc(sizeof(Assets), 1);
assert(asset);
//Font
asset->fonts[DENDRITIC_VOLTAGE] = LoadFont("assets/font/Dendritic_Voltage.ttf");
asset->fonts[LAZENBYCOMP_LIQUID] = LoadFont("assets/font/LazenbyCompLiquid.ttf");
asset->fonts[LAZENBYCOMP_SMOOTH] = LoadFont("assets/font/LazenbyCompSmooth.ttf");
asset->fonts[POTRA] = LoadFont("assets/font/Potra.ttf");
//Textures
//Models
//Sound
//Data
TraceLog(LOG_INFO, "Assets Loaded");
return (asset);
}
void UnloadAssets(Assets *asset) {
UnloadFont(asset->fonts[DENDRITIC_VOLTAGE]);
UnloadFont(asset->fonts[LAZENBYCOMP_LIQUID]);
UnloadFont(asset->fonts[LAZENBYCOMP_SMOOTH]);
UnloadFont(asset->fonts[POTRA]);
free(asset);
}
void UpdateInput() {
const Input input;
int key = GetKeyPressed();
Vector2 mouse_pos = GetMousePosition();
Vector2 mouse_delta = GetMouseDelta();
while (key) {
for (PLAYER_ACTION action = 0; action < 4; action++) {
if (input.key[action] == key) {
//emit("player_intent", action);
break;
}
}
key = GetKeyPressed();
}
}
//may be able to dispatch it
void GameLoop(const double tick_time) {
__thread static double time = 0;
time += GetFrameTime();
if (time >= tick_time) {
// interaction
// simulation
time = 0;
}
}
int main(void) {
double tick_time = 0.4;
SetTraceLogLevel(LOG_ALL);
LoadPipeline();
Assets *assets = LoadAssets();
SetExitKey(KEY_NULL);
while (!WindowShouldClose()) {
UpdateInput();
ComputeIntent();
GameLoop(tick_time);
Rendering();
}
UnloadAssets(assets);
assets = NULL;//to remember to not use it after
UnloadPipeline();
return (0);
}

View File

@ -1,21 +0,0 @@
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <math.h>
//List
//DAG
//BinaryTree
//QuadTree
//OcTree
//K-Tree
//HashMap

View File

@ -1,5 +0,0 @@
#include <core.h>
//QuickSort
//RadixSort
//DepthSort used for transparancy in the scene

View File

@ -10,7 +10,7 @@ int spawn_queue = 0;
//lock queue when used //lock queue when used
int EntityUpdate(void) { int EntityUpdate(void) {
} }
void EntityManager(void) { void EntityManager(void) {
@ -23,6 +23,9 @@ void EntityManager(void) {
return; return;
} }
void SpawnEntity() {
}
void SpawnVisualEffect() { void SpawnVisualEffect() {
//spawn a timed entity used for a visuel effect //spawn a timed entity used for a visuel effect
} }

View File

@ -1,17 +1,21 @@
#include <engine.h> #include <engine.h>
//should have a event structure, and a system can subscribe to an event, then whenever the event is triggered by a system, subscriber system should receive a signal.
void create(void) { static Event *queue;
void EventCreate(void) {
queue = calloc(100, sizeof(Event));
} }
void subscribe(void) { void EventSubscribe(int event_type, void (*callback)(int)) {
//this should return an handle that allow to poll event that happen last frame //this should return an handle that allow to poll event that happen last frame
} }
void emit(void) { void EventEmit(Event event) {
double currentTime = GetTime(); printf("Event Emited");
int event_type = 0; }
char* Information = "tmp";
int initiator = 0; void ConsoleUpdate() {
int actors = 0; __thread static char *buffer[1024];
int action = 0;
} }

View File

@ -1,3 +1,14 @@
#include <engine.h> #include <engine.h>
void ItemUsePrimary() {
}
void ItemUseSecondary() {
}
void ItemEquipe() {
}

View File

@ -1,48 +0,0 @@
#include <engine.h>
void UpdateInput() {
const Input input;
int key = GetKeyPressed();
Vector2 mouse_pos = GetMousePosition();
Vector2 mouse_delta = GetMouseDelta();
while (key) {
for (PLAYER_ACTION action = 0; action < 4; action++) {
if (input.key[action] == key) {
//emit("player_intent", action)l
break;
}
}
key = GetKeyPressed();
}
}
//may be able to dispatch it
void GameLoop(const double tick_time) {
__thread static double time = 0;
time += GetFrameTime();
if (time >= tick_time) {
// interaction
// simulation
time = 0;
}
}
int main(void) {
double tick_time = 0.4;
SetTraceLogLevel(LOG_ALL);
LoadPipeline();
LoadAssets();
SetExitKey(KEY_NULL);
while (!WindowShouldClose()) {
UpdateInput();
ComputeIntent();
//DispatchWorker
GameLoop(tick_time);
//joinWorker
Rendering();
}
UnloadAssets();
UnloadPipeline();
return (0);
}

View File

@ -1,4 +1,4 @@
#include <core.h> #include <engine.h>
// Frame Allocator // Frame Allocator
@ -41,3 +41,21 @@ void DeleteFrameAllocator() {
// Ressource Allocator (PreComputed); // Ressource Allocator (PreComputed);
// Fast Allocator; when the fram allocator is too short lived // Fast Allocator; when the fram allocator is too short lived
//QuickSort
//RadixSort
//DepthSort used for transparancy in the scene
//List
//DAG
//BinaryTree
//QuadTree
//OcTree
//K-Tree
//HashMap

View File

@ -6,3 +6,19 @@ the item focused have a description and stats windows on the left,
the focused item is either the one under the mouse the focused item is either the one under the mouse
or can be choosen using arrow keys (easier controller support) or can be choosen using arrow keys (easier controller support)
*/ */
void PlayerController2D() {
}
void PlayerController3D() {
}
void PlayerInventory() {
}
void PlayerUpdate() {
}

9
source/quest.c Normal file
View File

@ -0,0 +1,9 @@
#include <engine.h>
void QuestFinish() {
}
void QuestSuccess() {
}

View File

@ -71,7 +71,7 @@ void LoadPipeline() {
rlEnableFramebuffer(ctx.gbuffer.framebufferId); rlEnableFramebuffer(ctx.gbuffer.framebufferId);
ctx.gbuffer.depth_tex_id = rlLoadTextureDepth(ctx.width, ctx.height, false); ctx.gbuffer.depth_tex_id = rlLoadTextureDepth(ctx.width, ctx.height, false);
// If Artefact appear on Normal, may need to change to RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 // If Artefact appear on Normal, may need to change to RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 and also need to be used in case of anti aliasing (MLAA or SMAA if needed)
ctx.gbuffer.normal_tex_id = rlLoadTexture(NULL, ctx.width, ctx.height, RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, 1); ctx.gbuffer.normal_tex_id = rlLoadTexture(NULL, ctx.width, ctx.height, RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, 1);
// The color in RGB, and the specular strength in the alpha channel // The color in RGB, and the specular strength in the alpha channel
ctx.gbuffer.albedoSpec_tex_id = rlLoadTexture(NULL, ctx.width, ctx.height, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1); ctx.gbuffer.albedoSpec_tex_id = rlLoadTexture(NULL, ctx.width, ctx.height, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1);
@ -109,14 +109,61 @@ void UnloadPipeline() {
CloseWindow(); CloseWindow();
} }
//arg should be a voxel asset
void VoxelRender(void) {
void Rendering() { }
void RenderingForward2D() {
BeginDrawing();
BeginMode2D(ctx.camera2d);
EndMode2D();
EndDrawing();
}
void RenderingForward3D() {
BeginDrawing();
BeginMode3D(ctx.camera3d);
EndMode3D();
EndDrawing();
}
void RenderingDeferred2D() {
BeginDrawing(); BeginDrawing();
ClearBackground(BLACK); ClearBackground(BLACK);
rlEnableDepthMask(); rlEnableDepthMask();
rlEnableFramebuffer(ctx.gbuffer.framebufferId); rlEnableFramebuffer(ctx.gbuffer.framebufferId);
rlEnableShader(ctx.shader.gbuffer.id); rlEnableShader(ctx.shader.gbuffer.id);
BeginMode3D(ctx.camera); BeginMode2D(ctx.camera2d);
//MainGeamoetry;
EndMode2D();
rlDisableShader();
rlDisableFramebuffer();
rlDisableDepthMask();//may not be usefull
//rlDisableDepthTest();
//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
//Light Pass
//Screen Filter Pass
BeginShaderMode(ctx.shader.filter);//may be good to have this disabled for accessibility
//DrawTextureRec();
EndShaderMode();
//render ui
EndDrawing();
}
void RenderingDeferred3D() {
BeginDrawing();
ClearBackground(BLACK);
rlEnableDepthMask();
rlEnableFramebuffer(ctx.gbuffer.framebufferId);
rlEnableShader(ctx.shader.gbuffer.id);
BeginMode3D(ctx.camera3d);
//MainGeamoetry; //MainGeamoetry;
EndMode3D(); EndMode3D();
rlDisableShader(); rlDisableShader();
@ -138,16 +185,3 @@ void Rendering() {
//render ui //render ui
EndDrawing(); EndDrawing();
} }
void LoadAssets() {
//Font
//Textures
//Models
//Sound
//Data
TraceLog(LOG_INFO, "Assets Loaded");
}
void UnloadAssets() {
}

View File

@ -1,7 +1,6 @@
#include <engine.h> #include <engine.h>
#include <extern/toml.h> #include <extern/toml.h>
//load setting.toml to memory //load setting.toml to memory
void SettingLoad(const char *name) { void SettingLoad(const char *name) {
FILE *file; FILE *file;
@ -21,7 +20,6 @@ void SettingUpdate() {
SettingSave("setting.toml"); SettingSave("setting.toml");
} }
void CharacterLoad(const char *name) { void CharacterLoad(const char *name) {
FILE *file; FILE *file;
file = fopen(name, "wb"); file = fopen(name, "wb");

14
source/world.c Normal file
View File

@ -0,0 +1,14 @@
#include <engine.h>
//map are layered 2D layer ? or 3D ? maybe simple 3D tiles
uint32_t VoxelPacked() {
return (0);
}
void VoxelUnpack() {
}
void Tile() {
}