FreezingMoon / AncientBeast

The Turn Based Strategy Game/eSport. Master your beasts! 🐺
https://AncientBeast.com
GNU Affero General Public License v3.0
1.68k stars 585 forks source link

load only the necessary assets #678

Open DreadKnight opened 10 years ago

DreadKnight commented 10 years ago

After upgrading to Phaser 3 #1584 we'll be able to optimize things by only loading the necessary assets, so no sprites for all the units and so on, because some of the units might not even show up in a match and eventually there could be too many units, especially if animated #1692, examples https://labs.phaser.io/index.html?dir=loader/loader%20events/&q=

DreadKnight commented 9 years ago

Phaser 2.3.0 was released recently that has improvements to the loader which could allow us to have materialized units to only be loaded when needed, which will make the initial loading of the game faster. http://phaser.io/download/release/2.3.0

DreadKnight commented 8 years ago

Unit wise related, only assets for Dark Priests should be loaded initially and the static sprites (being called cardboards) for the creatures themselves. Extra unit specific assets should be loaded while a new unit has been materialized and it still hasn't had its first turn thanks to the materialization sickness, which should not be avoidable gameplay wise, as it will be not only a gameplay element but an important technical one too. An example http://examples.phaser.io/_site/view_full.html?d=loader&f=load+events.js&t=load%20events

DreadKnight commented 8 years ago

Eventually, not all players will have all the units, so the game should be smart and interpolate between the available ones and only load the cardboard for those, especially the ones that belong to all of the players.

DreadKnight commented 8 years ago

The cardboards not common for all players could probably even be loaded after the game starts.

Eventually tendencies of registered players could be established, as they'll be more likely to materialize certain units, which could be prioritized. In gales like League of Legends, you gain mastery levels for each individual champion you play.

If certain players can't materialize specific units due to the amount of plasma they have, those could be excluded as well.

So basically creating a smart algorithm getting to the gameplay asap while keeping it rather light by loading things the smart way could help out a lot down the line when the game will have about 150 units or more.

DreadKnight commented 8 years ago

http://stackoverflow.com/questions/34212843/phaser-how-to-load-assets-after-preload