Jump to content

Scene Interaction Advice Needed


Recommended Posts

I'm working on a Metroidvania where the game is composed of many rooms that are connected at the edges and can be accessed by the player crossing the boundaries. The player's state is retained between rooms. A long-term goal is to allow users to link their own custom rooms to their friends' rooms to create a network of rooms spanning multiple servers.

There are a lot of different steps in setting up something like this and I already have a sense of how to tackle each one, but I'm trying to be smart about it and use Phaser 3's new abilities to the best of their capacity so I don't duplicate efforts or shoot myself in the foot. One way I had considered doing it was to have a custom  parameterized scene class where each instance worked as its own room. There seem to be a few problems with this, however:

- It doesn't seem like scenes are designed for their game objects to interact with each other. This is important, because the player and certain other objects exist across multiple scenes, which means such objects may need to be kept in their own persistent scene that doesn't belong to any rooms.
- Scenes each want to have their own camera and seem to effectively render as independent visual layers. That won't work for me, since scenes need to appear connected at the edges during screen transitions, and may possibly need to be loaded and displayed simultaneously in certain situations.

Am I correct to be trying to use scenes this way, or is that beyond their scope? Would that help keep things organized and sensible to other Phaser developers looking at my code or would I just be creating a maintenance nightmare for myself?

The other alternative (which I am currently using) is to keep all content in a single scene, but create a Group instance for each room's game objects.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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