Open jhanschoo opened 2 years ago
Edited issue: Scene -> VnScene to avoid confusion with Phaser Scene
classes.
Also consider an approach by extending GameObject
: https://blog.ourcade.co/posts/2020/organize-phaser-3-code-game-object-factory-methods/
You can check out https://github.com/ennacord/phaser3-experiments/tree/main/text-animation 's DialogLine
for reference, since I just integrated it to GameObject
and GameObjectFactory
. The type declaration stuff with TypeScript (for extending library types) is quite difficult to use, don't hesitate to ping me if you need help with that
will do, thanks!
The task is to well-architect the part of the game as it relates to orchestrating scenes of a VN, by focusing on creating a VnScene class.
Class Design:
VnScene
class may have a constructor into which providers are injected, but it's OK to leave this part of the VnScene API underspecified (i.e. consider hardcoding the game objects that the vnscene manages, rather than worry about injecting them) for the experiment.VnScene
class should implement anUpdatable<T extends SpecificType>
interface, so that it has an.update(message: T)
method. It then acts based on the message received, as well as perhaps delegates messages (with potential transformation) to its member objects (e.g. dialog object, stage object (manipulating character sprites on the screen, etc.).SpecificType
above should be chosen to include (for now, and for this experiment), raw key and mouse state and input, as well as game tick information. In a more elaborate architecture we may revise this to receive more semantic messages.Demo implementation:
In addition to the above, also implement some simple input-dependent behavior upon update (and possibly creation) in the vnscene's subobjects (don't have to actually represent dialog/stage/etc., just some basic feedback). Instantiate a vnscene object as a member of the
Game
singleton during game loading, and hook the vnscene'supdate
to be called by the game'supdate
method. Then verify that the game ticks and user input get propagated down to the vnscene's subobjects by observing their feedback.Further details:
When completed, a working Phaser3 game instance should exist in a top-level folder
vnscene
that contains theVnScene
class invnscene.ts
, anUpdatable
interface intypes/updatable.ts
(under appropriate folder hierarchies if desired or necessary), and various dummy classes that will be instantiated into dummy member objects of avnscene
object.