wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Systems
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 09-16-2006, 01:38 AM   #1
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default Optimal Save System 0.4

NOTE: You have been redirected in order for our attachments to be made available to you. This will only last two minutes; these measures where taken to avoid hotlinking and bandwidth theft.
To avoid these restrictions Log in or Register

Changelog:
0.4
Added a few unit tests
Various bug fixes including deallocation issue

0.3
Port to vJass. No more location lists.

0.2
fixed broken sample name hashing routine

0.1
initial release

I got tired of hand writing save systems from scratch for aftermath everytime we wanted to change a few values, so I wrote this automated system.
Features:
- Flexible. Can generate codes of any length using integer data from zero to around twenty nine million.
- *Space optimal. Guaranteed to pack your code into as few characters as mathematically possible, assuming all possibilities for saving are equiprobable
- Fast
- *Creates few excess strings
- Simple interface
- *Save code character sets can be any length
- Configurable hash checking: A random code will work with a probability you specify

* items are advantages over Vex's system. The main advantage of Vex's system is that it has been tested far more heavily.

It takes some of the hell out of hand tuning a homegrown save system which can take up a day even if you are familiar with the math involved.

If someone knows all the characters that are valid in a bnet name, please let me know.

Remember, the best you can hope for is helping honest users remain honest.
Attached Images
File Type: jpg savesmall.jpg (17.1 KB, 1501 views)
File Type: jpg savebig.jpg (38.1 KB, 1581 views)
Attached Files
File Type: w3x savecode.w3x (23.1 KB, 1118 views)
File Type: w3x savecodevjass.w3x (27.9 KB, 704 views)
__________________

Last edited by PipeDream : 10-06-2007 at 08:35 PM.
PipeDream is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 09-16-2006, 02:43 AM   #2
map-maker
I smell like 1337 sauce.
 
map-maker's Avatar
 
Join Date: Mar 2004
Posts: 500

Submissions (5)

map-maker will become famous soon enough (50)map-maker will become famous soon enough (50)

Send a message via AIM to map-maker
Default

letters a-z, numbers 0-9, _, -, ., are the only characters allowed in b.net names i believe.
__________________
Back to Wc3 after way too long.
map-maker is offline   Reply With Quote
Old 09-16-2006, 09:22 AM   #3
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

a!=A soo

a-z A-Z 0-9 and chars
DioD is offline   Reply With Quote
Old 09-16-2006, 08:07 PM   #4
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Checked the code and the only reason not to approve this or the heap are the screenshots or rather the lack of it. S= log of omega probably has a meaning but that really won't help here, could you make a simple screenshot of the generated code ? and for the arrays system take a screenshot of the array's code, better syntax highlighted and post that, cause that cow doesn't help as an screenshot.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 09-16-2006, 10:54 PM   #5
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

Sure. Those adequate?
Equation is a reference to information entropy. Number of chars required is proportional to the logarithm of the number of states your system can be in. This system is supposed to get that constant as small as possible.
__________________
PipeDream is offline   Reply With Quote
Old 09-25-2006, 08:22 PM   #6
Xandramas
User
 
Xandramas's Avatar
 
Join Date: Aug 2004
Posts: 59

Xandramas is on a distinguished road (10)

Default

Your save engine is confusing. It says First create him a savecode:
local location savecode = Savecode_new()
Now store the data in it. The way to store data is to pack it in an integer, taking a value from 0 to n, including n. Then call


Why dont u just include the trigger required for it? I dont know jass and this is not clear please clarify.
Xandramas is offline   Reply With Quote
Old 09-25-2006, 09:18 PM   #7
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

I think he expects you to use all JASS, you can't blame him anyways
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 07-29-2007, 03:52 AM   #8
Kratos
User
 
Join Date: Nov 2005
Posts: 18

Kratos has little to show at this moment (0)

Default

Is there no way to just declare the variables you want saved in JASS by using a simple copy and paste and then set them in GUI? I freaking hate JASS so much. Or at least create an example that actually saves something instead of just displaying a random code..

Last edited by Kratos : 07-29-2007 at 03:53 AM.
Kratos is offline   Reply With Quote
Old 07-29-2007, 04:11 AM   #9
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

How about you begin loving Jass. Or you learn Jass, or you try not to use a system that requires you to know Jass?
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 07-29-2007, 06:18 AM   #10
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

*waves goodbye to location lists* 0.3, vJassified
BTW, at this point the non vJass version has been tested heavily in NOTD Aftermath, so I can encourage use of 0.2. 0.3 is only probably fine.
__________________
PipeDream is offline   Reply With Quote
Old 07-29-2007, 05:06 PM   #11
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

Quote:
Originally Posted by Kratos
I freaking hate JASS so much.
Good for you, now either learn it or stop complaining about PipeDream's system and find one that's in GUI.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt

darkwulfv is offline   Reply With Quote
Old 08-22-2007, 04:15 AM   #12
Switch33
User
 
Join Date: Oct 2003
Posts: 150

Switch33 is on a distinguished road (13)

Default

Can you by any chance give an example of how to save say a hero's inventory? Cause i am not exactly sure you seem to have an example set up to save only integers ranging from # to n only. Not sure how an item would fit in there.
Switch33 is offline   Reply With Quote
Old 08-22-2007, 04:26 AM   #13
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

A simple approach would be to give each item type a unique number from 0 to n. Loop through the hero's inventory, look up the item type number for each item, save the number.

Charged items will present complications.
__________________
PipeDream is offline   Reply With Quote
Old 09-19-2007, 04:01 AM   #14
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

While trying to figure out how the system works, I believe I have ran across a slight problem. Saving a code simotaneous times within the vJass version, without loading in-between, causes the system to op in s__BigNum_MulSmall. The modified example is as follows, which will display the error with War3Err.

Hidden information:
Collapse JASS:
function commtest takes nothing returns nothing
    call BJDebugMsg(I2S(Savecode_scommhash("yomp")))
    call BJDebugMsg(I2S(Savecode_scommhash("fruitcup")))
endfunction

//Something can probably be made nicer to use with a macro

function Trig_test_savecode_Actions takes nothing returns nothing
    local string s
    local Savecode loadcode

//--- Data you want to save ---
    local integer medal1 = 10
    local integer medal2 = 3
    local integer medalmax = 13
    local integer XP = 1337
    local integer XPmax = 1000000

    local Savecode savecode = Savecode.create()

    call SetPlayerName(Player(0),"yomp")
    call SetPlayerName(Player(1),"fruitcup")

    call savecode.Encode(medal1,medalmax)
    call savecode.Encode(medal2,medalmax)
    call savecode.Encode(XP,XPmax)

//--- Savecode_save generates the savecode for a specific player ---
    set s = savecode.Save(Player(0),1)
    call BJDebugMsg("Savecode: " + colorize(s))
    call savecode.destroy()
    call PolledWait(1.)
    call Trig_test_savecode_Actions()
endfunction


//===========================================================================
function InitTrig_example_use takes nothing returns nothing
    set gg_trg_example_use = CreateTrigger(  )
    call TriggerAddAction( gg_trg_example_use, function Trig_test_savecode_Actions )
//    call TriggerAddAction( gg_trg_example_use, function commtest )
endfunction


I believe it has something to do with not clearing the lists entirely. Of course, I have not been able to completely understand the system, but this is what I understand.
__________________
Ammorth is offline   Reply With Quote
Old 09-24-2007, 09:23 AM   #15
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

Thanks for letting me know. If someone needs this fixed, let me know, but it should not affect saves. Or, use the location version.
__________________
PipeDream is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 01:37 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2017, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services