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

Implement "EnvironmentManager" #196

Closed
steffen-wilke opened this Issue Dec 8, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@steffen-wilke
Copy link
Collaborator

steffen-wilke commented Dec 8, 2018

At the moment, there is no clear way to manage multiple environment instances in the engine. You always have to write something like a GameManager that handles the access to multiple environments and e.g. keeps their instances in a list. Also, the Game class currently contains methods and callbacks for when an environment was loaded. This should not be part of the Game class directly.

Scripting some additional map behavior (e.g. onEnter, onExit, update, ...) also requires additional infrastructure. For every game that we've written with the LITIengine so far, we've always had a slightly different approach to that but the general requirement for such a unit was always there.

We should implement an EnvironmentManager (name still up-for-discussion) that provides a basic backbone for managing all environments in the game without limiting the current possiblities. This would:

  • make the engine more accessible to new devs
  • separate the Environment logic from the Game class
  • make it possible to provide a tested an well tought out infrastructure for a problem that somehow exists in any game with more than one Map

@steffen-wilke steffen-wilke self-assigned this Dec 8, 2018

@steffen-wilke steffen-wilke added this to the v0.5.0-beta milestone Dec 8, 2018

@TheRamenChef

This comment has been minimized.

Copy link
Collaborator

TheRamenChef commented Dec 8, 2018

This will probably require a reference to the environment be added to the entity framework.

steffen-wilke added a commit that referenced this issue Dec 18, 2018

Move the environment and camera API to the GameWorld class.
This can now be accessed via
 - Game.world().camera()
 - Game.world().environment()

Issue #196

steffen-wilke added a commit that referenced this issue Dec 18, 2018

Enhanced the GameWorld implementation
Add a lot of API sugar that e.g. allows to load/get environments by a map/name or register listeners for a particular mapname.
Improve environment event handling.
Simplify the naming of the listener callback methods.
Add basic unit tests for listeners.
Issue #196
@steffen-wilke

This comment has been minimized.

Copy link
Collaborator

steffen-wilke commented Dec 18, 2018

Currently, nothing is preventing an Entity from being added to multiple Environments at once. If we're providing such a backreference we should maybe also ensure that it can be only present on one Environment at a time which is probably a good idea anyway.

Adding something like Entity.getEnvironment() would simplify some implementations or even enable some new workflows. Right now, the whole process is really limited to the currently active Environment.

@TheRamenChef Do you have any particular use-cases in mind?

@TheRamenChef

This comment has been minimized.

Copy link
Collaborator

TheRamenChef commented Dec 18, 2018

Currently, I have an issue in my project where the screen flickers when the environment changes. I know how I could fix it, but it would require an Entity.getEnvironment method to resolve entity references when the environment is loading but not yet displayed to the player.

steffen-wilke added a commit that referenced this issue Dec 18, 2018

Add a reference from entity to the environment
Also ensure that the entity is only present on one environment at a time.
Issue #196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment