Skip to content
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

feat: Add C# scripting support #667

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

pacampbell
Copy link
Collaborator

@pacampbell pacampbell commented Dec 20, 2024

  • Added Roslyn to the project.
  • Added an example of parsing game logic settings from a .csx file.
  • Made GameLogicSettings.csx hotloadable.
  • Adjusted exp point modifier settings for enemies and quests to be
    hotload friendly.
  • Implemented a ScriptModule interface for GameServer scripts.
  • Enabled ScriptModule to be hotloaded for OnChanged and OnCreate events.
  • Converted extended NPC facilities into scripting .csx files for each NPC.
  • Created a mixin module to hold functionality of generic configurable actions
  • Added a stub exp mixin for dynamically calculating exp for a given enemy.

Checklist:

  • The project compiles
  • The PR targets develop branch

@pacampbell pacampbell force-pushed the scripting_experiment branch 5 times, most recently from 81551e3 to 5740041 Compare December 21, 2024 04:06
- Added Roslyn to the project.
- Added an example of parsing game logic settings from a .csx file.
- Made GameLogicSettings.csx hotloadable.
- Adjusted exp point modifier settings for enemies and quests to be
  hotload friendly.
- Implemented a ScriptModule interface for GameServer scripts.
- Converted extended NPC facilities into scripting .csx files for each
  NPC and made directory hotloadable. New NPC options can be added after
  the server starts without a restart.
@pacampbell pacampbell marked this pull request as ready for review December 21, 2024 20:09
Replaced File.ReadAllText with Util.ReadAllText.
Moved game logic settings from the server settings object.
- Refactored code so implementation can be shared between Server and
  DdonGameServer.
- Moved settings into settings module and implemented an example using a
  less structured scripting module interface.
- Created new ScriptableSettings class to assist with interacting with
  non-structured settings module.
- Created README.md files for suggestions and guidelines for module
  implementation.
@pacampbell pacampbell requested a review from alborrajo December 23, 2024 22:44
return SettingsData.Get<T>("GameLogicSettings", key);
}

public T Get<T>(string scriptName, string key)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The getters in this file are simply for compatibility with what currently exists. I've used a different pattern for some of the new code I wrote for this PR as well.

- Created a new 'game_item' module.
- Created RookiesRing.csx in the 'game_item' module.
- Moved Rookie's Ring settings from general server logic to specific
  RookiesRing.csx settings file.
- Implemented a new 'constant' and 'dynamic' mode for the Rookie's Ring.
- Added a new option to completely disable the Rookie's Ring.
Added a mixin module which is used to collect various scripts which
implement common functionality shared across the server and other
scripts.
}
else
{
baseEnemyExp = enemyKilled.GetDroppedExperience();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed i have opinions. We could take this chance to make the exp value in the json nullable. If its null, use the calculated value, if its not, use the json value. A setting could toggle whether these custom values are used or not 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is going to make exp previews in DDOn Tools a total nightmare to deal with

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How hard what it be to have a way to configure default exp calculation by the user? Does Godot have an evaluate feature where we can provide some code in an input box or something in the settings?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm almost sure it's possible to do, but the problem is that you'd have to port over whatever your server has set up to Godot's script for DDOn Tools 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants