shockz13 Posted June 18, 2015 Share Posted June 18, 2015 The plan is to build a world made up of regions and when the user enters a certain area in a region it will place them in the next region and they can go back and forth at will. I want to do it this way because I plan to eventually implement socket.io to make it multiplayer and I only want to load the players in your current region. What is the best way to go about this? States looks like I would be creating and loading a seperate js file for each region and there may be upwards of 100 eventually. Is this even something that Phaser is appropriate for? Link to comment Share on other sites More sharing options...
Skeptron Posted June 22, 2015 Share Posted June 22, 2015 I don't think States are what you are looking for. I don't really know how to solve your problem, but States, for me at least, are built for game lifecycle, not it space representation : preload, load, start menu, ingame, end screen etc. Maybe you can achieve what you want with states, but it might be painful and dirty. What's more, I cannot really see how you can create states dynamicaly, and I expect you don't want to code 100 states for your 100 map parts. Link to comment Share on other sites More sharing options...
Styles2304 Posted January 15, 2017 Share Posted January 15, 2017 I would have each region be it's own json or something and then load them when requested in the main game file. That's just my inexperienced $0.02 though. -- EDIT -- Just saw the age of the first post...my bad. Link to comment Share on other sites More sharing options...
phreaknation Posted January 15, 2017 Share Posted January 15, 2017 Depends on what you want to do. If you plan to use JSON, then follow the minecraft way of using "chunks" which would be your JSON. I have achieved such with proc gen and maintaining sprites by limiting how much can be in the display group and destroying the older ones. There prob is a better way of doing this but since I am using the Iso plugin which can be heavy I figured that would be the best way.NOTE: Excuse the flickering as that is due to debugging the tiles. Also you will notice "ghost" tiles. Those are the preloaded tiles that are just hidden to allow for speedier loading of tiles. depending on movement speed and rendering you can do more or none at all. Link to comment Share on other sites More sharing options...
Recommended Posts