Achievements: what's the best way?

debugdesigndebugdesign Member Posts: 886
edited November -1 in Working with GS (Mac)
I have got to grips with the attributes 'integer' and 'real' and kind of understand 'boolean' (true or false) but i was wondering how best to use attributes in getting achievements.

For example, I have a top down shooter and if I wanted a 'tank killer' achievement I guess I would create an attribute called tank-killer and make it an integer. If the player destroys a tank it's +1 and at the end. If the player has <10 then spawn actor 'tank killer' on the end screen.

If I have to do this for 10+ achievements then it could start to get code heavy.

Has anyone found a streamlined way if doing this action as I am very aware of file size now after I couldn't submit a competition entry due to being over 10mb.

Thanks

p.s game salad is great but it's so unstable I have to save every 5 mins and reboot it every 2 hrs

my ideal improvement would be a drop down next to 'home' and 'scene' called 'actors' so I can jump to any actor with one click instead of two.

Comments

  • rebumprebump Member Posts: 1,058
    The way you are doing it is the way it currently needs to be done. I would set game level attributes for the achievments target values (i.e. game.TanksNeededForTankKiller = 10). It would make adjusting those levels everywhere much easier later on (i.e. you feel killing 10 tanks in your new version is too easy due to a new player weapon you added so just update that one game level attribute to 20 and you are done with that piece of the update).

    Then you would have another attribute set (where it seemed proper to place them but likely game level again) that would be your counters for how many of what or whatnot have occured during the current play (this correlates to your "tank-killer" attribute you mention). Whatever triggers an achievement action (i.e. an enemy kill, a long jump, a sequence of events, etc.) would increment or update those attributes as you state and these would likely be done either at the actor level for simple counts (i.e. a tank actor increasing the tank kill counter before destroying itself) or likely a game level attribute for the other types of achievements I previously mentioned since they may involve multiple actors/actions.

    Some of this is a repeat of what you state but I just put forth another person's take for newbies reading the thread.

    Similar mechanisms would be employed for 1UPs/unlocks with an additional boolean (or counter depending on if they are stackable) attribute to denote the 1UP in action or available to use.
  • rebumprebump Member Posts: 1,058
    This kind of thing would be more elegantly handled in traditional programming languages by way of an associate array, dictionary, key-value (or key-object) table/array, hash table, etc. depending on the dev environment. The items in each construct being pointed to by the name/key values could be just a scalar value or even an object or structure, again, depending on the dev environment.
Sign In or Register to comment.