-
Notifications
You must be signed in to change notification settings - Fork 24
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
Allow use of plugin in a headless environment (node server) #478
Comments
@jfelsinger 100% agree with a headless mode! I've been working on an overhaul of the plugin here, and I think it'd make sense to roll this feature in #477 In this PR I'm making a new resource What if I add a parameter here?
Say more about this, is it just that Bun/Node other server environments will want to load files differently than ajax? |
I think that's perfect. Cleaner than the split-out options that I did.
I'll link my implementation here for reference, even though it's a little ugly. jfelsinger/excalibur-tiled@main...headless-node-tiles#diff-c5a009df77af4b093f977e8a8e32e289c702a8930b262c70950b71e001c2fb6dR58 But, for what you said, mainly, yes. If someone is running in Bun/Node the files are likely going to be right there on the machine, so being able to use a Loadable that loads them from the file system is going to be cleaner/faster than ajax. The other problem though is that The solution I implemented on my fork was just to replace the instances of |
Context
Tiled maps can contain a lot of useful information for game state, actors, colliders, etc. For a game system that communicates back to a server for game state (see: excaliburjs/Excalibur#2759) it seems that it could be useful to have all the of the map data also loadable on the server.
This plugin already does the heavy lifting of parsing, creating actors, and colliders for tiled map data, but it also does a lot of lifting in loading graphics and animations, which is a lot of overhead that a server or headless environment probably doesn't need or care about and often doesn't support.
Proposal
To make this plugin work in a server or headless environment. To add options that can be set to skip the loading of the graphics/sprite/animation components for this plugin; also, to provide a method of changing how the tiled plugin loads resources to not always be reliant on an Excalibur Resource specifically.
I needed this functionality for my own personal project, and have already implemented on a fork, but it's pretty rudimentary, and I'm not sure if it jives as a proper way to implement this to a wider-audience, but...
Interface-wise, I went with something like this:
My initial implementation for a way to replace to ingrained
Resource
dependency could be a lot less messy with better typing, but is working to allow using bun/node to fetch resources. ie:The text was updated successfully, but these errors were encountered: