xurxodiz / MarioLevels

My entry for the Mario AI Championship 2012, implementing adaptive procedural level generation. Holds 1st place at the all-time points and percentage tally.
MIT License
2 stars 1 forks source link

Parametrize chunk building functions #56

Closed xurxodiz closed 12 years ago

xurxodiz commented 12 years ago

A bit dumbly, for the sake of prettiness, genes call functions with no parameters, any of them.

Yeah that's not really scalable. Specially with the thousand different combinations of blocks and coins and enemies in each chunk.

So we're going to store in each gene, besides the function, the parameters it should use to call it.

xurxodiz commented 12 years ago

As an example, for the blocks thing.

There are four possible heights at which to place things:

(we could technically place things on the hovering over the hovering, but let's stop here)

so instead of having createEnemy and createEnemyCoins and createEnemyBlocksEmpty and createEnemyBlocksEmptyCoin, blah...

createStuff([what, to, place, where] {
  switch array.size:
    case 4:
       createHoverHover(array[3]) 
    case 3:
       createOnHover(array[2]) 
    case 2:
       createHove(array[1]) 
    case 1:
       createOnGround(array[0]) 

Look ma, no breaks!

xurxodiz commented 12 years ago

This is done for the ones already existing. New ones will be created in this model.