Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Snowleopard

not sure if this is a bug, or if I'm doing something wrong, but I thought I'd report it just in case. I've added a bunch of one element to my level, and I would think that it should be only required by the module once, but it's being repeated for each instance:

ig.module( 'game.levels.main' )
.requires('impact.image','game.entities.player','game.entities.rock','game.entities.rock','game.entities.rock','game.entities.rock','game.entities.rock','game.entities.rock','game.entities.rock','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses','game.entities.grasses')

...if I manually delete all of those it appears to still work fine. Wondering if there should be a check added to prevent this?

1 decade ago by monkeyArms

I don't know if the extra requires slow load execution, but I think they should definitely be removed.

In weltmeister.js, you can change these lines
			var requires = ['impact.image'];
			for( var i = 0; i < data.entities.length; i++ ) {
				requires.push(
					this.entities.entityClasses[ data.entities[i].type ]
				);
			}

to this

			var requires = ['impact.image'],
				requireName,
				doAdd;
			for( var i = 0; i < data.entities.length; i++ ) {
				requireName = this.entities.entityClasses[ data.entities[i].type ];
				doAdd = true;
				for( var j = 0; j < requires.length; j++) {
					if (requires[j] == requireName) {
						doAdd = false;
						break;
					}
				}
				if (doAdd) {	requires.push( requireName );	}
			}

1 decade ago by Snowleopard

nice. thanks for the fast response. hopefully that snippet gets included in the next impact release. cheers.

1 decade ago by dominic

Yeah, sorry about that. It's fixed in the recent dev version in the git repo.

Thanks!
Page 1 of 1
« first « previous next › last »