Update some things.
This commit is contained in:
parent
f215bc3742
commit
4ad41f2e2e
34 changed files with 573 additions and 905 deletions
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 {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +1,37 @@
|
|||
#include "Server.h"
|
||||
#include "Network/Network.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<NetworkServer>();
|
||||
addSubsystem<ServerNetwork>();
|
||||
addSubsystem<WorldManager>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include "Shared.h"
|
||||
#include <Settings.h>
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
class Server: public Engine<BaseSubsystem> {
|
||||
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