Sitelet https://github.com/kwakker35/SharpBasic/pull/2
Skip to content

Enhance The Sunken Crown with new mechanics, content, and refactoring - #2

Merged
kwakker35 merged 68 commits into
mainfrom
feat/the-sunken-crown
Apr 1, 2026
Merged

kwakker35 merged 68 commits into
mainfrom
feat/the-sunken-crown

Conversation

@kwakker35

Copy link
Copy Markdown
Owner

This pull request updates the SharpBASIC documentation and sample programs to reflect new language features, clarify existing behavior, and provide additional examples. The most significant changes include expanded documentation on global array mutation with SET GLOBAL, new built-in functions, improved identifier rules, and enhanced sample code demonstrating these features.

Language and Runtime Behavior Updates

  • Updated documentation to clarify the rules for identifier naming: underscores are allowed only between characters, not at the start/end or consecutively.
  • Expanded the explanation of scope and mutation for arrays: LET arr[i] = value inside a subroutine can only write to arrays declared in the current scope, and writing to global arrays inside subs must use SET GLOBAL arr[i] = value. Examples and error conditions are now included. [1] [2] [3] [4] [5]
  • Clarified that MID, LEFT, and `RIGHT now perform bounds checking and produce clean runtime errors, instead of crashing. [1] [2]

Built-in Functions and Statements

  • Added documentation and README references for new built-in functions: CINT, STRING, ASC, MAX, MIN, and CLAMP`. Updated the list of built-in functions and provided descriptions and examples for each. [1] [2] [3]
  • Added a new section documenting statement built-ins, such as SLEEP(ms).
  • Updated the sample string-utilities.sbx to demonstrate usage of ASC and `STRING, including round-trip conversions and variable counts.
  • Updated the sample arrays.sbx to demonstrate SET GLOBAL with 1D and 2D arrays from within subroutines.

Documentation and Samples Organization

  • Removed the placeholder capstone/README.md in preparation for future content.
  • Added a comprehensive "How to Play" guide for the Sunken Crown sample game, detailing commands, mechanics, and gameplay tips.
  • Updated README and sample references to accurately list and describe all built-in string functions and their usage in the samples.

These changes provide clearer guidance for SharpBASIC users, ensure the documentation matches the current interpreter behavior, and enrich the sample programs with practical demonstrations of new and updated features.

…iptions, monster encounters, atmospheric events, command responses, explanatory text, throne room special text, and gate resolution text.
…st plan

- Created issue-09-context.md detailing the Bound King encounter, including global variables, SUBs, and game mechanics.
- Created issue-10-context.md outlining the Gate sequence, including constants, global variables, and game flow.
- Added final-acceptance-test.md to verify the complete game functionality, covering startup, navigation, combat, inventory, and cross-system interactions.
…These files contained operational details for game mechanics, including global variables, subroutine logic, and exit states for various game scenarios. The removal is part of a cleanup process as the project progresses towards finalization.
…r behavior; enhance error handling descriptions
- Updated SetGlobalStatement to include optional Index and ColIndex for 1D and 2D array assignments.
- Modified Evaluator to handle both scalar and array assignments, including error handling for out-of-bounds indices and type mismatches.
- Enhanced Parser to correctly parse array indices in SET GLOBAL statements.
- Added comprehensive unit tests for 1D and 2D array assignments, including edge cases for out-of-bounds access and undeclared names.
- Issue 5: Implement combat system enhancements, including monster states and combat flags.
- Issue 6: Introduce inventory management with overburdened states and loot shuffling.
- Issue 7: Add atmospheric events and zombie mechanics, modifying combat interactions.
- Issue 8: Integrate traps and riddles, including riddle-solving mechanics and room interactions.
- Issue 9: Finalize the Bound King boss fight, including narrative updates and end state handling.
- Issue 10: Complete game flow with gate mechanics, win/loss conditions, and end screen statistics.
- General: Update global variables, reset logic, and improve command handling throughout the game.
- Changed local variable assignments to global for monsterAlive, visited, and exitHidden in various subs across multiple issues.
- Updated InitMonsters and InitExits subs to use SET GLOBAL for initializing room exits and monster states.
- Adjusted HandleFight and EnterRoom subs to ensure proper tracking of room visits and monster states using global variables.
- Ensured consistency in variable handling across the codebase for better state management.
@kwakker35
kwakker35 merged commit bd8c2ed into main Apr 1, 2026
1 check passed
@kwakker35
kwakker35 deleted the feat/the-sunken-crown branch April 1, 2026 20:40
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.

1 participant