• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM DS_Grid based Character Creator

Dragula5892

Member
Hello everyone, I'm trying to make a character creator today and I need a bit of help, I've set up my character creator to be kind of like a crafting system, you can select up to three species to fuse into one character and an image will be displayed accordingly, i've figured a global DS_Grid would be of help here, a character can be of either a single, double, or triple fusion of species, meaning you can go with just a human, a human/rabbit, or even a human/rabbit/octopus, however, I added in 32 species to use, meaning about 96 unique images to display and about 3072 combinations in total without counting duplicates, i need help checking through the grid and checking for parts no matter where they are in the selected tree and display the according image. i've managed to get a loop through easily, but i don't know what to use to check, and i really don't want to have to input 3072 combination into a database to call on later. Also, the selection tree is stored within a global array.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I confess to not being entirely sure what you are doing here... What is the structure of the grid (ie: what information does it hold)? How does the grid relate to the way the species "fuse"? If all you are doing is storing sprite IDs then when the player selects one, set a global array to the cell position of the required sprite then draw only that sprite (no need for any loops).
 

Dragula5892

Member
Basically, the global array sets a goal for the global grid to check, if the goal is met in any order, the sprite based off the selected species will be drawn, the grid holds string values to check through after you select your species to fuse and press a button to generate the image.

I apologize if this makes little or no sense, i'm quite tired at the moment, i'll get back to this later when i'm more coherent
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Hmmm... Yeah, maybe show the code? I'm still not sure what you're doing!!!! :)
 

NicoFIDI

Member
This might help or maybe not, not sure
First i wont use a grid to a 3 dimention value,
Second i'm too lazy to make a 3 leaf tree (what will help in this case)
so i propose this thing i came out :D

---------script
Code:
/// getRaceKey(race1,race2,race3)
var minRace =    min(argument[0],argument[1],argument[2]);
var midRace = median(argument[0],argument[1],argument[2]);
var maxRace =    max(argument[0],argument[1],argument[2]);

return minRace+','+midRace+','+maxRace;
----------on create
Code:
/// Initilitation
race_1 = 0;
race_2 = 0;
race_3 = 0;

enum race_type {
    raceless = 0,
    human = 1,
    octopus = 2,
    bunny = 3,
    graveyard = 4,
    sara_sarasasa_lara_laralara = 5
}

// fill the array with an array with an array
images = ds_map_create();

images[? getRaceKey(race_type.raceless,race_type.raceless,race_type.raceless)] = noone;
images[? getRaceKey(race_type.human,race_type.raceless,race_type.raceless)] = spr_human;
images[? getRaceKey(race_type.human,race_type.octopus,race_type.raceless)] = spr_human_octopus;
.... all your images
then in the game you fill race_1,race_2 and race_3 (that's the annoying part)
after you fill that

Code:
var race_image = images[? getRaceKey(race_1,race_2,race_3)].id;
this will have all the heavy calculation into the initialization code then get the race image it's almost instantaneous.

also, you have no need to worry about the repetition, or the order of the races

dont forget to release map memory when you have to
 
Last edited:
Top