0 Favourites

How do I store local co-op RPG elements

  • I'm creating a local co-op RPG game, up to 4 players can choose from up to 10 characters (each with their own move sets) I need to store/persist player variables like:

    -Level

    -Character Name

    -XP

    -Money

    -Base Health

    -Base Damage

    -Ability 1 Level

    -Ability 1 upgrades

    -Ability 2 level

    -Ability 2 upgrades

    -Ability 3 level

    -Ability 3 upgrades

    -Ability 4 level

    -Ability 4 upgrades

    -Armor Piece 1

    -Armor Piece 2

    -Armor Piece 3

    -Armor Piece 4

    -Armor Piece 5

    and probably more that I cant think of. Should I make 1 array to store all this information for all 4 players, 1 array per player, or 1 array per character? I need them to persist through layouts, and I might possibly need them to save between play sessions as well.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • If i understand it right, i would try making an array for each player and then when it comes time to play or make a new game with the player just have a function to call for when a specific character is chosen and then populate the array based on that so that you would be dealing with 4 array instead of ten array and having to erase them every time.

    And then for the rest If i remember right there are some value that should be stored in array and then in dictionary. Not sure what is best used. Im working on a system myself but its just for one character atm. as for persist you can just set the array to global. Saving the game is one area i have no explored yet.

  • If i understand it right, i would try making an array for each player and then when it comes time to play or make a new game with the player just have a function to call for when a specific character is chosen and then populate the array based on that so that you would be dealing with 4 array instead of ten array and having to erase them every time.

    And then for the rest If i remember right there are some value that should be stored in array and then in dictionary. Not sure what is best used. Im working on a system myself but its just for one character atm. as for persist you can just set the array to global. Saving the game is one area i have no explored yet.

    thanks! That's what I'll do then! I'll do a player 1-4 array. And assign the player's variables on each start of the screen based off of the global array.

  • If all four players have the same amounts/types of information, I would just use a single array. But that depends on how comfortable you are using arrays and their expressions I suppose. It could compact your event sheet significantly, but at the same time make it harder to read or understand.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
245 26,019
Ashodin's avatar
Ashodin
Unread hot topic Locked topic
223 15,831
Tom's avatar
Tom Construct Team Founder
Unread hot topic
163 20,240
iBarin's avatar
iBarin