diff --git a/.idea/misc.xml b/.idea/misc.xml
index 0b76fe5..1f6bab5 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,4 +4,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c06e03..b1726d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,2 +1,12 @@
-cmake_minimum_required(VERSION 4.2)
+cmake_minimum_required(VERSION 4.2.0)
project(lifecrystal C)
+add_executable(main src/main.c
+ src/logic/engineHandler.c
+ src/logic/engineHandler.h
+ src/engines/physicsEngine.c
+ src/engines/graphicsEngine.c
+ src/helper/tickrateHelper.c
+ src/logic/gameLoop.c
+ src/logic/gameLoop.h
+ src/helper/tickrateHelper.h
+)
\ No newline at end of file
diff --git a/src/engines/graphicsEngine.c b/src/engines/graphicsEngine.c
new file mode 100644
index 0000000..64d1e14
--- /dev/null
+++ b/src/engines/graphicsEngine.c
@@ -0,0 +1,3 @@
+//
+// Created by Hannah on 31/01/2026.
+//
\ No newline at end of file
diff --git a/src/engines/physicsEngine.c b/src/engines/physicsEngine.c
new file mode 100644
index 0000000..198653a
--- /dev/null
+++ b/src/engines/physicsEngine.c
@@ -0,0 +1,3 @@
+//
+// Created by Hannah on 31/01/2026.
+//
diff --git a/src/helper/tickrateHelper.c b/src/helper/tickrateHelper.c
new file mode 100644
index 0000000..f89096d
--- /dev/null
+++ b/src/helper/tickrateHelper.c
@@ -0,0 +1,24 @@
+//
+// Created by Hannah on 31/01/2026.
+//
+
+#include
+#include
+#include
+
+int delayTickrate(int ticksPerSecond, long int period) {
+ int requiredNanoseconds = 10e9/ticksPerSecond;
+ struct timeval currentTime;
+ gettimeofday(¤tTime, NULL);
+ printf("Nanoseconds: %ld\nCurrent:%ld\n", requiredNanoseconds,currentTime.tv_usec*1000 - period*1000);
+ if (currentTime.tv_usec*1000 - period*1000 < requiredNanoseconds) {
+ struct timespec remainingTime;
+ remainingTime.tv_sec = 0;
+ remainingTime.tv_nsec = requiredNanoseconds - (currentTime.tv_usec*1000 - period*1000);
+ printf("Sleeping for %dnano and %dsec with %f effective sec\n", remainingTime.tv_nsec, remainingTime.tv_sec, remainingTime.tv_nsec/10e9);
+ clock_nanosleep(CLOCK_MONOTONIC, 0, &remainingTime, NULL);
+ return 0;
+ }
+ printf("Can't delay, %d larger than required %d", currentTime.tv_usec*1000 - period*1000, requiredNanoseconds);
+ return 1;
+}
\ No newline at end of file
diff --git a/src/helper/tickrateHelper.h b/src/helper/tickrateHelper.h
new file mode 100644
index 0000000..f93b0de
--- /dev/null
+++ b/src/helper/tickrateHelper.h
@@ -0,0 +1,10 @@
+//
+// Created by Hannah on 31/01/2026.
+//
+
+#ifndef LIFECRYSTAL_TICKRATEHELPER_H
+#define LIFECRYSTAL_TICKRATEHELPER_H
+
+int delayTickrate(int tickrate, int period);
+
+#endif //LIFECRYSTAL_TICKRATEHELPER_H
\ No newline at end of file
diff --git a/src/logic/engineHandler.c b/src/logic/engineHandler.c
new file mode 100644
index 0000000..5d74a36
--- /dev/null
+++ b/src/logic/engineHandler.c
@@ -0,0 +1,11 @@
+//
+// Created by Hannah on 31/01/2026.
+//
+
+#include "engineHandler.h"
+
+#include
+
+int engineHandlerCycle() {
+ printf("This is an engine handler cycle!\n");
+}
diff --git a/src/logic/engineHandler.h b/src/logic/engineHandler.h
new file mode 100644
index 0000000..51c91b8
--- /dev/null
+++ b/src/logic/engineHandler.h
@@ -0,0 +1,10 @@
+//
+// Created by Hannah on 31/01/2026.
+//
+
+#ifndef LIFECRYSTAL_ENGINEHANDLER_H
+#define LIFECRYSTAL_ENGINEHANDLER_H
+
+int engineHandlerCycle();
+
+#endif //LIFECRYSTAL_ENGINEHANDLER_H
\ No newline at end of file
diff --git a/src/logic/gameLoop.c b/src/logic/gameLoop.c
new file mode 100644
index 0000000..2bdcf6c
--- /dev/null
+++ b/src/logic/gameLoop.c
@@ -0,0 +1,31 @@
+//
+// Created by Hannah on 31/01/2026.
+//
+
+#include "gameLoop.h"
+#include
+#include
+#include "../helper/tickrateHelper.h"
+
+struct timeval rateRegulator(struct timeval prevCycleTime, int ticksPerSecond) {
+ unsigned short int isBehindSchedule = delayTickrate(ticksPerSecond, prevCycleTime.tv_usec);
+ if (isBehindSchedule) {
+ printf("\nRunning behind schedule!\n");
+ }
+ struct timeval nextCycleTime;
+ gettimeofday(&nextCycleTime, NULL);
+ unsigned int deltaTime = nextCycleTime.tv_usec - prevCycleTime.tv_usec;
+ printf("Cycle took %u micros, %d millis, landing on %d tps\n", deltaTime, deltaTime/1000, (int) 10e6/deltaTime);
+ return nextCycleTime;
+}
+
+int mainGameLoop(int ticksPerSecond, int framesPerSecond) {
+ printf("Starting mainGameLoop at %dTPS,%dFPS", ticksPerSecond, framesPerSecond);
+ struct timeval prevCycleTime;
+ gettimeofday(&prevCycleTime, NULL);
+
+ while (true) {
+ prevCycleTime = rateRegulator(prevCycleTime, ticksPerSecond);
+ }
+}
+
diff --git a/src/logic/gameLoop.h b/src/logic/gameLoop.h
new file mode 100644
index 0000000..0da001b
--- /dev/null
+++ b/src/logic/gameLoop.h
@@ -0,0 +1,10 @@
+//
+// Created by Hannah on 31/01/2026.
+//
+
+#ifndef LIFECRYSTAL_GAMELOOP_H
+#define LIFECRYSTAL_GAMELOOP_H
+
+int mainGameLoop(int ticksPerSecond, int framesPerSecond);
+
+#endif //LIFECRYSTAL_GAMELOOP_H
\ No newline at end of file
diff --git a/src/main.c b/src/main.c
index 8b13789..6411dc0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1 +1,9 @@
+#include
+#include "logic/engineHandler.h"
+#include "logic/gameLoop.h"
+int main() {
+ printf("Hello World!\n");
+ engineHandlerCycle();
+ mainGameLoop(120,120);
+}