Jump to content

Are states appropriate for open world map?


shockz13
 Share

Recommended Posts

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

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

  • 1 year later...

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...