Skip to content

feat: (377) Instances v1 + general engine improvements#95

Open
mark-b5 wants to merge 18 commits into
LostCityRS:377-wipfrom
mark-b5:377-instances
Open

feat: (377) Instances v1 + general engine improvements#95
mark-b5 wants to merge 18 commits into
LostCityRS:377-wipfrom
mark-b5:377-instances

Conversation

@mark-b5
Copy link
Copy Markdown
Contributor

@mark-b5 mark-b5 commented May 17, 2026

377 specific

  • Forward port typescript rspathfinder to 377 branch

General engine improvements (will be merged individually into 284)

  • NPC spawn triggers check if NPC still exists before running
  • NPCs will no longer set collision on initialization
  • Zones do not dynamically allocate after world start. Instead, zones are only allowed to be created during world initialization (and later, for instances)
  • zone, zoneexit, mapzone, and mapzoneexit triggers are now queued from player movement, rather than being handled during the network layer

Instances (will be reviewed and backported into 300+)

  • There is now an instanceController singleton child of World which handles tracking, allocating, and destroying instances

  • There is a child class of zone, instanceZone, which is a zone that stores copy flags from another zone to send to client

  • Engine sends out rebuild_region packet to client

  • The following commands are implemented:

    • region_create(int $levels, int $zonesEast, int $zonesNorth); allocates a new instance of size $levels*$zonesEast*$zonesNorth and sets it as the active region
    • region_set(int $destLevel, int $destEast, int $destNorth, coord $sourceCoord, int $rotation); copies the source zone into the active region at zone offset ($destEast, $destNorth) on floor $destLevel, rotated by $rotation
    • region_getcoord(int $levelOffset, int $xOffset, int $zOffset); returns a coord inside the active region at tile offset ($xOffset, $zOffset) on floor offset $levelOffset
    • region_findbycoord(coord $coord); finds the instance containing $coord, sets it as the active region, and returns 1 if found or 0 if not found
    • region_uid(); returns the uid of the active region
    • region_findbyuid(int $uid); finds the instance with uid $uid, sets it as the active region, and returns 1 if found or 0 if not found
    • region_setexitcoord(coord $exitCoord); sets the exit coord used when leaving or recovering from the active region

    Needed compiler changes

    • When it's time to implement instances on 300, we need to implement region_uid type. Right now they are ints

markb5 and others added 18 commits May 12, 2026 19:55
This should help Bun-Windows users with their startup/cycle times. WASM allocations are performing terribly.

I tried to keep this API-compatible so that later we can let users pick between Rust or TS based on their performance concerns. Soon the same treatment for rsbuf.
Will need to do some tests to make sure nothing is off by a hair.

Funny history here...
Kotlin -> JS/TS -> Rust -> TS

(cherry picked from commit 55eccdc)
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