• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Save/load help

Status
Not open for further replies.
Level 5
Joined
Oct 17, 2006
Messages
151
Now before you go tell me to use the search button I will stop you there and inform you that I have and considerably... :mwahaha:

Here is my save/load system that I am working on:

You have a deck of cards (up to 8 decks) and the game remembers every single card inside the deck. The maximum number of units inside the deck is 82 I believe (could be 62 not sure I'm not at my pc right now).

When you type in the code needed it pulls all the units from a stored unit group (call it deck 1) and puts them out for you to see them inside preposition regions.

My questions:

How do you store variables and is it possible to store unit groups? (and how many)

Does this involve Jass and if so is it possible to be GUI (I prefer GUI).
 
Level 5
Joined
Oct 17, 2006
Messages
151
You can turn combinations or array variables of unit-types to integers.


It's possible to make it on GUI.
But easier - on Jass.
As it's very uncomfortable to work on GUI with arifmetic and substrings.

So the unit-type integers would basically be like:

Footman = 1
if integer = 1 then create footman

right?

And if that's the case what function is used to save integers? (GUI and Jass) Could I save a real instead? (that way I can represent the entire deck of cards in one variable and have it viewed like "a1-b2-c3-d4-etc...")

And what do you mean by arithmetic and substrings?
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Save/Load systems work by storing information into a string.

This information relates to data structures located within your map, whatever they may be. For example, you may have an array of unit types. If the string 1 appears in your string for the unit type, then it'll go to index 1 of your array and check to see what unit type that is.

Now, to conserve space and make codes smaller, and to add security, you need to do a few things.

First, you need to convert the base. Check out modulo mathematics for converting the base. This will ensure that your code is semi encrypted and is smaller. Most people use a base of 52 - 62. I use a base of 80.

Another thing you might want to consider is color coding and breaking up the code with dashes, underscores, etc.

Finally, you need to save in a specific order every time and read from that code in the order. You can scramble it or w/e, do whatever you want to the code, but the initial string has to be in that specific order or there will be no way to know what is what without doubling or tripling the size of your code.

Now, long ago I was working on a save/load system ^_-, but I never did finish it, but because of this I'm quite familiar with these.

Now, there's a difference between creating a system or creating bleh. Creating a system means that it can be used for anything so long as the anything uses the systems process. If you are just making an encryptor (save/load system), then you probably want to make it so that anything can use it.

Now, before making your own, check out some popular ones like Acehart's save/load system. It'll save you a lot of time. If you're really gung ho on making one, go for it : ).

Oh, and for security, be sure to at least use a checksum.
 
Status
Not open for further replies.
Top