glitchassassin / screeps-cartographer

Cartographer is an advanced (and open source) movement library for Screeps
29 stars 8 forks source link

Simulation room was causing crashes because "sim" is not a valid room name #53

Closed Emyrk closed 7 months ago

glitchassassin commented 7 months ago

Supporting sim properly would involve more changes than this (such as in how positions are packed). Because accommodating those changes would increase complexity of the codebase, we recommend developing with Cartographer in a private server instead of sim.

Emyrk commented 7 months ago

@glitchassassin appreciate the quick response!

I have been using a fork using those changes in a sim room. Would a "cheap" solution be to just dynamically rename "sim" to some proper room name?

glitchassassin commented 7 months ago

Cartographer also references the encoded room in the internal __packedPos property of RoomPositions, e.g.:

https://github.com/glitchassassin/screeps-cartographer/blob/c24e22a92b99e3191db13e07b192088852daabbd/src/lib/Movement/roomPositions.ts#L27

https://github.com/glitchassassin/screeps-cartographer/blob/c24e22a92b99e3191db13e07b192088852daabbd/src/utils/packPositions.ts#L25

I don't know at what point you'd start running into more issues, but Cartographer is open source, so you're welcome to fork and experiment!

Emyrk commented 7 months ago

I will play around, I'm very new to screeps. Your blog posts have inspired me.

Sim has been easier for me to just spawn things in. I have mocks and things setup, but easier for me to test behavior in an actual instance. There are a lot of undocumented (at least from what I can tell) behaviors. One that seems simple is 2 creeps can "swap" positions. I was not sure if that would be considered a "blocked" square before I tested it.