wowserhq / wowser

World of Warcraft in the browser using JavaScript and WebGL
MIT License
238 stars 63 forks source link

Refactor GameScreen and WorldHandler #148

Open fallenoak opened 8 years ago

fallenoak commented 8 years ago

GameScreen is potentially a not-so-great place to set up the renderer and camera.

For starters, as rendering gets more sophisticated (for instance, if we begin to use multiple render passes), the WorldHandler will need to dip in to the GameScreen to interact with the renderer, or vice versa.

Additionally, at present, the initialization of WorldHandler begins loading a map-- prior to logging in or otherwise starting to interact with the game. It'd be better if the world didn't begin to load at least until the game screen is selected from the screen dropdown.

An alternative approach to this is outlined below.

Progress

fallenoak commented 8 years ago

@timkurvers Any thoughts on this?

fallenoak commented 8 years ago

I've started playing around with this idea here: https://github.com/fallenoak/wowser/tree/refactor/world-handler

I'm definitely liking the idea of moving anything relating to camera / rendering logic out of GameScreen and into a dedicated WorldRenderer.

Down the road, we could conceivably create a few more renderers unique to other contexts-- such as MenuRenderer and PortraitRenderer.

timkurvers commented 8 years ago

Fully :+1: on all of this. I might have a peek at some of the main menu or introduction cinematics, where this would definitely come in handy.