Skip to content

[BACKEND] New scripting backend using cppia #5087

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

Draft
wants to merge 19 commits into
base: develop
Choose a base branch
from

Conversation

lemz1
Copy link
Contributor

@lemz1 lemz1 commented May 14, 2025

Linked Issues

Closes #5077

Description

This pr changes the scripting backend from hscript to cppia.
cppia is more performant, more type-safe than hscript, and has much better haxe language support.

Note

A few scripts had some changes that i deemed necessary to mention, so just look in the scripts for // CPPIA:.

Make CPPIA Work Ideas

  • use dll_export / dll_import
  • write own custom macro (might be able to use it to block access to blacklistsed classes as well). macro needs to create a directory with all classes, but defined as extern.

Todo

  • port base game scripts
  • ship game with haxe compiler
  • make base game scripts work with cppia
  • figure out how to properly block access to blacklisted classes (maybe runtime checks in hxcpp?)
  • mod support

@github-actions github-actions bot added status: pending triage Awaiting review. pr: haxe PR modifies game code. size: medium A medium pull request with 100 or fewer changes. labels May 14, 2025
@lemz1 lemz1 changed the base branch from main to develop May 14, 2025 16:15
@lemz1 lemz1 marked this pull request as draft May 14, 2025 16:16
@AbnormalPoof
Copy link
Collaborator

HOLY
image

Comment on lines +80 to +81
"ref": "d914cac17779efad8b3aa6f4a12dff566518d1b9",
"url": "https://github.com/lemz1/hscript"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporary compilation fix
will be removed when we remove hscript entirely

@@ -503,7 +503,7 @@ class Project extends HXProject {
FEATURE_POLYMOD_MODS.apply(this, true);
FEATURE_FUNKVIS.apply(this, true);
FEATURE_PARTIAL_SOUNDS.apply(this, true);
FEATURE_VIDEO_PLAYBACK.apply(this, true);
FEATURE_VIDEO_PLAYBACK.apply(this, false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporary change to fix compilation issues

@@ -525,7 +525,7 @@ class Project extends HXProject {

// Should be true on desktop, release, non-tester builds.
// We don't want testers to accidentally leak songs to their Discord friends!
FEATURE_DISCORD_RPC.apply(this, isDesktop() && !FEATURE_DEBUG_FUNCTIONS.isEnabled(this));
FEATURE_DISCORD_RPC.apply(this, isDesktop() && !FEATURE_DEBUG_FUNCTIONS.isEnabled(this) && false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporary change to fix compilation issues

@Hundrec Hundrec added the type: enhancement Involves an enhancement or new feature. label May 14, 2025
@AbnormalPoof AbnormalPoof added the topic: mods Related to the creation or use of mods. label May 14, 2025
@EliteMasterEric EliteMasterEric added size: medium A medium pull request with 100 or fewer changes. and removed size: medium A medium pull request with 100 or fewer changes. labels May 14, 2025
@github-actions github-actions bot added size: large A large pull request with more than 100 changes. and removed size: medium A medium pull request with 100 or fewer changes. labels May 14, 2025
@github-actions github-actions bot added size: medium A medium pull request with 100 or fewer changes. size: large A large pull request with more than 100 changes. and removed size: large A large pull request with more than 100 changes. size: medium A medium pull request with 100 or fewer changes. labels May 15, 2025
Copy link
Collaborator

@AbnormalPoof AbnormalPoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to still have .hxc as an option for backwards compatibility?

@lemz1
Copy link
Contributor Author

lemz1 commented May 16, 2025

Would it be possible to still have .hxc as an option for backwards compatibility?

I dont know whether the haxe compiler supports different file extensions.
However, since scripts need to be renamed anyways, it wouldn't matter.

@github-actions github-actions bot added size: huge A huge pull request with more than 500 changes. and removed size: large A large pull request with more than 100 changes. labels May 20, 2025
@Hundrec
Copy link
Collaborator

Hundrec commented May 21, 2025

Promoted to huge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: haxe PR modifies game code. size: huge A huge pull request with more than 500 changes. status: pending triage Awaiting review. topic: mods Related to the creation or use of mods. type: enhancement Involves an enhancement or new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Replace HScript with cppia
4 participants