working on adding a entity workflow

This commit is contained in:
2026-03-16 13:22:59 -07:00
parent d18e4cea55
commit 76d2e27879
50 changed files with 988 additions and 389 deletions

View File

View File

@@ -0,0 +1,8 @@
#ifndef COLOR_H
#define COLOR_H
typedef struct {
unsigned char r;
unsigned char g;
unsigned char b;
} color;
#endif // !COLOR_H

View File

@@ -0,0 +1,25 @@
#include "engine.h"
int GameInit(AuthUser *auth, User *user){
// init tart
return 0;
}
void GameRun(User* user) {
// game logic
// display render
}
void GameEnd() {
// free objects
}
int GetInput(char* buffer){
return 0;
}
int Render(char* outbuffer) {
return 0;
}

View File

@@ -0,0 +1,25 @@
#ifndef ENGIN_H
#define ENGIN_H
typedef struct {
const char* username;
int userId;
int runs;
int hours;
int currentServerId;
} User;
typedef struct {
char username[256];
char password[256];
} AuthUser;
int GameInit(AuthUser* auth, User* user);
void GameRun(User* user);
void GameEnd();
void SetInput(char* buffer);
int GetInput(char* buffer);
int Render(char* outbuffer);
#endif // !ENGIN_H

View File

@@ -0,0 +1,26 @@
#include "Centery.h"
#include "entity_utils.h"
int CreateCentery(int tear, int classification) {
return 0;
}
int ServerUpdate(void * ent) {
entity* e = (entity*)ent;
centery* cen = (centery*)e->userdata;
if(
return 0;
}
int ClientUpdate(int action, void * centery) {
return 0;
}
int Init(void * ent){
return 0;
}
int Free(void* ent) {
return 0;
}

View File

@@ -0,0 +1,27 @@
#ifndef CENTERY_H
#define CENTERY_H
#include "../entity.h"
typedef struct {
entity* target;
int weapon;
int classification;
int tear;
int alert;
int mode;
int health;
int ac;
int str;
int wis;
int dex;
} centery;
int CreateCentery(int tear, int classification);
int ServerUpdate(void*);
int ClientUpdate(int, void*);
int Init(void*);
int Free(void*);
#endif // !CENTERY_H

View File

View File

@@ -0,0 +1,6 @@
#ifndef CYPHER_H
#define CYPHER_H
#include "../entity.h"
#endif

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

@@ -0,0 +1,52 @@
#ifndef ENTITY_H
#define ENTITY_H
#include "vector.h"
#include "tile.h"
typedef int(*entity_func)(void*);
typedef int(*entity_update_func)(int, void*);
// Entity network transaction.
typedef struct {
int id;
int action;
int userdataSize;
void* userdata;
} entity_transaction;
// Entity Callbacks
typedef struct {
entity_func init;
entity_update_func update;
entity_func free;
} entity_callbacks;
// Entity Struct
typedef struct {
int id;
const char* name;
const char* description;
tile tile;
vec2 position;
void* userdata;
entity_callbacks callback;
entity_transaction ta;
} entity;
entity* CreateEntity(const char* name, const char* description);
int EntityAddCallbacks(entity* e, entity_callbacks cb);
int EntitySetUserdat(entity* e, void* userdata);
// Gets
const char* GetEntityDescription(entity* e);
const char* GetEntityName(entity* e);
// Entity minipulation
int EntityInit(entity* e);
int EntityUpdate(entity* e, int action, void* userdata);
int EntityFree(entity* e);
// Network
int EntityTransaction(entity* e);
#endif

View File

View File

@@ -0,0 +1,29 @@
#ifndef ENTITY_HEADER_H
#define ENTITY_HEADER_H
#define ENTITY_LIST_ACTION_ADD
#define ENTITY_LIST_ACTION_REMOVE
#include "entity.h"
typedef struct {
int count;
entity* entities[256];
} entity_list;
typedef struct {
int action;
int sizeOfData;
void* data;
}entity_list_transaction;
void EntityListInit(entity_list* list);
int EntityListAddEntity(entity* ent);
int EntityListRemoveEntity(entity* ent);
int EntityListTransactionSet(entity_list_transaction* ta, int action, void* data);
int EntityListTransactionSend(entity_list* list, entity_list_transaction* ta);
int EntityListUpdate();
#endif

View File

View File

@@ -0,0 +1,10 @@
#ifndef ENTITY_UTILS_H
#define ENTITY_UTILS_H
#include "entity_handler.h"
#include "vector.h"
int* GetEntitiesAroundPoint(entity_list* list, vec2 position, int radious);
int* GetClosestEntity(entity_list* list, vec2 position);
#endif // !ENTITY_UTILS_H

View File

View File

View File

@@ -0,0 +1,9 @@
#ifndef TILE_H
#define TILE_H
#include "color.h"
typedef struct {
char simble;
color forground;
color background;
} tile;
#endif

View File

@@ -0,0 +1,5 @@
#ifndef TRANSACTION_H
#define TRANSACTION_H
#endif // !TRANSACTION_H

View File

@@ -0,0 +1,12 @@
#ifndef VECTOR_H
#define VECTOR_H
typedef struct {
int x;
int y;
} vec2;
vec2 vec2_add(vec2 a, vec2 b);
vec2 vec2_sub(vec2 a, vec2 b);
vec2 vec2_mul(vec2 a, vec2 b);
vec2 vec2_dev(vec2 a, vec2 b);
#endif