Initial commit.
This commit is contained in:
commit
82b4f23c06
56 changed files with 3485 additions and 0 deletions
6
Server/CMakeLists.txt
Normal file
6
Server/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
file(GLOB_RECURSE MY_SOURCES CONFIGURE_DEPENDS
|
||||
"*.cpp"
|
||||
"*.h"
|
||||
)
|
||||
|
||||
add_library(Server ${MY_SOURCES})
|
||||
10
Server/Network.h
Normal file
10
Server/Network.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <Network/Network.h>
|
||||
#include "Server.h"
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
class ServerNetwork: public NetworkServer, public ServerSubsystem {};
|
||||
|
||||
}
|
||||
7
Server/Player.cpp
Normal file
7
Server/Player.cpp
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include "Player.h"
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
|
||||
|
||||
}
|
||||
9
Server/Player.h
Normal file
9
Server/Player.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
class Player {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
37
Server/Server.cpp
Normal file
37
Server/Server.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "Server.h"
|
||||
#include "Network.h"
|
||||
#include "World/WorldManager.h"
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
void Server::init() {
|
||||
for (auto & system : subsystems) {
|
||||
system->init();
|
||||
system->reload();
|
||||
}
|
||||
}
|
||||
|
||||
void Server::tick() {
|
||||
for (auto & system : subsystems) {
|
||||
system->tick();
|
||||
}
|
||||
}
|
||||
|
||||
void Server::run() {
|
||||
init();
|
||||
|
||||
auto time = std::chrono::steady_clock::now();
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
if (time - now > std::chrono::milliseconds(50)) {
|
||||
tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Server::addDefaultSubsystems() {
|
||||
addSubsystem<ServerNetwork>();
|
||||
addSubsystem<WorldManager>();
|
||||
}
|
||||
|
||||
}
|
||||
28
Server/Server.h
Normal file
28
Server/Server.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include "Shared.h"
|
||||
#include <Settings.h>
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
class ServerSubsystem;
|
||||
|
||||
class Server: public Engine<ServerSubsystem> {
|
||||
public:
|
||||
Settings settings;
|
||||
|
||||
Server() : settings(getServerConfigPath()) {}
|
||||
|
||||
void init();
|
||||
void tick();
|
||||
void run();
|
||||
void addDefaultSubsystems();
|
||||
};
|
||||
|
||||
class ServerSubsystem: public BaseSubsystem {
|
||||
public:
|
||||
Server * server = nullptr;
|
||||
virtual void tick() {}
|
||||
};
|
||||
|
||||
}
|
||||
7
Server/World/WorldBackend.cpp
Normal file
7
Server/World/WorldBackend.cpp
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
//
|
||||
// WorldBackend.cpp
|
||||
// ArtifactEngine
|
||||
//
|
||||
// Created by Isaac Boettcher on 3/11/26.
|
||||
//
|
||||
|
||||
10
Server/World/WorldBackend.h
Normal file
10
Server/World/WorldBackend.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
class WorldBackend {
|
||||
virtual void saveChunk();
|
||||
virtual void loadChukn();
|
||||
};
|
||||
|
||||
}
|
||||
11
Server/World/WorldManager.cpp
Normal file
11
Server/World/WorldManager.cpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include "WorldManager.h"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
void WorldManager::tick() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
16
Server/World/WorldManager.h
Normal file
16
Server/World/WorldManager.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <Shared.h>
|
||||
#include "../Server.h"
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
class WorldManagerImpl: public ServerSubsystem {
|
||||
|
||||
};
|
||||
|
||||
class WorldManager: public WorldManagerImpl {
|
||||
void tick() override;
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue