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 begeeben

I'm building mini games with localization and multiple themes. We'll have images and sounds for multiple languages, and every theme has to be multi-language supported. In order not to preload unnecessary resources in the game, what I come up with is giving every different theme and language a game instance with only the resources it needs. For example:

The folder structure is like:
/lib/game/tictactoe/christmas/TictactoeChristmasEN.js
/media/tictactoe/christmas/en/

Each game module is designed like:

ig.module( 
  'game.tictactoe.christmas.TictactoeChristmasEN'
)
.requires(
  'impact.game'
)
.defines(function(){

  TictactoeChristmasEN = ig.Game.extend({

  });
});

game.main will be like:
ig.module(
  'game.main'
)
.requires(
  'impact.game',
  'impact.font',

  'game.tictactoe.christmas.TictactoeChristmasEN',
  'game.tictactoe.halloween.TictactoeHalloweenEN',
  'game.pong.christmas.PongChristmasEN',

  ..... keep going
)
.defines(function() {

});

It bothers me that the only different thing is the resources for different themes and languages, the game logic will be all the same. Doing this doesn't seem right to me.

Is there a better way to structure it?

1 decade ago by Joncom

You could create several modules, such as:

christmas.js, halloween.js, english.js, japanese.js, etc.

And then each file would look something like:

ig.module( 

  'game.christmas'

)

.requires(

  // Require here all the resources you want.

)

.defines(function(){

  // Load up any fonts, audio, images you want available too.

});

Then in main.js, only require the language and season you want.
Page 1 of 1
« first « previous next › last »