Persistent Variables

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Persistent Variables

Post by Gambit »

I ran a forum search, and it seems that nobody is talking about this yet, so please take a few minutes to read on.

I just want to cram a little peanut into the backs of the heads of all the really cool UMC authors out there (you know who you are). Thanks to the GSoC student Upthorn, and his mentor Crab, WML can now save variables to files. You can read about it here.

This opens so many doors for us. Some things that came to mind tonight:
1. tsr: Your coop map editor could allow saving and loading. It could even be expanded to them to add events and unit placement.
2. Aethaeryn: Your Dungeon Master game could have a scenario that lets users setup a dungeon ahead of time.
3. My own old wespets project wouldn't have to use codes anymore.
4. Persistent rpg's and campaigns
5. Mabuse: A survival extreme mod that saves your characters, and other stats (total kills), and when you start a new game it assesses your combined stats and adjusts difficulty accordingly). So your characters are always getting stronger, and the enemies always getting harder. And it wouldn't matter if people quit on you. You just start a new game, and there is your character! I'd also ramp up prices or decrease gold bonuses so that it would take longer to get super strong. And you could keep your character between games if you die. Or make it so the character resets on death, but you can pay a really big amount of gold to have the reset point set to your current stats.
6. Stat tracking for all add-ons. Example: TEB[sic] will track how much total food, wood, and gold you've spent and made throughout your career. Survival extreme could track total kills and even deaths.
7. Achievements and unlock-ables for all add-ons.

Personally this is a dream come true. I can't wait for the add-ons of the future.


edit: Just because I didn't list you here doesn't mean I don't think you're awesome. It just means I couldn't think of any projects of yours that screamed "GIVE ME PERSISTENCE!", so please don't be offended. :oops:
Last edited by Gambit on August 18th, 2010, 12:03 am, edited 1 time in total.

Qazerowl
Posts: 61
Joined: July 12th, 2009, 3:37 pm

Re: Persistent Variables

Post by Qazerowl »

I can't wait to see what YOU do with this. You are the best add-on maker here. GEB alone is one of the most unique (to Wesnoth) add-ons ever! I can't imagine what you will do with this! I eagerly await YOUR add-ons of the future.

User avatar
Captain_Wrathbow
Posts: 1664
Joined: June 30th, 2009, 2:03 pm
Location: Guardia

Re: Persistent Variables

Post by Captain_Wrathbow »

Oh... my... word. :shock:
This is for real? :Awesome:

This opens up so many insane possibilities.... I'm dumbfounded. :mrgreen:
I've heard you complaining about wanting persistence before, but I never thought it would actually ever happen...

User avatar
PsychoticKittens
Posts: 573
Joined: May 29th, 2006, 8:49 pm

Re: Persistent Variables

Post by PsychoticKittens »

So, someone needs to make a mod with saveable characters you can just load up into a new game with other people. So that you can continuously use the same character in an RPG. Just throwing it out there.
Creator of: Mercenaries Era; Modern Combat
Future Projects: Faunima: Land of Monsters
Temporarily Dropped Projects: Zombie Horde

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Persistent Variables

Post by Sapient »

PsychoticKittens wrote:So, someone needs to make a mod with saveable characters you can just load up into a new game with other people. So that you can continuously use the same character in an RPG. Just throwing it out there.
This may seem like a good idea in theory, but in practice it would be hard to allow unlimited character advancements while still creating fun scenarios that offer a significant challenge to players.

Also, after leveling up so many times it would either become ridiculous or pointless to advance further.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
Dixie
Posts: 1757
Joined: February 10th, 2010, 1:06 am
Location: $x1,$y1

Re: Persistent Variables

Post by Dixie »

The only think I could think about would be creating enemies based on the heroes' average level. Store some infos in a variable, and create a unit using them. Hitpoints = 30 + 2 * average_level, etc. for strikes, damage and everything. But the specials/abilities would forcibly be finite, and I'll agree there would be a good deal of pointlessness to it: why bother leveling if the enemies are just gonna scale up accordingly?
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth

User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Persistent Variables

Post by Gambit »

I came up with a way today to lower the risks of cheating:

Code: Select all

[20:04:42] <Gambit> So what you do is you take all your most important numeric variables and make them a big string
[20:05:10] <Gambit> big_string = $gold$unit.hitpoints$cheeseburgers$inventory[i].item_code
[20:05:37] <Gambit> A big ***-string
[20:05:37] <Gambit> http://xkcd.com/37/
[20:05:51] <Gambit> Then you split it into an array of numbers.
[20:06:11] <Gambit> Then for each number 1-9 you set a random letter of the alphabet.
[20:06:27] <Gambit> Then for each number in your big ***-string you replace it with the corresponding random letter.
[20:06:47] <Gambit> Then you rejoin the array of replaced numbers
[20:06:59] <Gambit> Then you put the random letters in a group at the begining
[20:07:01] <Gambit> for example:
[20:07:14] <Gambit> WMUYPOZSY;ASNFSAMDSMADSAGEARRWQAFEGDSAFASDADWQFEFSADFW
[20:07:20] <Gambit> would be a newly incrypted ***-string
[20:07:28] <Gambit> Then you store that along with all your other persistent variables
[20:07:36] <Gambit> Then when you load the game
[20:07:40] <Gambit> You load all the persistent variables
[20:07:46] <Gambit> And you decrypt the ***-string
[20:07:55] <Gambit> You make a second ***-string out the loaded persistent variables
[20:08:00] <Gambit> Compare the two ***-strings
[20:08:03] <Gambit> If they don't match
[20:08:16] <Gambit> "PLAYER $side_number IS A BIG ***-CHEATER!"
[20:08:23] <Gambit> And you tell them to abort the game right there.
[20:08:25] <Gambit> Voila
And the first person to make an add-on that needs this, I'll be happy to help. I've done all that before except for the part with saving it to a persistent variable.
This only prevents average joe's with mere text editors. It doesn't stop people with WML knowledge from making an add-on that helps them cheat.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: Persistent Variables

Post by Mabuse »

Gambit wrote: 5. Mabuse: A survival extreme mod that saves your characters, and other stats (total kills), and when you start a new game it assesses your combined stats and adjusts difficulty accordingly). So your characters are always getting stronger, and the enemies always getting harder.
thx for the thread (and the info), but for SX and almost all add ons i can think of this isnt very exploitable.
sx is a simple online game, if the game is ended, so the chars are ended. new game = new chars.

it doesnt make sense if someone plays sx for days and join new games with his 10786 hour hero.

also if the creeps are getting adjusted by the players stats, it doesnt make sense either.


if i would make an SX campaign, which would be basically all the scn's in an chronological order, each NEXT scn would use default heros (at max level though) and the usual starting gold (for the selected difficulty/player number)


so even in a campaign i woulnd take over the stats, since its too difficult to balance out, also the growing stats become a problem.

i already use decreased stats ;)
but i think im happy that i can run a single SX SCN without running into extremely high stats too early.


EDIT:
----------
if you make a big RPG world cnsisting of several SCN (first you need to make them) that use different strengh requirements for the (starting) heroes and players could use their heros its ok, but how you deal once your RPG is out for some month's ? then players ruin every game by joining with their 100000 hours heros. or you make "artificial" develoment limits, in this case yu 'd "only" have to deal with the issue that all players have maxed out chars after a while anyway ;)
The best bet is your own, good Taste.

Exasperation
Posts: 462
Joined: June 8th, 2006, 3:25 am

Re: Persistent Variables

Post by Exasperation »

Assuming I understand the interactions between local & global variables, and what gets computed locally versus what gets sent across the network, I think something like the following might be a generally useful application of global variables (spoilered for length):
Spoiler:
The idea is that each player computes version_number locally, then saves it to a global variable. Then, each player's global variable gets read back into individual local variables which can be compared to make sure everyone computed the same version_number, and if somebody got a different value there's an error message of some sort. This way, multiplayer scenarios should be able to check to make sure all the players are using the same version of the add-on.

Mabuse
Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: Persistent Variables

Post by Mabuse »

as i thought a bit about it, there may be another FUN use for my SX RPG MAPS

it is basically STAT tracking ... so players who completed SCN's on certain difficulty levels would get MEDALS which may be there just for bragging or showing people that you know the map and know what you are doing - but may also UNLOCK secret shop contents such as new special weapons, abilities - you may get +1 armor slot, or +1 ability if you are a veteran player

however, low priority atm, but i think its fun to include medals and slight boni (or new char classes) for people who completed a certain difficult map on a high diff setting

the boni would be no game breakers, but nice options to have :)
The best bet is your own, good Taste.

Post Reply