- Joined
- Jul 10, 2007
- Messages
- 6,306
So, I've been working on 2.0.0.0 for my huge save/load system and I came up with this wonderful idea. You know how most save/load systems just take like all of your values or w/e and they are all static and in order? What if you had something like item charges? Items have different charges on them no? : O.
I thought, wouldn't it be cool if I could just store the max charge for specific items ^)^. So I came up with this linking idea.
First, you make all of your ranges (the min and maximum values of what can be in the game).
Next, you link! : D
In my demo map (untrue), all of the items can have up to 25 charges (def not true, I'm too lazy to go through a ton of items and look up their charges).
Woo. That'll make all items have 25 charges max in the code ;D.
What about a hero? Well, a hero has coordinates, facing, level, xp, stats, life, mana, and 6 items, so let's link! : D
Notice I've yet to add anything to the actual code >.>.
In my demo map, heroes also have 4 pets, so let's link them too.
And pets have x,y,facing,life, and mana.
So.. now on to actually adding to the encoder things... well, first let's add the resources cuz that's the biggest.
And now... the hero.
But wait, what about all of that other crap? It's all linked through the hero ;D.
And it should read out in that fashion. Essentially, you read the value and then you determine what to expect from the value. So all of those values would read in the order above. You read gold, you read lumber, you read hero which then points to all of the crap inside of it. When you get down to the pets, you go inside of each pet. All of the reads would just be
.
So what do you guys think of the new 2.0.0.0 features and syntax? I'm still coding the dern thing, but I think it's awesome.
Are there any other features you guys would want to see, or do you guys have any suggestions for improving my link idea? Maybe my link idea sucks, who knows. There could be a reason no save/load system has ever done it ;P.
I thought, wouldn't it be cool if I could just store the max charge for specific items ^)^. So I came up with this linking idea.
First, you make all of your ranges (the min and maximum values of what can be in the game).
JASS:
local CodeRange resource = CodeRange.create(0,1000000)
local CodeRange hero = CodeRange.create(1,HeroCount)
local CodeRange perc = CodeRange.create(0,100)
local CodeRange lvl = CodeRange.create(1,10)
local CodeRange xp = CodeRange.create(0,99)
local CodeRange stat = CodeRange.create(1,256)
local CodeRange item = CodeRange.create(1,ItemCount)
local CodeRange charge = CodeRange.create(0,25)
local CodeRange pet = CodeRange.create(1,PetCount)
Next, you link! : D
In my demo map (untrue), all of the items can have up to 25 charges (def not true, I'm too lazy to go through a ton of items and look up their charges).
call item.link(item.lowBound, item.highBound, charge) //charge
Woo. That'll make all items have 25 charges max in the code ;D.
What about a hero? Well, a hero has coordinates, facing, level, xp, stats, life, mana, and 6 items, so let's link! : D
JASS:
call hero.link(hero.lowBound, hero.highBound, perc) //x
call hero.link(hero.lowBound, hero.highBound, perc) //y
call hero.link(hero.lowBound, hero.highBound, perc) //facing
call hero.link(hero.lowBound, hero.highBound, lxl) //lvl
call hero.link(hero.lowBound, hero.highBound, xp) //xp
call hero.link(hero.lowBound, hero.highBound, stat) //str
call hero.link(hero.lowBound, hero.highBound, stat) //agi
call hero.link(hero.lowBound, hero.highBound, stat) //int
call hero.link(hero.lowBound, hero.highBound, perc) //life
call hero.link(hero.lowBound, hero.highBound, perc) //mana
call hero.link(hero.lowBound, hero.highBound, item) //item1
call hero.link(hero.lowBound, hero.highBound, item) //item2
call hero.link(hero.lowBound, hero.highBound, item) //item3
call hero.link(hero.lowBound, hero.highBound, item) //item4
call hero.link(hero.lowBound, hero.highBound, item) //item5
call hero.link(hero.lowBound, hero.highBound, item) //item6
Notice I've yet to add anything to the actual code >.>.
In my demo map, heroes also have 4 pets, so let's link them too.
JASS:
call hero.link(hero.lowBound, hero.highBound, pet) //pet1
call hero.link(hero.lowBound, hero.highBound, pet) //pet2
call hero.link(hero.lowBound, hero.highBound, pet) //pet3
call hero.link(hero.lowBound, hero.highBound, pet) //pet4
And pets have x,y,facing,life, and mana.
JASS:
call pet.link(pet.lowBound, pet.highBound, perc) //x
call pet.link(pet.lowBound, pet.highBound, perc) //y
call pet.link(pet.lowBound, pet.highBound, perc) //facing
call pet.link(pet.lowBound, pet.highBound, perc) //life
call pet.link(pet.lowBound, pet.highBound, perc) //mana
So.. now on to actually adding to the encoder things... well, first let's add the resources cuz that's the biggest.
JASS:
call encoder.add(resource) //gold
call encoder.add(resource) //lumber
And now... the hero.
call encoder.add(hero) //hero
But wait, what about all of that other crap? It's all linked through the hero ;D.
Code:
hero
x
y
facing
lvl
xp
str
agi
int
life
mana
item1
item2
item3
item4
item5
item6
pet1
x
y
facing
life
mana
pet2
x
y
facing
life
mana
pet3
x
y
facing
life
mana
pet4
x
y
facing
life
mana
And it should read out in that fashion. Essentially, you read the value and then you determine what to expect from the value. So all of those values would read in the order above. You read gold, you read lumber, you read hero which then points to all of the crap inside of it. When you get down to the pets, you go inside of each pet. All of the reads would just be
DataBuffer.read()
though, it does all of the crazy work for you So what do you guys think of the new 2.0.0.0 features and syntax? I'm still coding the dern thing, but I think it's awesome.
Are there any other features you guys would want to see, or do you guys have any suggestions for improving my link idea? Maybe my link idea sucks, who knows. There could be a reason no save/load system has ever done it ;P.