Skip to content
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

Introduce generic enemy class caches to reduce intermap change loading times. #979

Closed
stefanbeller opened this issue Sep 17, 2012 · 2 comments
Labels

Comments

@stefanbeller
Copy link
Collaborator

As of now the map change takes quite long because of loading data.

This is because every enemy instance loads and parses the config files on its own.
So the more enemies the longer it takes to load.

We should load one enemy type only once and any created instance of that type will just copy the memory of the preloaded type. The only adjustments to be made are the position and direction?

@clintbellanger
Copy link
Owner

Position and direction are the only differences, as far as I know.

This mechanism needs to be in the EnemyManager, when it's reading the new enemy queue from the Map object.

The way I planned to do it: before loading an enemy file, check to see if we've already loaded this enemy type during this map. If so, create a copy of those values instead of loading the same file(s) again from disk. Starting from a blank cache and doing this process on each map load would be a big improvement. We sort of do something similar for the enemy art/sounds, but those have a single copy in EnemyManager anyway.

If we wanted to get fancier, we could keep base copies of the enemy info in EnemyManager even across map loads. Then after loading all creatures for a new map, dump enemies not used during this map out of the cache.

@stefanbeller
Copy link
Collaborator Author

This has been introduced in
https://github.com/clintbellanger/flare-engine/pull/10
Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants