Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Importing Liberals, or, Who Needs Backwards Compatibility?  (Read 2455 times)

kuactet

  • Bay Watcher
    • View Profile
Importing Liberals, or, Who Needs Backwards Compatibility?
« on: December 24, 2008, 03:42:26 pm »

Every new version breaks old saves. That might be necessary to add new features, but it's not cool when you lose your Grade-A badass founder. So I wrote something to export/import a liberal's stats into a human-readable .liberal file. Sample output:

Code: [Select]
[BIOGRAPHICAL INFORMATION]
Given Name: Miguel Stone
Code Name: Ammons Hart
Date of Birth: 10-16-1984
Place of Origin: Philadelphia, PA
Occupation: Political Activist

[ATTRIBUTES]
Strength: 4
Intelligence: 7
Wisdom: 1
Agility: 5
Health: 6
Charisma: 7
Heart: 13
Juice: 645

[SKILLS]
Pistol: 3.66
Persuasion: 14.00
Psychology: 17.00
Law: 2.00
Security: 4.83
Disguise: 9.47
Tailoring: 0.49
Driving: 3.76
Writing: 3.04
Art: 2.15
Religion: 1.00
Business: 0.14
Stealth: 1.00
Theft: 0.64
Seduction: 2.21
Leadership: 8.78
Tactics: 0.45

[WOUNDS]

I want input from other people, particularly on how this should fit in to the game. I'm seeing a few different options:

Exported liberals can stay in the old game, be treated as though they went to start a LCS chapter in a different city, or something else entirely.

Imported liberals can be used only to start a new game (as founder), be answering personal ads ("Polyamorous 22yo liberal seeking partner to help fight the man"), or something.

Thoughts? Is there even any demand for this feature?

Also, I thought I had the train(...) thing figured out but apparently I don't. If anybody could correct it ( cr.train(sk,x); ), that'd be great.

Also, importing the wounds was more work than it's worth until it's decided how (if?) this fits in to the game.

Code: [Select]
void exportliberal(creaturest &e)
{
FILE *h;
char str[200];
strcpy(str,e.name);
strcat(str,".liberal");
h=LCSOpenFile(str, "w+", LCSIO_PRE_HOME);

fprintf(h,"[BIOGRAPHICAL INFORMATION]\n");
fprintf(h,"Given Name: %s\n",e.propername);
fprintf(h,"Code Name: %s\n",e.name);
fprintf(h,"Date of Birth: %02d-%02d-%4d\n",e.birthday_month,e.birthday_day,year-e.age);
fprintf(h,"Place of Origin: %s\n",lcityname);
getrecruitcreature(str,e.type);
fprintf(h,"Occupation: %s\n",str);

fprintf(h,"\n[ATTRIBUTES]\n");
fprintf(h,"Strength: %d\n",e.att[ATTRIBUTE_STRENGTH]);
fprintf(h,"Intelligence: %d\n",e.att[ATTRIBUTE_INTELLIGENCE]);
fprintf(h,"Wisdom: %d\n",e.att[ATTRIBUTE_WISDOM]);
fprintf(h,"Agility: %d\n",e.att[ATTRIBUTE_AGILITY]);
fprintf(h,"Health: %d\n",e.att[ATTRIBUTE_HEALTH]);
fprintf(h,"Charisma: %d\n",e.att[ATTRIBUTE_CHARISMA]);
fprintf(h,"Heart: %d\n",e.att[ATTRIBUTE_HEART]);
fprintf(h,"Juice: %d\n",e.juice);

fprintf(h,"\n[SKILLS]\n");
for(int sk=0; sk<SKILLNUM; sk++)
{
if(e.skill[sk]>0 || e.get_skill_ip(sk)>0)
{
getskill(str,sk);
fprintf(h,"%s: %d.%02d\n",str,e.skill[sk],
(e.get_skill_ip(sk)*100)/(100+(10*e.skill[sk])));
}
}

fprintf(h,"\n[WOUNDS]\n");

if((e.wound[BODYPART_LEG_RIGHT] & WOUND_NASTYOFF)||
(e.wound[BODYPART_LEG_RIGHT] & WOUND_CLEANOFF)) fprintf(h,"Missing: right leg.\n");

if((e.wound[BODYPART_LEG_LEFT] & WOUND_NASTYOFF)||
(e.wound[BODYPART_LEG_LEFT] & WOUND_CLEANOFF)) fprintf(h,str,"Missing: left leg.\n");

if((e.wound[BODYPART_ARM_RIGHT] & WOUND_NASTYOFF)||
(e.wound[BODYPART_ARM_RIGHT] & WOUND_CLEANOFF)) fprintf(h,"Missing: right arm.\n");

if((e.wound[BODYPART_ARM_LEFT] & WOUND_NASTYOFF)||
(e.wound[BODYPART_ARM_LEFT] & WOUND_CLEANOFF)) fprintf(h,"Missing: left arm.\n");

if(e.special[SPECIALWOUND_RIGHTEYE]!=1) fprintf(h,"Missing: right eye.\n");
if(e.special[SPECIALWOUND_LEFTEYE]!=1) fprintf(h,"Missing: left eye.\n");
if(e.special[SPECIALWOUND_NOSE]!=1) fprintf(h,"Missing: nose.\n");
if(e.special[SPECIALWOUND_TONGUE]!=1) fprintf(h,"Missing: tongue.\n");
if(e.special[SPECIALWOUND_TEETH]!=TOOTHNUM) fprintf(h,"Missing: %d teeth.\n",TOOTHNUM-e.special[SPECIALWOUND_TEETH]);

LCSCloseFile(h);
}

Code: [Select]
void importliberal(char *codename)
{
FILE *h;
char str[200], r1[200];
char *eoftest, *r2, *val;
int type = 0;
strcat(codename, ".liberal");
h=LCSOpenFile(codename, "r", LCSIO_PRE_HOME);
if(h==NULL)
{
//this liberal cannot be found, possibly as a result of Conservative conspiracy
}
else
{
creaturest cr;
cr.creatureinit();
cr.type=CREATURE_POLITICALACTIVIST;

eoftest=fgets(r1,200,h);
while(1)
{
while(memcmp(r1,"[",1)!=0 && memcmp(r1,"\n",1)!=0)
{
r2 = strtok(r1,":");
val = strtok(NULL,":");
val[strcspn(val,"\n")]='\0';//strip off the newline character
if(val!=NULL)
{
switch(type)//type: 1=bio, 2=atts, 3=skills, 4=wounds
{
case 1:
if(strcmp(r2,"Given Name")==0)
{
strcpy(cr.propername,&val[1]);
break;
}
else if(strcmp(r2,"Code Name")==0)
{
strcpy(cr.name,&val[1]);
break;
}
else if(strcmp(r2,"Date of Birth")==0)
{
int m,d,y;
sscanf(val,"%02d-%02d-%4d",&m,&d,&y);
cr.birthday_month=m;
cr.birthday_day=d;
cr.age=year-y;
break;
}
else if(strcmp(r2,"Place of Origin")==0)
{
break;
}
else if(strcmp(r2,"Occupation")==0)
{
for(int i=0; i<CREATURENUM; i++)
{
getrecruitcreature(str,i);
if(strcmp(&val[1],str)==0) cr.type=i;
}
break;
} else break;
case 2:
int i;
if(strcmp(r2,"Strength")==0)
{
sscanf(val,"%d",&i);
cr.att[ATTRIBUTE_STRENGTH]=i;
break;
} else if(strcmp(r2,"Intelligence")==0)
{
sscanf(val,"%d",&i);
cr.att[ATTRIBUTE_INTELLIGENCE]=i;
break;
} else if(strcmp(r2,"Wisdom")==0)
{
sscanf(val,"%d",&i);
cr.att[ATTRIBUTE_WISDOM]=i;
break;
} else if(strcmp(r2,"Agility")==0)
{
sscanf(val,"%d",&i);
cr.att[ATTRIBUTE_AGILITY]=i;
break;
} else if(strcmp(r2,"Health")==0)
{
sscanf(val,"%d",&i);
cr.att[ATTRIBUTE_HEALTH]=i;
break;
} else if(strcmp(r2,"Charisma")==0)
{
sscanf(val,"%d",&i);
cr.att[ATTRIBUTE_CHARISMA]=i;
break;
} else if(strcmp(r2,"Heart")==0)
{
sscanf(val,"%d",&i);
cr.att[ATTRIBUTE_HEART]=i;
break;
} else if(strcmp(r2,"Juice")==0)
{
sscanf(val,"%d",&i);
cr.juice=i;
break;
} else break;
case 3:
int j,k;
for(int sk=0; sk<SKILLNUM; sk++)
{
getskill(str,sk);
if(strcmp(r2,str)==0)
{
sscanf(val,"%d.%02d",&j,&k);
cr.skill[sk]=j;
int x = 6*(100+10*j)*k/(100*maxskill(sk,cr,true));
cr.train(sk,x);//this should be right but isn't! help!
}
}
break;
case 4:
break;
default:
break;
}
}
eoftest=fgets(r1,200,h);
if(eoftest==NULL) break;
}
if(strcmp(r1,"[BIOGRAPHICAL INFORMATION]\n")==0) type=1;
if(strcmp(r1,"[ATTRIBUTES]\n")==0) type=2;
if(strcmp(r1,"[SKILLS]\n")==0) type=3;
if(strcmp(r1,"[WOUNDS]\n")==0) type=4;
eoftest=fgets(r1,200,h);
if(eoftest==NULL) break;

}
//other stuff to finalize the liberal depending on where this ends up

LCSCloseFile(h);
}
}
Logged

Servant Corps

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #1 on: December 24, 2008, 09:42:07 pm »

I'd really love this, but I'm afraid about somebody levelling up their Liberals in a old version and then transferring that character sheet over to the new game, thereby cheating...
Logged
I have left Bay12Games to pursue a life of non-Bay12Games. If you need to talk to me, please email at me at igorhorst at gmail dot com.

kuactet

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #2 on: December 25, 2008, 12:09:23 am »

This is a single player game. There is not one skill that can't be increased by grinding long enough. Cheating literally does not matter. By the time a player has leveled a character to the point of godhood, he would have seen pretty much everything the game has to offer. Instead of having to do that every time you start over, you could just get right to fighting the man.

Also since there are no sanity checks on any of the stats, I'd be more worried about somebody giving their liberal a heart of 9000. Or exploiting a buffer overflow to execute arbitrary code--oh wait.
« Last Edit: December 25, 2008, 01:36:32 am by kuactet »
Logged

mainiac

  • Bay Watcher
  • Na vazeal kwah-kai
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #3 on: December 25, 2008, 12:11:28 am »

It has occured to me that Importing Liberals is a good euphemism for illegal immigration.
Logged
Ancient Babylonian god of RAEG
--------------
[CAN_INTERNET]
[PREFSTRING:google]
"Don't tell me what you value. Show me your budget and I will tell you what you value"
« Last Edit: February 10, 1988, 03:27:23 pm by UR MOM »
mainiac is always a little sarcastic, at least.

Funk

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #4 on: December 25, 2008, 07:38:13 am »

It has occured to me that Importing Liberals is a good euphemism for illegal immigration.
maybe we can pay to get deported sweatshop workers back?
Logged
Agree, plus that's about the LAST thing *I* want to see from this kind of game - author spending valuable development time on useless graphics.

Unofficial slogan of Bay 12 Games.  

Death to the false emperor a warhammer40k SG

chaoticag

  • Bay Watcher
  • All Natural Pengbean
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #5 on: December 25, 2008, 08:11:05 am »

This importing stuff sounds as it will be glitchy, as one of the newer versions did funny stuff to people with a certain skill.
Logged

EuchreJack

  • Bay Watcher
  • Lord of Norderland - Lv 20 SKOOKUM ROC
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #6 on: December 26, 2008, 12:55:59 am »

As long as the designer understands the differences between the versions (like how we no longer have the survival skill, but now have the throwing skill), it should be ok.  I kinda like the idea of having my janitor start up a new branch of the LCS.

BishopX

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #7 on: December 26, 2008, 12:20:06 pm »

The only "in game" issue I see would be time. A 57 year old founder from an arch conservative 2030 would seem kinda odd if  they showed up back in 2007.

Easiest implementation would be to include time (and possibly national office holder/issues) in the .liberal file.
Logged

Servant Corps

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #8 on: December 26, 2008, 12:40:42 pm »

Yeah I support that. Time, and national office holder/issue would be a best way to handle the situation.
Logged
I have left Bay12Games to pursue a life of non-Bay12Games. If you need to talk to me, please email at me at igorhorst at gmail dot com.

beorn080

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #9 on: December 26, 2008, 03:28:27 pm »

If this would allow me to start a new game with everything nearly arch conservative, that would be great. Something I've always wanted but never realized till now.
Logged
Ustxu Iceraped the Frigid Crystal of Slaughter was a glacier titan. It was the only one of its kind. A gigantic feathered carp composed of crystal glass. It has five mouths full of treacherous teeth, enormous clear wings, and ferocious blue eyes. Beware its icy breath! Ustxu was associated with oceans, glaciers, boats, and murder.

Servant Corps

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #10 on: December 26, 2008, 03:33:16 pm »

We can upload .liberal files that would allow people to play in areas nearly arch-conservative. Heh, we could even finally start having Succession Games, like Drawf Fortress have (though technically that can already happen if we upload saves...however, compatibility between version would cause certain save files to not work...).
Logged
I have left Bay12Games to pursue a life of non-Bay12Games. If you need to talk to me, please email at me at igorhorst at gmail dot com.

Zero Ziat

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #11 on: December 27, 2008, 02:44:41 am »

That's why you settle what version to use with your fellow successors.
Logged

kuactet

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #12 on: December 30, 2008, 09:07:01 pm »

This importing stuff sounds as it will be glitchy, as one of the newer versions did funny stuff to people with a certain skill.

The code is right there. You can look at it and decide definitively whether or not it will be glitchy. If you're not a programmer, and it makes you feel better, it's written so that if it comes across a line it doesn't understand, it ignores it. So if, for example, one of your liberal's skills is "Fighting The Man", and across versions the skill is renamed "Inciting Revolutions" then if it's called "Fighting The Man" in the .liberal file, you lose the skill when you import that liberal. There's no room for glitches of that sort. The only problems that I'm seeing are if the line is longer than 200 characters, which realistically can't happen unless you're a jackass who names your liberals things like Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaron or Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanthony. But that would crash the game anyway (I'm pretty sure the maximum name length is 40 characters, but I could be wrong).


The only "in game" issue I see would be time. A 57 year old founder from an arch conservative 2030 would seem kinda odd if  they showed up back in 2007.

Easiest implementation would be to include time (and possibly national office holder/issues) in the .liberal file.

I agree. That would be a step on the way to a truly forward and backward compatible save system, which should probably wait until orgs are nailed down.


If this would allow me to start a new game with everything nearly arch conservative, that would be great. Something I've always wanted but never realized till now.

I like that. There's an option to compile the game so that it starts with laws at C+ but it should be possible without having to resort to that.
Logged

Aquillion

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #13 on: January 17, 2009, 06:41:07 am »

The only "in game" issue I see would be time. A 57 year old founder from an arch conservative 2030 would seem kinda odd if  they showed up back in 2007.
No!  That's the best part.  Think about it.

"In 2030, the LCS had failed; the country had become a backwards corporate-driven Conservative nightmare.  But the LCS founder had one last trick up his sleeve; with the assistance of several sleeper Engineers from the local power plant and a modified DeLorean DMC-12, he is going back to make one more attempt..."
Logged
We don't want another cheap fantasy universe, we want a cheap fantasy universe generator. --Toady One

beorn080

  • Bay Watcher
    • View Profile
Re: Importing Liberals, or, Who Needs Backwards Compatibility?
« Reply #14 on: January 17, 2009, 08:56:38 am »

The only "in game" issue I see would be time. A 57 year old founder from an arch conservative 2030 would seem kinda odd if  they showed up back in 2007.
No!  That's the best part.  Think about it.

"In 2030, the LCS had failed; the country had become a backwards corporate-driven Conservative nightmare.  But the LCS founder had one last trick up his sleeve; with the assistance of several sleeper Engineers from the local power plant and a modified DeLorean DMC-12, he is going back to make one more attempt..."
Now that would be great. A 1 in 20000 chance to steal a Delorean and be able to go back and join your original self from 2007 to change the future and prevent it from going arch conservative.
Logged
Ustxu Iceraped the Frigid Crystal of Slaughter was a glacier titan. It was the only one of its kind. A gigantic feathered carp composed of crystal glass. It has five mouths full of treacherous teeth, enormous clear wings, and ferocious blue eyes. Beware its icy breath! Ustxu was associated with oceans, glaciers, boats, and murder.
Pages: [1] 2