i am so tired
This commit is contained in:
parent
7ad7b1eea1
commit
83d93f7803
@ -84,9 +84,9 @@ A lot of things should be hidden to the player, the player shouldn't know everyt
|
||||
# Good Idea and ressources:
|
||||
- [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/)
|
||||
- [Motivational Talk About Art and IA](https://www.youtube.com/watch?v=mb3uK-_QkOo)
|
||||
|
||||
|
||||
# Quote i like:
|
||||
# Quote i like or find fun:
|
||||
|
||||
```
|
||||
“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.”
|
||||
|
||||
@ -20,9 +20,11 @@ void BaseDefense() {
|
||||
}
|
||||
|
||||
void BaseAssault() {
|
||||
|
||||
}
|
||||
|
||||
void Diplomacy() {
|
||||
|
||||
}
|
||||
|
||||
void Dungeon() {
|
||||
@ -52,6 +54,9 @@ void Harvesting() {
|
||||
void Gathering() {
|
||||
}
|
||||
|
||||
void World_Exploration() {
|
||||
void World_Exploration() {
|
||||
}
|
||||
|
||||
void SlimeDungeonAdventure() {
|
||||
|
||||
}
|
||||
@ -9,11 +9,9 @@
|
||||
#include <stdio.h>
|
||||
//#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
#include <raylib.h>
|
||||
#include <raymath.h>
|
||||
|
||||
125
include/engine.h
125
include/engine.h
@ -107,11 +107,40 @@ typedef enum {
|
||||
QUEST_COMPLETE,
|
||||
} 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
|
||||
|
||||
#ifndef ENGINE_STRUCT
|
||||
# define ENGINE_STRUCT
|
||||
|
||||
typedef struct {
|
||||
Font fonts[4];//
|
||||
Texture textures;//
|
||||
Model models;//
|
||||
Sound sound;
|
||||
} Assets;
|
||||
|
||||
// Render
|
||||
|
||||
typedef struct {
|
||||
@ -134,50 +163,48 @@ typedef struct {
|
||||
void* window;
|
||||
//RenderTexture rendtex;
|
||||
GBuffer gbuffer;
|
||||
Camera3D camera;
|
||||
Camera3D camera3d;
|
||||
Camera2D camera2d;
|
||||
ShaderRD shader;
|
||||
bool hud_on, debug_on;
|
||||
} RenderCtx;
|
||||
|
||||
// Event
|
||||
|
||||
typedef struct {
|
||||
EVENT_TYPE type;
|
||||
int value;
|
||||
double time;
|
||||
char* info;
|
||||
int initiator;
|
||||
int actors;
|
||||
int actions;
|
||||
} Event;
|
||||
|
||||
//cities
|
||||
//hideout
|
||||
//tiles
|
||||
//level
|
||||
//npc
|
||||
//clan
|
||||
//army
|
||||
//team
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Damage;
|
||||
|
||||
// Storage
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Inventory;
|
||||
|
||||
// Entity
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
} virtualEntity;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
} physicalEntity;
|
||||
|
||||
typedef struct {
|
||||
EVENT_TYPE trigger;
|
||||
EVENT_TYPE trigger;
|
||||
ACTIVITY_STATE required_state;
|
||||
bool (*condition)(virtualEntity e, Event ev);
|
||||
void *(*effect)(virtualEntity e, Event ev);
|
||||
bool (*condition)(int e, Event ev);
|
||||
void *(*effect)(int e, Event ev);
|
||||
} virtualRule;
|
||||
|
||||
typedef struct {
|
||||
EVENT_TYPE trigger;
|
||||
EVENT_TYPE trigger;
|
||||
ACTIVITY_STATE required_state;
|
||||
bool (*condition)(physicalEntity e, Event ev);
|
||||
void *(*effect)(physicalEntity e, Event ev);
|
||||
bool (*condition)(int e, Event ev);
|
||||
void *(*effect)(int e, Event ev);
|
||||
} physicalRule;
|
||||
|
||||
typedef struct {
|
||||
@ -204,13 +231,14 @@ typedef struct {
|
||||
} Limb;
|
||||
|
||||
typedef struct {
|
||||
Limb limbs[10];
|
||||
Limb limbs[10];
|
||||
BodyStats body_stats;
|
||||
MentalStats mental_stats;
|
||||
} Body;
|
||||
|
||||
typedef struct {
|
||||
Body body;
|
||||
BodyStats body_stats;
|
||||
MentalStats mental_stats;
|
||||
int faction;
|
||||
ENTITY_STATE state;//can be multiple flag
|
||||
} Entity;
|
||||
|
||||
@ -218,17 +246,17 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
int number;
|
||||
int description;//ref to item description table
|
||||
int name;//ref to item name table
|
||||
int rarity;
|
||||
int flags;
|
||||
int description;//ref to item description table
|
||||
int name;//ref to item name table
|
||||
int rarity;
|
||||
int flags;
|
||||
int stack;
|
||||
} Item;
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
int capacity;
|
||||
Item *storage;
|
||||
int size;
|
||||
int capacity;
|
||||
Item storage[100];
|
||||
} Inventory;
|
||||
|
||||
// Player
|
||||
@ -236,7 +264,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
char *name;
|
||||
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;
|
||||
|
||||
typedef struct {
|
||||
@ -246,13 +274,13 @@ typedef struct {
|
||||
Entity entity;
|
||||
Identity identity;
|
||||
Skill skills[10];
|
||||
Inventory inventory;
|
||||
} Player;
|
||||
//give more enphasis on the character than the item used (~60% ,~30%)
|
||||
|
||||
// Quest & Task
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
int id;
|
||||
int prerequisite;
|
||||
int objectiv;
|
||||
int status;//unknow, known, accepted, achieved, completed, unavailable
|
||||
@ -262,25 +290,18 @@ typedef struct {
|
||||
|
||||
// Other Struct
|
||||
|
||||
typedef enum {
|
||||
ACTION_FORWARD,
|
||||
ACTION_BACKWARD,
|
||||
ACTION_LEFT,
|
||||
ACTION_RIGHT,
|
||||
} PLAYER_ACTION;
|
||||
|
||||
typedef struct {
|
||||
int key[4];//should be the number of action in PLAYER_ACTION
|
||||
int button;
|
||||
int mbutton;
|
||||
union {
|
||||
int key;
|
||||
int pad;
|
||||
int mouse;
|
||||
} press;
|
||||
Vector2 mouse_pos;
|
||||
Vector2 mouse_delta;
|
||||
//int mouse_pressed[2];
|
||||
} Input;
|
||||
|
||||
|
||||
|
||||
|
||||
# endif
|
||||
|
||||
# ifndef ENGINE_PROTOTYPE
|
||||
@ -289,12 +310,10 @@ typedef struct {
|
||||
//Render
|
||||
void LoadPipeline();
|
||||
void UnloadPipeline();
|
||||
void Rendering();
|
||||
void LoadAssets();
|
||||
void UnloadAssets();
|
||||
|
||||
//UI
|
||||
void UserInterface();
|
||||
void Menu();
|
||||
//void Menu();
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
71
source/client.c
Normal file
71
source/client.c
Normal 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);
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
#include <core.h>
|
||||
|
||||
//QuickSort
|
||||
//RadixSort
|
||||
//DepthSort used for transparancy in the scene
|
||||
@ -10,7 +10,7 @@ int spawn_queue = 0;
|
||||
//lock queue when used
|
||||
|
||||
int EntityUpdate(void) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void EntityManager(void) {
|
||||
@ -23,6 +23,9 @@ void EntityManager(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
void SpawnEntity() {
|
||||
}
|
||||
|
||||
void SpawnVisualEffect() {
|
||||
//spawn a timed entity used for a visuel effect
|
||||
}
|
||||
|
||||
@ -1,17 +1,21 @@
|
||||
#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
|
||||
|
||||
}
|
||||
|
||||
void emit(void) {
|
||||
double currentTime = GetTime();
|
||||
int event_type = 0;
|
||||
char* Information = "tmp";
|
||||
int initiator = 0;
|
||||
int actors = 0;
|
||||
int action = 0;
|
||||
void EventEmit(Event event) {
|
||||
printf("Event Emited");
|
||||
}
|
||||
|
||||
void ConsoleUpdate() {
|
||||
__thread static char *buffer[1024];
|
||||
}
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
#include <engine.h>
|
||||
|
||||
void ItemUsePrimary() {
|
||||
|
||||
}
|
||||
|
||||
void ItemUseSecondary() {
|
||||
|
||||
}
|
||||
|
||||
void ItemEquipe() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
#include <core.h>
|
||||
#include <engine.h>
|
||||
|
||||
// Frame Allocator
|
||||
|
||||
@ -41,3 +41,21 @@ void DeleteFrameAllocator() {
|
||||
// Ressource Allocator (PreComputed);
|
||||
|
||||
// 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
|
||||
@ -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
|
||||
or can be choosen using arrow keys (easier controller support)
|
||||
*/
|
||||
|
||||
void PlayerController2D() {
|
||||
|
||||
}
|
||||
|
||||
void PlayerController3D() {
|
||||
|
||||
}
|
||||
|
||||
void PlayerInventory() {
|
||||
|
||||
}
|
||||
|
||||
void PlayerUpdate() {
|
||||
|
||||
}
|
||||
|
||||
9
source/quest.c
Normal file
9
source/quest.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include <engine.h>
|
||||
|
||||
void QuestFinish() {
|
||||
|
||||
}
|
||||
|
||||
void QuestSuccess() {
|
||||
|
||||
}
|
||||
@ -71,7 +71,7 @@ void LoadPipeline() {
|
||||
|
||||
rlEnableFramebuffer(ctx.gbuffer.framebufferId);
|
||||
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);
|
||||
// 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);
|
||||
@ -109,14 +109,61 @@ void UnloadPipeline() {
|
||||
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();
|
||||
ClearBackground(BLACK);
|
||||
rlEnableDepthMask();
|
||||
rlEnableFramebuffer(ctx.gbuffer.framebufferId);
|
||||
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;
|
||||
EndMode3D();
|
||||
rlDisableShader();
|
||||
@ -138,16 +185,3 @@ void Rendering() {
|
||||
//render ui
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
void LoadAssets() {
|
||||
//Font
|
||||
//Textures
|
||||
//Models
|
||||
//Sound
|
||||
//Data
|
||||
TraceLog(LOG_INFO, "Assets Loaded");
|
||||
}
|
||||
|
||||
void UnloadAssets() {
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#include <engine.h>
|
||||
#include <extern/toml.h>
|
||||
|
||||
|
||||
//load setting.toml to memory
|
||||
void SettingLoad(const char *name) {
|
||||
FILE *file;
|
||||
@ -21,7 +20,6 @@ void SettingUpdate() {
|
||||
SettingSave("setting.toml");
|
||||
}
|
||||
|
||||
|
||||
void CharacterLoad(const char *name) {
|
||||
FILE *file;
|
||||
file = fopen(name, "wb");
|
||||
|
||||
14
source/world.c
Normal file
14
source/world.c
Normal 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() {
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user