Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat: Add project management system core

esengine4151139696f7
diff --git a/src/esengine/editor/CMakeLists.txt b/src/esengine/editor/CMakeLists.txt
index 78c99156f..d25db93ad 100644
--- a/src/esengine/editor/CMakeLists.txt
+++ b/src/esengine/editor/CMakeLists.txt
@@ -7,6 +7,11 @@ set(EDITOR_SOURCES
ThumbnailGenerator.cpp
DragDropManager.cpp
+ # Project management
+ project/ProjectSerializer.cpp
+ project/RecentProjectsManager.cpp
+ project/ProjectManager.cpp
+
# Property editors
property/PropertyEditor.cpp
property/editors/FloatEditor.cpp
@@ -37,6 +42,12 @@ set(EDITOR_HEADERS
core/EditorEvents.hpp
core/Selection.hpp
+ # Project management
+ project/ProjectTypes.hpp
+ project/ProjectSerializer.hpp
+ project/RecentProjectsManager.hpp
+ project/ProjectManager.hpp
+
# Command subsystem
command/Command.hpp
command/CommandHistory.hpp
diff --git a/src/esengine/editor/EditorApplication.cpp b/src/esengine/editor/EditorApplication.cpp
index 25ec99270..08e019c88 100644
--- a/src/esengine/editor/EditorApplication.cpp
+++ b/src/esengine/editor/EditorApplication.cpp
@@ -44,6 +44,7 @@ EditorApplication::EditorApplication()
}) {
commandHistory_.setDispatcher(&dispatcher_);
selection_.setDispatcher(&dispatcher_);
+ projectManager_ = makeUnique<ProjectManager>(dispatcher_, assetDatabase_);
}
// =============================================================================
@@ -127,6 +128,9 @@ void EditorApplication::onInit() {
assetDatabase_.setProjectPath(PathResolver::projectPath("assets"));
assetDatabase_.scan();
+ // Load recent projects list
+ projectManager_->getRecentProjects().load();
+
// Create demo scene for testing
createDemoScene();
@@ -310,6 +314,18 @@ void EditorApplication::setupEventListeners() {
[](const EntityDeleted& e) {
ES_LOG_DEBUG("Entity deleted: {}", e.entity);
}));
+
+ eventConnections_.add(
+ dispatcher_.sink<ProjectOpened>().connect(
+ [](const ProjectOpened& e) {
+ ES_LOG_INFO("Project opened: {} ({})", e.name, e.path);
+ }));
+
+ eventConnections_.add(
+ dispatcher_.sink<ProjectClosed>().connect(
+ [](const ProjectClosed&) {
+ ES_LOG_INFO("Project closed");
+ }));
}
void EditorApplication::setupEditorLayout() {
diff --git a/src/esengine/editor/EditorApplication.hpp b/src/esengine/editor/EditorApplication.hpp
index d66b5749c..63c707508 100644
--- a/src/esengine/editor/EditorApplication.hpp
+++ b/src/esengine/editor/EditorApplication.hpp
@@ -27,6 +27,7 @@
#include "AssetDatabase.hpp"
#include "ThumbnailGenerator.hpp"
#include "DragDropManager.hpp"
+#include "project/ProjectManager.hpp"
namespace esengine {
namespace editor {
@@ -119,6 +120,12 @@ public:
*/
DragDropManager& getDragDropManager() { return dragDropManager_; }
+ /**
+ * @brief Get the project manager
+ * @return Reference to the project manager
+ */
+ ProjectManager& getProjectManager() { return *projectManager_; }
+
protected:
// =========================================================================
// Application Lifecycle Overrides
@@ -215,6 +222,7 @@ private:
AssetDatabase assetDatabase_; ///< Asset database
ThumbnailGenerator thumbnailGenerator_; ///< Thumbnail generator
DragDropManager dragDropManager_; ///< Drag-drop manager
+ Unique<ProjectManager> projectManager_; ///< Project manager
Unique<ui::UIContext> uiContext_; ///< UI system context
ui::DockArea* dockArea_ = nullptr; ///< Main docking area (owned by UIContext)
diff --git a/src/esengine/editor/project/ProjectManager.cpp b/src/esengine/editor/project/ProjectManager.cpp
new file mode 100644
index 000000000..abf899798
--- /dev/null
+++ b/src/esengine/editor/project/ProjectManager.cpp
@@ -0,0 +1,283 @@
+/**
+ * @file ProjectManager.cpp
+ * @brief Core project management implementation
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+
+#include "ProjectManager.hpp"
+#include "ProjectSerializer.hpp"
+#include "../AssetDatabase.hpp"
+#include "../core/EditorEvents.hpp"
+#include "../../events/Dispatcher.hpp"
+#include "../../platform/FileSystem.hpp"
+#include "../../platform/PathResolver.hpp"
+#include "../../core/Log.hpp"
+
+#include <chrono>
+
+namespace esengine::editor {
+
+// =============================================================================
+// Constructor
+// =============================================================================
+
+ProjectManager::ProjectManager(Dispatcher& dispatcher, AssetDatabase& assetDatabase)
+ : dispatcher_(dispatcher)
+ , asset_database_(assetDatabase) {
+}
+
+ProjectManager::~ProjectManager() {
+ if (has_open_project_) {
+ closeProject();
+ }
+}
+
+// =============================================================================
+// Project Operations
+// =============================================================================
+
+Result<bool> ProjectManager::createProject(const std::string& directory,
+ const std::string& name) {
+#ifdef ES_PLATFORM_WEB
+ return Result<bool>::err("Project creation not supported on web platform");
+#endif
+
+ if (directory.empty()) {
+ return Result<bool>::err("Directory path cannot be empty");
+ }
+
+ if (name.empty()) {
+ return Result<bool>::err("Project name cannot be empty");
+ }
+
+ if (FileSystem::directoryExists(directory)) {
+ return Result<bool>::err("Directory already exists: " + directory);
+ }
+
+ ES_LOG_INFO("ProjectManager: Creating project '{}' at {}", name, directory);
+
+ if (!FileSystem::createDirectory(directory)) {
+ return Result<bool>::err("Failed to create project directory");
+ }
+
+ createDirectoryStructure(directory);
+
+ ProjectInfo project;
+ project.name = name;
+ project.rootDirectory = directory;
+ project.path = directory + "/" + PROJECT_FILE_NAME;
+ project.engineVersion = ENGINE_VERSION;
+ project.formatVersion = PROJECT_FORMAT_VERSION;
+ project.created = getCurrentTimestamp();
+ project.lastOpened = project.created;
+ project.settings.targetPlatforms = {TargetPlatform::Windows};
+ project.settings.defaultScene = "scenes/main.scene";
+ project.settings.renderer.defaultWidth = 1280;
+ project.settings.renderer.defaultHeight = 720;
+ project.settings.renderer.vsync = true;
+
+ std::string json = ProjectSerializer::serialize(project);
+ if (!FileSystem::writeTextFile(project.path, json)) {
+ return Result<bool>::err("Failed to write project file");
+ }
+
+ ES_LOG_INFO("ProjectManager: Project created successfully");
+
+ auto result = openProject(project.path);
+ if (result.isErr()) {
+ return result;
+ }
+
+ return Result<bool>::ok(true);
+}
+
+Result<bool> ProjectManager::openProject(const std::string& projectFilePath) {
+#ifdef ES_PLATFORM_WEB
+ return Result<bool>::err("Project opening not supported on web platform");
+#endif
+
+ if (projectFilePath.empty()) {
+ return Result<bool>::err("Project file path cannot be empty");
+ }
+
+ if (!FileSystem::fileExists(projectFilePath)) {
+ return Result<bool>::err("Project file not found: " + projectFilePath);
+ }
+
+ ES_LOG_INFO("ProjectManager: Opening project from {}", projectFilePath);
+
+ if (has_open_project_) {
+ closeProject();
+ }
+
+ std::string content = FileSystem::readTextFile(projectFilePath);
+ if (content.empty()) {
+ return Result<bool>::err("Failed to read project file");
+ }
+
+ ProjectInfo project;
+ if (!ProjectSerializer::deserialize(content, project)) {
+ return Result<bool>::err("Failed to parse project file");
+ }
+
+ project.path = projectFilePath;
+ project.rootDirectory = getParentDirectory(projectFilePath);
+ project.lastOpened = getCurrentTimestamp();
+
+ std::string updatedJson = ProjectSerializer::serialize(project);
+ FileSystem::writeTextFile(projectFilePath, updatedJson);
+
+ current_project_ = std::move(project);
+ has_open_project_ = true;
+
+ updatePathResolver(current_project_.rootDirectory);
+ initializeAssetDatabase(current_project_.rootDirectory);
+
+ recent_projects_.addProject(current_project_.path, current_project_.name);
+
+ fireProjectOpenedEvent();
+
+ ES_LOG_INFO("ProjectManager: Project '{}' opened successfully", current_project_.name);
+
+ return Result<bool>::ok(true);
+}
+
+void ProjectManager::closeProject() {
+ if (!has_open_project_) {
+ return;
+ }
+
+ ES_LOG_INFO("ProjectManager: Closing project '{}'", current_project_.name);
+
+ fireProjectClosedEvent();
+
+ current_project_ = ProjectInfo{};
+ has_open_project_ = false;
+
+ PathResolver::setProjectRoot("");
+}
+
+// =============================================================================
+// Project State
+// =============================================================================
+
+bool ProjectManager::hasOpenProject() const {
+ return has_open_project_;
+}
+
+const ProjectInfo& ProjectManager::getCurrentProject() const {
+ return current_project_;
+}
+
+ProjectInfo& ProjectManager::getCurrentProject() {
+ return current_project_;
+}
+
+// =============================================================================
+// Settings
+// =============================================================================
+
+void ProjectManager::saveProjectSettings() {
+ if (!has_open_project_) {
+ ES_LOG_WARN("ProjectManager: No project open, cannot save settings");
+ return;
+ }
+
+ std::string json = ProjectSerializer::serialize(current_project_);
+ if (FileSystem::writeTextFile(current_project_.path, json)) {
+ ES_LOG_DEBUG("ProjectManager: Project settings saved");
+ } else {
+ ES_LOG_ERROR("ProjectManager: Failed to save project settings");
+ }
+}
+
+void ProjectManager::updateSettings(const ProjectSettings& settings) {
+ if (!has_open_project_) {
+ return;
+ }
+
+ current_project_.settings = settings;
+ saveProjectSettings();
+ fireProjectSettingsChangedEvent();
+}
+
+// =============================================================================
+// Recent Projects
+// =============================================================================
+
+RecentProjectsManager& ProjectManager::getRecentProjects() {
+ return recent_projects_;
+}
+
+const RecentProjectsManager& ProjectManager::getRecentProjects() const {
+ return recent_projects_;
+}
+
+// =============================================================================
+// Private Methods
+// =============================================================================
+
+void ProjectManager::createDirectoryStructure(const std::string& rootDir) {
+ const std::vector<std::string> directories = {
+ "/assets",
+ "/assets/scenes",
+ "/assets/scripts",
+ "/assets/textures",
+ "/assets/audio",
+ "/assets/fonts",
+ "/assets/prefabs",
+ "/assets/shaders",
+ "/.esengine"
+ };
+
+ for (const auto& dir : directories) {
+ FileSystem::createDirectory(rootDir + dir);
+ }
+}
+
+void ProjectManager::updatePathResolver(const std::string& rootDir) {
+ PathResolver::setProjectRoot(rootDir);
+ ES_LOG_DEBUG("ProjectManager: PathResolver project root set to {}", rootDir);
+}
+
+void ProjectManager::initializeAssetDatabase(const std::string& rootDir) {
+ std::string assetsPath = rootDir + "/assets";
+ asset_database_.setProjectPath(assetsPath);
+ asset_database_.scan();
+}
+
+void ProjectManager::fireProjectOpenedEvent() {
+ dispatcher_.trigger(ProjectOpened{
+ .path = current_project_.path,
+ .name = current_project_.name
+ });
+}
+
+void ProjectManager::fireProjectClosedEvent() {
+ dispatcher_.trigger(ProjectClosed{});
+}
+
+void ProjectManager::fireProjectSettingsChangedEvent() {
+ dispatcher_.trigger(ProjectSettingsChanged{});
+}
+
+std::string ProjectManager::getParentDirectory(const std::string& path) {
+ usize pos = path.find_last_of("/\\");
+ if (pos != std::string::npos) {
+ return path.substr(0, pos);
+ }
+ return path;
+}
+
+u64 ProjectManager::getCurrentTimestamp() {
+ auto now = std::chrono::system_clock::now();
+ return static_cast<u64>(
+ std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count());
+}
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/project/ProjectManager.hpp b/src/esengine/editor/project/ProjectManager.hpp
new file mode 100644
index 000000000..5857fb138
--- /dev/null
+++ b/src/esengine/editor/project/ProjectManager.hpp
@@ -0,0 +1,94 @@
+/**
+ * @file ProjectManager.hpp
+ * @brief Core project management functionality
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+#pragma once
+
+// =============================================================================
+// Includes
+// =============================================================================
+
+#include "ProjectTypes.hpp"
+#include "RecentProjectsManager.hpp"
+#include "../../core/Types.hpp"
+
+namespace esengine {
+class Dispatcher;
+}
+
+namespace esengine::editor {
+
+class AssetDatabase;
+
+// =============================================================================
+// ProjectManager
+// =============================================================================
+
+class ProjectManager {
+public:
+ // =========================================================================
+ // Constructor
+ // =========================================================================
+
+ explicit ProjectManager(Dispatcher& dispatcher, AssetDatabase& assetDatabase);
+ ~ProjectManager();
+
+ ProjectManager(const ProjectManager&) = delete;
+ ProjectManager& operator=(const ProjectManager&) = delete;
+
+ // =========================================================================
+ // Project Operations
+ // =========================================================================
+
+ [[nodiscard]] Result<bool> createProject(const std::string& directory,
+ const std::string& name);
+ [[nodiscard]] Result<bool> openProject(const std::string& projectFilePath);
+ void closeProject();
+
+ // =========================================================================
+ // Project State
+ // =========================================================================
+
+ [[nodiscard]] bool hasOpenProject() const;
+ [[nodiscard]] const ProjectInfo& getCurrentProject() const;
+ [[nodiscard]] ProjectInfo& getCurrentProject();
+
+ // =========================================================================
+ // Settings
+ // =========================================================================
+
+ void saveProjectSettings();
+ void updateSettings(const ProjectSettings& settings);
+
+ // =========================================================================
+ // Recent Projects
+ // =========================================================================
+
+ [[nodiscard]] RecentProjectsManager& getRecentProjects();
+ [[nodiscard]] const RecentProjectsManager& getRecentProjects() const;
+
+private:
+ void createDirectoryStructure(const std::string& rootDir);
+ void updatePathResolver(const std::string& rootDir);
+ void initializeAssetDatabase(const std::string& rootDir);
+ void fireProjectOpenedEvent();
+ void fireProjectClosedEvent();
+ void fireProjectSettingsChangedEvent();
+
+ [[nodiscard]] static std::string getParentDirectory(const std::string& path);
+ [[nodiscard]] static u64 getCurrentTimestamp();
+
+ Dispatcher& dispatcher_;
+ AssetDatabase& asset_database_;
+ ProjectInfo current_project_;
+ RecentProjectsManager recent_projects_;
+ bool has_open_project_ = false;
+};
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/project/ProjectSerializer.cpp b/src/esengine/editor/project/ProjectSerializer.cpp
new file mode 100644
index 000000000..319069bb7
--- /dev/null
+++ b/src/esengine/editor/project/ProjectSerializer.cpp
@@ -0,0 +1,283 @@
+/**
+ * @file ProjectSerializer.cpp
+ * @brief Project file JSON serialization implementation
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+
+#include "ProjectSerializer.hpp"
+#include "../../core/Log.hpp"
+
+#include <sstream>
+
+namespace esengine::editor {
+
+// =============================================================================
+// Helper Functions
+// =============================================================================
+
+namespace {
+
+std::string escapeJsonString(const std::string& str) {
+ std::string result;
+ result.reserve(str.size() + 16);
+ for (char c : str) {
+ switch (c) {
+ case '"': result += "\\\""; break;
+ case '\\': result += "\\\\"; break;
+ case '\n': result += "\\n"; break;
+ case '\r': result += "\\r"; break;
+ case '\t': result += "\\t"; break;
+ default: result += c; break;
+ }
+ }
+ return result;
+}
+
+std::string unescapeJsonString(const std::string& str) {
+ std::string result;
+ result.reserve(str.size());
+ for (usize i = 0; i < str.size(); ++i) {
+ if (str[i] == '\\' && i + 1 < str.size()) {
+ switch (str[i + 1]) {
+ case '"': result += '"'; ++i; break;
+ case '\\': result += '\\'; ++i; break;
+ case 'n': result += '\n'; ++i; break;
+ case 'r': result += '\r'; ++i; break;
+ case 't': result += '\t'; ++i; break;
+ default: result += str[i]; break;
+ }
+ } else {
+ result += str[i];
+ }
+ }
+ return result;
+}
+
+std::string extractString(const std::string& json, usize startPos, const std::string& key) {
+ std::string searchKey = "\"" + key + "\":";
+ usize keyPos = json.find(searchKey, startPos);
+ if (keyPos == std::string::npos) return "";
+
+ usize valueStart = json.find("\"", keyPos + searchKey.size());
+ if (valueStart == std::string::npos) return "";
+
+ usize valueEnd = valueStart + 1;
+ while (valueEnd < json.size()) {
+ if (json[valueEnd] == '"' && json[valueEnd - 1] != '\\') break;
+ ++valueEnd;
+ }
+ if (valueEnd >= json.size()) return "";
+
+ return unescapeJsonString(json.substr(valueStart + 1, valueEnd - valueStart - 1));
+}
+
+u64 extractUInt(const std::string& json, usize startPos, const std::string& key) {
+ std::string searchKey = "\"" + key + "\":";
+ usize keyPos = json.find(searchKey, startPos);
+ if (keyPos == std::string::npos) return 0;
+
+ usize valueStart = keyPos + searchKey.size();
+ while (valueStart < json.size() && !std::isdigit(json[valueStart])) {
+ ++valueStart;
+ }
+ if (valueStart >= json.size()) return 0;
+
+ try {
+ return std::stoull(json.substr(valueStart));
+ } catch (...) {
+ return 0;
+ }
+}
+
+bool extractBool(const std::string& json, usize startPos, const std::string& key) {
+ std::string searchKey = "\"" + key + "\":";
+ usize keyPos = json.find(searchKey, startPos);
+ if (keyPos == std::string::npos) return false;
+
+ usize truePos = json.find("true", keyPos);
+ usize falsePos = json.find("false", keyPos);
+ usize nextKey = json.find("\"", keyPos + searchKey.size() + 1);
+
+ if (truePos != std::string::npos && (truePos < falsePos || falsePos == std::string::npos)) {
+ if (nextKey == std::string::npos || truePos < nextKey) {
+ return true;
+ }
+ }
+ return false;
+}
+
+std::vector<std::string> extractStringArray(const std::string& json, usize startPos,
+ const std::string& key) {
+ std::vector<std::string> result;
+ std::string searchKey = "\"" + key + "\":";
+ usize keyPos = json.find(searchKey, startPos);
+ if (keyPos == std::string::npos) return result;
+
+ usize arrayStart = json.find("[", keyPos);
+ usize arrayEnd = json.find("]", arrayStart);
+ if (arrayStart == std::string::npos || arrayEnd == std::string::npos) return result;
+
+ std::string arrayContent = json.substr(arrayStart + 1, arrayEnd - arrayStart - 1);
+ usize pos = 0;
+ while ((pos = arrayContent.find("\"", pos)) != std::string::npos) {
+ usize endPos = pos + 1;
+ while (endPos < arrayContent.size()) {
+ if (arrayContent[endPos] == '"' && arrayContent[endPos - 1] != '\\') break;
+ ++endPos;
+ }
+ if (endPos < arrayContent.size()) {
+ result.push_back(unescapeJsonString(arrayContent.substr(pos + 1, endPos - pos - 1)));
+ }
+ pos = endPos + 1;
+ }
+ return result;
+}
+
+} // namespace
+
+// =============================================================================
+// Project Serialization
+// =============================================================================
+
+std::string ProjectSerializer::serialize(const ProjectInfo& project) {
+ std::stringstream ss;
+
+ ss << "{\n";
+ ss << " \"version\": " << project.formatVersion << ",\n";
+ ss << " \"name\": \"" << escapeJsonString(project.name) << "\",\n";
+ ss << " \"engineVersion\": \"" << escapeJsonString(project.engineVersion) << "\",\n";
+ ss << " \"created\": " << project.created << ",\n";
+ ss << " \"lastOpened\": " << project.lastOpened << ",\n";
+
+ ss << " \"settings\": {\n";
+
+ ss << " \"targetPlatforms\": [";
+ for (usize i = 0; i < project.settings.targetPlatforms.size(); ++i) {
+ if (i > 0) ss << ", ";
+ ss << "\"" << targetPlatformToString(project.settings.targetPlatforms[i]) << "\"";
+ }
+ ss << "],\n";
+
+ ss << " \"defaultScene\": \"" << escapeJsonString(project.settings.defaultScene) << "\",\n";
+
+ ss << " \"renderer\": {\n";
+ ss << " \"defaultWidth\": " << project.settings.renderer.defaultWidth << ",\n";
+ ss << " \"defaultHeight\": " << project.settings.renderer.defaultHeight << ",\n";
+ ss << " \"vsync\": " << (project.settings.renderer.vsync ? "true" : "false") << "\n";
+ ss << " }\n";
+
+ ss << " }\n";
+ ss << "}\n";
+
+ return ss.str();
+}
+
+bool ProjectSerializer::deserialize(const std::string& json, ProjectInfo& outProject) {
+ if (json.empty()) {
+ ES_LOG_ERROR("ProjectSerializer: Empty JSON");
+ return false;
+ }
+
+ outProject.formatVersion = static_cast<u32>(extractUInt(json, 0, "version"));
+ outProject.name = extractString(json, 0, "name");
+ outProject.engineVersion = extractString(json, 0, "engineVersion");
+ outProject.created = extractUInt(json, 0, "created");
+ outProject.lastOpened = extractUInt(json, 0, "lastOpened");
+
+ if (outProject.name.empty()) {
+ ES_LOG_ERROR("ProjectSerializer: Missing project name");
+ return false;
+ }
+
+ usize settingsPos = json.find("\"settings\":");
+ if (settingsPos != std::string::npos) {
+ auto platforms = extractStringArray(json, settingsPos, "targetPlatforms");
+ outProject.settings.targetPlatforms.clear();
+ for (const auto& p : platforms) {
+ outProject.settings.targetPlatforms.push_back(targetPlatformFromString(p));
+ }
+
+ outProject.settings.defaultScene = extractString(json, settingsPos, "defaultScene");
+
+ usize rendererPos = json.find("\"renderer\":", settingsPos);
+ if (rendererPos != std::string::npos) {
+ outProject.settings.renderer.defaultWidth =
+ static_cast<u32>(extractUInt(json, rendererPos, "defaultWidth"));
+ outProject.settings.renderer.defaultHeight =
+ static_cast<u32>(extractUInt(json, rendererPos, "defaultHeight"));
+ outProject.settings.renderer.vsync = extractBool(json, rendererPos, "vsync");
+
+ if (outProject.settings.renderer.defaultWidth == 0) {
+ outProject.settings.renderer.defaultWidth = 1280;
+ }
+ if (outProject.settings.renderer.defaultHeight == 0) {
+ outProject.settings.renderer.defaultHeight = 720;
+ }
+ }
+ }
+
+ return true;
+}
+
+// =============================================================================
+// Recent Projects Serialization
+// =============================================================================
+
+std::string ProjectSerializer::serializeRecentProjects(
+ const std::vector<RecentProject>& projects) {
+ std::stringstream ss;
+
+ ss << "{\n";
+ ss << " \"version\": 1,\n";
+ ss << " \"projects\": [\n";
+
+ for (usize i = 0; i < projects.size(); ++i) {
+ const auto& p = projects[i];
+ ss << " {\n";
+ ss << " \"path\": \"" << escapeJsonString(p.path) << "\",\n";
+ ss << " \"name\": \"" << escapeJsonString(p.name) << "\",\n";
+ ss << " \"lastOpened\": " << p.lastOpened << "\n";
+ ss << " }";
+ if (i + 1 < projects.size()) ss << ",";
+ ss << "\n";
+ }
+
+ ss << " ]\n";
+ ss << "}\n";
+
+ return ss.str();
+}
+
+bool ProjectSerializer::deserializeRecentProjects(
+ const std::string& json, std::vector<RecentProject>& outProjects) {
+ outProjects.clear();
+
+ if (json.empty()) {
+ return false;
+ }
+
+ usize pos = 0;
+ while ((pos = json.find("\"path\":", pos)) != std::string::npos) {
+ RecentProject project;
+ project.path = extractString(json, pos, "path");
+ project.name = extractString(json, pos, "name");
+ project.lastOpened = extractUInt(json, pos, "lastOpened");
+
+ if (!project.path.empty()) {
+ outProjects.push_back(std::move(project));
+ }
+
+ usize nextBrace = json.find("}", pos);
+ if (nextBrace == std::string::npos) break;
+ pos = nextBrace + 1;
+ }
+
+ return true;
+}
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/project/ProjectSerializer.hpp b/src/esengine/editor/project/ProjectSerializer.hpp
new file mode 100644
index 000000000..c28db1219
--- /dev/null
+++ b/src/esengine/editor/project/ProjectSerializer.hpp
@@ -0,0 +1,36 @@
+/**
+ * @file ProjectSerializer.hpp
+ * @brief Project file JSON serialization
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+#pragma once
+
+// =============================================================================
+// Includes
+// =============================================================================
+
+#include "ProjectTypes.hpp"
+
+namespace esengine::editor {
+
+// =============================================================================
+// ProjectSerializer
+// =============================================================================
+
+class ProjectSerializer {
+public:
+ [[nodiscard]] static std::string serialize(const ProjectInfo& project);
+ [[nodiscard]] static bool deserialize(const std::string& json, ProjectInfo& outProject);
+
+ [[nodiscard]] static std::string serializeRecentProjects(
+ const std::vector<RecentProject>& projects);
+ [[nodiscard]] static bool deserializeRecentProjects(
+ const std::string& json, std::vector<RecentProject>& outProjects);
+};
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/project/ProjectTypes.hpp b/src/esengine/editor/project/ProjectTypes.hpp
new file mode 100644
index 000000000..c044dc43a
--- /dev/null
+++ b/src/esengine/editor/project/ProjectTypes.hpp
@@ -0,0 +1,109 @@
+/**
+ * @file ProjectTypes.hpp
+ * @brief Project management type definitions
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+#pragma once
+
+// =============================================================================
+// Includes
+// =============================================================================
+
+#include "../../core/Types.hpp"
+
+#include <string>
+#include <vector>
+
+namespace esengine::editor {
+
+// =============================================================================
+// Constants
+// =============================================================================
+
+constexpr const char* PROJECT_FILE_NAME = "project.esproject";
+constexpr const char* ENGINE_VERSION = "1.0.0";
+constexpr u32 PROJECT_FORMAT_VERSION = 1;
+
+// =============================================================================
+// Target Platform
+// =============================================================================
+
+enum class TargetPlatform : u8 {
+ Windows,
+ MacOS,
+ Linux,
+ Web,
+ WxGame
+};
+
+[[nodiscard]] inline const char* targetPlatformToString(TargetPlatform platform) {
+ switch (platform) {
+ case TargetPlatform::Windows: return "windows";
+ case TargetPlatform::MacOS: return "macos";
+ case TargetPlatform::Linux: return "linux";
+ case TargetPlatform::Web: return "web";
+ case TargetPlatform::WxGame: return "wxgame";
+ }
+ return "unknown";
+}
+
+[[nodiscard]] inline TargetPlatform targetPlatformFromString(const std::string& str) {
+ if (str == "windows") return TargetPlatform::Windows;
+ if (str == "macos") return TargetPlatform::MacOS;
+ if (str == "linux") return TargetPlatform::Linux;
+ if (str == "web") return TargetPlatform::Web;
+ if (str == "wxgame") return TargetPlatform::WxGame;
+ return TargetPlatform::Windows;
+}
+
+// =============================================================================
+// Project Settings
+// =============================================================================
+
+struct RendererSettings {
+ u32 defaultWidth = 1280;
+ u32 defaultHeight = 720;
+ bool vsync = true;
+};
+
+struct ProjectSettings {
+ std::vector<TargetPlatform> targetPlatforms{TargetPlatform::Windows};
+ std::string defaultScene;
+ RendererSettings renderer;
+};
+
+// =============================================================================
+// Project Info
+// =============================================================================
+
+struct ProjectInfo {
+ std::string name;
+ std::string path;
+ std::string rootDirectory;
+ std::string engineVersion{ENGINE_VERSION};
+ u32 formatVersion{PROJECT_FORMAT_VERSION};
+ u64 created = 0;
+ u64 lastOpened = 0;
+ ProjectSettings settings;
+
+ [[nodiscard]] bool isValid() const {
+ return !name.empty() && !path.empty() && !rootDirectory.empty();
+ }
+};
+
+// =============================================================================
+// Recent Project
+// =============================================================================
+
+struct RecentProject {
+ std::string path;
+ std::string name;
+ u64 lastOpened = 0;
+};
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/project/RecentProjectsManager.cpp b/src/esengine/editor/project/RecentProjectsManager.cpp
new file mode 100644
index 000000000..c86c3fe46
--- /dev/null
+++ b/src/esengine/editor/project/RecentProjectsManager.cpp
@@ -0,0 +1,159 @@
+/**
+ * @file RecentProjectsManager.cpp
+ * @brief Recent projects list management implementation
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+
+#include "RecentProjectsManager.hpp"
+#include "ProjectSerializer.hpp"
+#include "../../platform/FileSystem.hpp"
+#include "../../core/Log.hpp"
+
+#include <algorithm>
+#include <chrono>
+#include <cstdlib>
+
+namespace esengine::editor {
+
+// =============================================================================
+// Persistence
+// =============================================================================
+
+void RecentProjectsManager::load() {
+#ifdef ES_PLATFORM_WEB
+ return;
+#endif
+
+ std::string configPath = getConfigFilePath();
+ if (!FileSystem::fileExists(configPath)) {
+ ES_LOG_DEBUG("RecentProjectsManager: No recent projects file found");
+ return;
+ }
+
+ std::string content = FileSystem::readTextFile(configPath);
+ if (content.empty()) {
+ return;
+ }
+
+ if (ProjectSerializer::deserializeRecentProjects(content, recent_projects_)) {
+ ES_LOG_DEBUG("RecentProjectsManager: Loaded {} recent projects", recent_projects_.size());
+ }
+}
+
+void RecentProjectsManager::save() {
+#ifdef ES_PLATFORM_WEB
+ return;
+#endif
+
+ std::string configDir = getConfigDirectory();
+ if (!FileSystem::directoryExists(configDir)) {
+ FileSystem::createDirectory(configDir);
+ }
+
+ std::string json = ProjectSerializer::serializeRecentProjects(recent_projects_);
+ FileSystem::writeTextFile(getConfigFilePath(), json);
+ ES_LOG_DEBUG("RecentProjectsManager: Saved {} recent projects", recent_projects_.size());
+}
+
+// =============================================================================
+// Project Management
+// =============================================================================
+
+void RecentProjectsManager::addProject(const std::string& path, const std::string& name) {
+ auto it = std::find_if(recent_projects_.begin(), recent_projects_.end(),
+ [&path](const RecentProject& p) { return p.path == path; });
+
+ auto now = std::chrono::system_clock::now();
+ auto timestamp = static_cast<u64>(
+ std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count());
+
+ if (it != recent_projects_.end()) {
+ it->lastOpened = timestamp;
+ it->name = name;
+ std::rotate(recent_projects_.begin(), it, it + 1);
+ } else {
+ RecentProject project;
+ project.path = path;
+ project.name = name;
+ project.lastOpened = timestamp;
+ recent_projects_.insert(recent_projects_.begin(), project);
+
+ if (recent_projects_.size() > MAX_RECENT_PROJECTS) {
+ recent_projects_.resize(MAX_RECENT_PROJECTS);
+ }
+ }
+
+ save();
+}
+
+void RecentProjectsManager::removeProject(const std::string& path) {
+ auto it = std::remove_if(recent_projects_.begin(), recent_projects_.end(),
+ [&path](const RecentProject& p) { return p.path == path; });
+
+ if (it != recent_projects_.end()) {
+ recent_projects_.erase(it, recent_projects_.end());
+ save();
+ }
+}
+
+void RecentProjectsManager::clearAll() {
+ recent_projects_.clear();
+ save();
+}
+
+// =============================================================================
+// Accessors
+// =============================================================================
+
+const std::vector<RecentProject>& RecentProjectsManager::getRecentProjects() const {
+ return recent_projects_;
+}
+
+bool RecentProjectsManager::hasRecentProjects() const {
+ return !recent_projects_.empty();
+}
+
+// =============================================================================
+// Config Path
+// =============================================================================
+
+std::string RecentProjectsManager::getConfigDirectory() {
+#if defined(_WIN32) || defined(_WIN64)
+ const char* appData = std::getenv("APPDATA");
+ if (appData) {
+ return std::string(appData) + "\\ESEngine";
+ }
+ return "";
+#elif defined(__APPLE__)
+ const char* home = std::getenv("HOME");
+ if (home) {
+ return std::string(home) + "/Library/Application Support/ESEngine";
+ }
+ return "";
+#else
+ const char* home = std::getenv("HOME");
+ if (home) {
+ return std::string(home) + "/.config/esengine";
+ }
+ return "";
+#endif
+}
+
+std::string RecentProjectsManager::getConfigFilePath() {
+ std::string dir = getConfigDirectory();
+ if (dir.empty()) {
+ return "";
+ }
+#if defined(_WIN32) || defined(_WIN64)
+ return dir + "\\recent_projects.json";
+#else
+ return dir + "/recent_projects.json";
+#endif
+}
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/project/RecentProjectsManager.hpp b/src/esengine/editor/project/RecentProjectsManager.hpp
new file mode 100644
index 000000000..deb5f0d51
--- /dev/null
+++ b/src/esengine/editor/project/RecentProjectsManager.hpp
@@ -0,0 +1,68 @@
+/**
+ * @file RecentProjectsManager.hpp
+ * @brief Recent projects list management
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+#pragma once
+
+// =============================================================================
+// Includes
+// =============================================================================
+
+#include "ProjectTypes.hpp"
+
+namespace esengine::editor {
+
+// =============================================================================
+// RecentProjectsManager
+// =============================================================================
+
+class RecentProjectsManager {
+public:
+ static constexpr usize MAX_RECENT_PROJECTS = 10;
+
+ // =========================================================================
+ // Lifecycle
+ // =========================================================================
+
+ RecentProjectsManager() = default;
+ ~RecentProjectsManager() = default;
+
+ RecentProjectsManager(const RecentProjectsManager&) = delete;
+ RecentProjectsManager& operator=(const RecentProjectsManager&) = delete;
+
+ // =========================================================================
+ // Persistence
+ // =========================================================================
+
+ void load();
+ void save();
+
+ // =========================================================================
+ // Project Management
+ // =========================================================================
+
+ void addProject(const std::string& path, const std::string& name);
+ void removeProject(const std::string& path);
+ void clearAll();
+
+ // =========================================================================
+ // Accessors
+ // =========================================================================
+
+ [[nodiscard]] const std::vector<RecentProject>& getRecentProjects() const;
+ [[nodiscard]] bool hasRecentProjects() const;
+
+private:
+ [[nodiscard]] static std::string getConfigDirectory();
+ [[nodiscard]] static std::string getConfigFilePath();
+
+ std::vector<RecentProject> recent_projects_;
+};
+
+} // namespace esengine::editor