Skip to content

feature: using Coral instead #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

feature: using Coral instead #18

wants to merge 12 commits into from

Conversation

sheazywi
Copy link
Member

@sheazywi sheazywi commented Jun 1, 2025

For the moment what I'll do is that I will put everything already added and put more if I want to sometime.

Summary by CodeRabbit

  • New Features

    • Introduced a new managed scripting runtime, replacing Mono with Coral for improved script integration and performance.
    • Added comprehensive math and vector utility classes, including 2D/3D/4D vectors, matrices, interpolation, and random number generation.
    • Enabled script asset importing, serialization, and management, including support for script file assets and script field serialization.
    • Enhanced scene and entity management with new methods for querying entities by tag or ID, managing physics gravity, and handling scene transitions.
    • Expanded input handling with additional mouse and keyboard methods, and improved application frame timing metrics.
    • Added new editor features including improved script assignment UI, drag-and-drop script asset support, and context menu options for entity creation and deletion.
  • Improvements

    • Refactored the scripting engine for better metadata, script field, and instance management.
    • Improved component and entity APIs, including robust component caching, lifecycle handling, and extended property access.
    • Enhanced build system to support the new Coral runtime and updated .NET versions.
    • Improved serialization and deserialization of script components, supporting both new and legacy formats.
  • Bug Fixes

    • Fixed issues with script field persistence and compatibility during project and scene reloads.
    • Corrected asset type handling for script and audio files throughout the asset management and import pipeline.
  • Chores

    • Updated dependencies and project configuration to integrate the Coral runtime and remove obsolete Mono references.
    • Cleaned up unused includes, redundant code, and improved header organization for clarity and maintainability.
  • Documentation

    • Added detailed comments and clarified intent in new and refactored classes, especially for scripting and math utilities.

This update brings significant improvements to scripting, scene management, editor usability, and engine extensibility.

@sheazywi sheazywi self-assigned this Jun 1, 2025
@sheazywi sheazywi added enhancement New feature or request help wanted Extra attention is needed labels Jun 1, 2025
@sheazywi sheazywi moved this to In Progress in StarEngine Project Roadmap Jun 1, 2025
@sheazywi
Copy link
Member Author

@coderabbitai summary

Copy link

coderabbitai bot commented Jun 24, 2025

✅ Actions performed

Summary regeneration triggered.

Copy link

coderabbitai bot commented Jun 24, 2025

Walkthrough

This update replaces the previous Mono-based scripting integration in StarEngine with the Coral managed runtime. It introduces new math and vector types, refactors the scripting engine and glue code to use Coral, overhauls script metadata and field storage, and adds support for script asset importing. Numerous build scripts and project files are updated to reference Coral. The entity/component system and serialization logic are enhanced for script field handling and editor integration.

Changes

File(s)/Path(s) Change Summary
.gitignore, .gitmodules, Dependencies.lua, premake5.lua, StarEngine/premake5.lua, ... Updated to add Coral as a dependency, ignore new build/user files, and remove Mono references.
StarEngine/vendor/Coral Added Coral submodule at a specific commit.
StarEngine-ScriptCore/premake5.lua, StarEditor/SandboxProject/Assets/Scripts/premake5.lua, ... Updated .NET target frameworks, added Coral.Managed link, adjusted file inclusions.
StarEngine-ScriptCore/Source/StarEngine/Math/Vector2.cs, Vector3.cs, Vector4.cs, ... Introduced new math/vector types with expanded functionality; removed old vector files.
StarEngine-ScriptCore/Source/StarEngine/Attributes/EditorAssignableAttribute.cs, ... Added new attribute and utility classes for editor and math support.
StarEngine-ScriptCore/Source/StarEngine/Scene/Components.cs, Entity.cs, Scene.cs, ... Refactored and expanded component/entity API, added caching, new properties, and script integration.
StarEngine-ScriptCore/Source/StarEngine/InternalCalls.cs Replaced extern/internal call methods with delegate* function pointers for Coral interop.
StarEngine-ScriptCore/Source/StarEngine/Scene/Application.cs, ConsoleLog.cs, ... Added new static classes for application info and logging.
StarEngine-ScriptCore/Source/StarEngine/Math/Mathf.cs, Interpolate.cs, Random.cs, ... Added math helpers, interpolation, and random number utilities.
StarEngine-ScriptCore/Source/StarEngine/Scene/AssetHandle.cs Introduced AssetHandle struct for asset management.
StarEngine/src/StarEngine/Scripting/ScriptEngine.cpp, ScriptEngine.h, ScriptGlue.cpp, ... Major refactor: removed Mono, integrated Coral runtime, updated glue and reflection, new script metadata and instance management.
StarEngine/src/StarEngine/Scripting/ScriptEntityStorage.h, ScriptEntityStorage.cpp Added script field/entity storage system for managed field data.
StarEngine/src/StarEngine/Scripting/ScriptFile.h Added Script asset class for script file management.
StarEngine/src/StarEngine/Asset/Asset.cpp, Asset.h, AssetImporter.cpp, AssetImporter.h, ... Enabled ScriptFile and Audio asset types, updated importers, and asset extension maps.
StarEngine/src/StarEngine/Scene/Scene.cpp, Scene.h, Entity.h, ... Added entity lookup by tag/ID, pause/physics gravity controls, script storage, and transition callbacks.
StarEngine/src/StarEngine/Scene/SceneSerializer.cpp Refactored script field serialization/deserialization to use script handles and metadata.
StarEngine/src/StarEngine/Utils/Hash.h, TypeInfo.h Added FNV hash and type demangling utility headers.
StarEngine/src/StarEngine/Core/Buffer.h, UUID.h, ... Enhanced buffer utilities, added UUID conversion operator.
StarEngine/src/StarEngine/Scripting/ScriptableEntity.h Removed legacy ScriptableEntity base class.
StarEditor/src/Panels/SceneHierarchyPanel.cpp, EditorLayer.cpp, ... Refined script component UI, entity deletion, and script reload logic.
StarEngine/src/StarEngine/Scripting/CSharpObject.h Added CSharpObject wrapper for managed Coral object invocation.

Sequence Diagram(s)

sequenceDiagram
    participant Editor as EditorLayer
    participant Project
    participant ScriptEngine
    participant CoralHost as Coral Host
    participant Scene
    participant ScriptStorage

    Editor->>Project: ReloadScriptEngine()
    Project->>ScriptEngine: Shutdown()
    Project->>ScriptEngine: Initialize(project)
    ScriptEngine->>CoralHost: InitializeHost()
    ScriptEngine->>CoralHost: LoadProjectAssembly()
    ScriptEngine->>ScriptEngine: BuildAssemblyCache()
    ScriptEngine->>Scene: SetCurrentScene()
    ScriptEngine->>ScriptStorage: SynchronizeStorage()
Loading
sequenceDiagram
    participant Entity
    participant ScriptStorage
    participant ScriptEngine
    participant CoralHost

    Entity->>ScriptStorage: InitializeEntityStorage(scriptID, entityID)
    ScriptStorage->>ScriptEngine: GetScriptMetadata(scriptID)
    ScriptEngine->>CoralHost: GetTypeByName()
    ScriptStorage->>ScriptStorage: InitializeFieldStorage(fieldID, metadata)
    Note over ScriptStorage: Field buffers allocated and default values set
Loading

Poem

A rabbit hopped through Coral's gate,
Bidding Mono a gentle adieu,
With vectors, math, and scripts anew,
The engine now can calculate,
And script its world, both fast and true!
So code on, friends, with fluffy cheer—
The future's bright, the carrot's near! 🥕

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai bot added a commit that referenced this pull request Jun 24, 2025
Docstrings generation was requested by @sheazywi.

* #18 (comment)

The following files were modified:

* `StarEditor/src/EditorLayer.cpp`
* `StarEditor/src/EditorLayer.h`
* `StarEditor/src/Panels/SceneHierarchyPanel.cpp`
* `StarEngine-ScriptCore/Source/StarEngine/FrameTime.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Input.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Math/Interpolate.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Math/Mathf.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Math/Matrix4.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Math/Random.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Math/Vector2.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Math/Vector3.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Math/Vector4.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Scene/AssetHandle.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Scene/Components.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Scene/ConsoleLog.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Scene/Entity.cs`
* `StarEngine-ScriptCore/Source/StarEngine/Scene/Scene.cs`
* `StarEngine/src/StarEngine/Asset/Asset.cpp`
* `StarEngine/src/StarEngine/Asset/Asset.h`
* `StarEngine/src/StarEngine/Asset/AssetImporter.cpp`
* `StarEngine/src/StarEngine/Asset/AssetImporter.h`
* `StarEngine/src/StarEngine/Asset/EditorAssetManager.cpp`
* `StarEngine/src/StarEngine/Asset/SceneImporter.cpp`
* `StarEngine/src/StarEngine/Asset/SceneImporter.h`
* `StarEngine/src/StarEngine/Core/Application.cpp`
* `StarEngine/src/StarEngine/Core/Base.h`
* `StarEngine/src/StarEngine/Core/Buffer.h`
* `StarEngine/src/StarEngine/Core/UUID.h`
* `StarEngine/src/StarEngine/Physics/ContactListener2D.cpp`
* `StarEngine/src/StarEngine/Project/Project.cpp`
* `StarEngine/src/StarEngine/Project/Project.h`
* `StarEngine/src/StarEngine/Scene/Entity.h`
* `StarEngine/src/StarEngine/Scene/Scene.cpp`
* `StarEngine/src/StarEngine/Scene/Scene.h`
* `StarEngine/src/StarEngine/Scene/SceneSerializer.cpp`
* `StarEngine/src/StarEngine/Scripting/CSharpObject.h`
* `StarEngine/src/StarEngine/Scripting/ScriptEngine.cpp`
* `StarEngine/src/StarEngine/Scripting/ScriptEngine.h`
* `StarEngine/src/StarEngine/Scripting/ScriptEntityStorage.cpp`
* `StarEngine/src/StarEngine/Scripting/ScriptEntityStorage.h`
* `StarEngine/src/StarEngine/Scripting/ScriptFile.h`
* `StarEngine/src/StarEngine/Scripting/ScriptGlue.cpp`
* `StarEngine/src/StarEngine/Scripting/ScriptGlue.h`
* `StarEngine/src/StarEngine/Utils/Hash.h`
* `StarEngine/src/StarEngine/Utils/TypeInfo.h`
Copy link

coderabbitai bot commented Jun 24, 2025

Note

Generated docstrings for this pull request at #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant