Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Purple Gorilla

Pages: [1]
1
Curses / LCS Picture Editor
« on: January 06, 2016, 12:58:08 pm »
This is a programme to edit the pictures that LCS uses for newspapers.

Here, you can Download it :
http://dffd.bay12games.com/file.php?id=11616

Screenshot:

Note, "Marsch für das Leben" is the German equivalent of "Pro Life"
(Hopefully Tinypic doesn't mind the crooked cross ...)

Systems :
* DOS (MS,GNU,...) - run it directly
* DOS based Windows (95,98) - run it directly
* Windows XP - run it directly, thought DOSBOX is better. To get the right Codepage, use fullscreen
* Windows NT (Vita,7,8,...) - use DOSBOX
* Linux - use DOSBOX

Loading a file:
You can give a file as command line parameter, or simply run it and use the - extremely user friendly - file-browser.

Editing :
Pressing a key, that is not a special Key, will write it at the cursor.
Arrows : move cursor
Page Up/Down : change Page
Enter/CTRL+Enter : Change foreground colour
Tab/Backspace : Change Background colour
ESC : Quit. You are asked, if you want to save. Press 'J' or 'Y' to save, 'N' to quit or other keys to abort quitting.

The source-code is included in the ZIP file. It is considered public domain, and was compiled using Borland's Turbo-C.

For Fullscreen under Windows, press ALT+ENTER

2
DF Bug Reports / Do you wan't DrWatson32 Crashlogs ?
« on: July 27, 2015, 02:32:30 pm »
What makes Dwarf Fortress umplayable are the many crashes. Some are deterministic, some happen randomly, and the worst happen while saving. The Bugtracker Forum refuses any report on a nondeterministic crash, because you cannot bring a savefile for that.
If that happens, shall we upload (or Post) the DrWatson32 crashlog to help ? From the Offending adress, and the Listing, that Tarn Adams should have, he should be able to find the offending funktion, and from the diassembled code it should be able to find the exact command that caused it, and fix the bug. Most likely, the funktion was called with a wrong parameter, but he could add code to intercept that and make the programe more failsafe.
DrWatson32 is a Programe that comes with Windows, that intercepts processor interupts and stores a logfile at the following place :
<Systemdrive>:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Microsoft\Dr Watson\DRWTSN32.LOG
You also get a coredump, but that is probably too large too upload.
If it isn't running automatically (dempends on OS version), you can start it by executing :
<Systemdrive>:\WINDOWS\system32\DRWTSN.EXE

It appears, that most crashes have the following format:
1. Something acesses a dangling Pointer. This is no Problem yet, as the Memory that onced belonged to the programe still belongs to the programe.
2. It reads another Pointer of an offset towards the pointer
3. It acceses the second pointer, that contains rubbish or zero and causes a segfault.

In C this should be a pointer to a structure, that contains a pointer. So checking Pointers read from pointers for NULL or values out of the programe memory adresses should help. Note, that in C++, Objects are often pointers, that don't look obviously like pointers, so using the & Operator on objects or rewriting library classes that dynamically allocate memory might be necessary.

3
Curses / LCS in German / LCS auf deutsch
« on: June 29, 2015, 04:38:29 pm »
[D]
Nach einigen Wochen Arbeit, ist LCS auch bald auf deutsch verfügbar. Dann können Sie den Amerikanern helfen, die Republikaner aus dem Land zu treiben, und durch die Demokraten ersetzen, die eigentlich identisch zu den Republikanern sind, aber in dem Spiel die "Guten" sind. In der USA hat man zwar keine Demokratie, aber dafür hat jeder eine M16 - damit kann man auch Politik machen :-).

Es läuft bereits, und ich bin noch dabei Fehler auszubessern, und einen Server zum Hochladen zu finden. Zum Vorgeschmack, ein paar Bilder :

[E]
I am translating LCS to German. After some weeks,  its now running, and I only have to fix Bugs, and find a Host. Vor preview some Pictures :


[D] Zeitungssartikel, der die Wirtschaftspolitik "Liberaler" macht. Eigentlich wird die Politik sozialer, da Helmut Kohl liberal ist, aber in Amerika heist "Conservative", liberal, und und "Liberal" heist sozial.... andere Länder andere Sitten.
[E] Bloated Haggis - A New Book descripes the dark sides of Helmut Kohl. (Kohl resembles Reagan, and Haggis is his favourite Food)


[D] Hiterwäldler, Jodler, Schluchtenscheißer und Christsoziale stürmen das Obdachlosenheim mit Fackeln und Mistgabeln, weil man geheime Akten ihres heiligen Privatfernsehens veröffentlicht hat. Joa mai, doa lägst di nieder.
[E] Rednecks raid the homeles shelter. It is written in Bavarian Dialekt, to emphasise that they are rednecks.


[D] Ey, die Hopper im Spiel, ey, die sin' so cool, di reden voll die fette Gangster Slang, Alter.
[E]
Q:"Oi Dude, I need a Gun "
A:"Oi Dude, Oi me not sellin gun to Pigs ..." "ehm me sayin, me not sellin any gun, Dude"
In the German Translation, Gangmembers get a ultra-cool Hiphop-Slang, dude.



[D] Eine voll ausgerüstete "Konspirative Wohnung" der LCS. In der USA steht schon in der Verfassung, das jeder Sprengfallen und eine FlaK zu Hause haben darf, und Panzersperren sollte man dort auch haben.
[E] A full Upgraded Safehouse of the LCS


[D] In ein paar tagem werde ich die Beta Version irgenwo hochladen.
[E] In some Days I will upload the beta Version

Features :
* good, lovely translation, like in "Die Zwei", and not like "Die Simpsons". If there are silly puns in english, I translated them to silly puns in German, instead to translate them literal.
* safefiles are compatible to 4.7.0. for that purpose, I used some tricks, for example the sex of the gouvernement is encoded behind the terminator of their name, and the sex of locations is encode in their first letter.
* I wrote an improved random number generator, using the XOR-feedback-Shift register algorithm (similar to GPS encryption). While wikipedia claims the algorith is inefficient in software, I found a way to make it more efficient than the old, by using the parity checks, that 8086 Processors have in Assembly. The most important thing, is that the random numbers are more random, preventing streaks of mediocreness.
* The Game now has more Humour. I added more curses then free speech is L+, and also made a lot of jokes about americans.
* I added some new function, that might be usefull, for the english version too : strkitten -like strcat, but appends single char) , strcatf - like strcat, but accepts format strings, addstrf - like addstr, but accepts format strings.
* I significantly increased the efficience of the code. For example, I converted the macros GIVE_WEAPON_CIVILLIAN, GIVE_GENDER_MALE and GIVE_GENDER_FEMALE in creaturetypes.cpp into funktions, reducing the compiletime. I also significantly reduced the stringduplication, for example all text to new laws appear exactly one time (with that from the beginning, the election bug would have never happened) .
* Texts now take the actual sex of a person more into acount, sounding much better. For example every job has appropriate male and female names, as it is normal in german. I just want to point out, that certain jobs like Nun or Actor should change in english too, or have you ever seen a male nun ? (Thought NetHack has female Monks :-) ...)
* Certain creatures (Redneck, Gangmember) get a silly slang, to sound more funny.

Gameplay changes (mostly bugfixes, and some grammer stuff):
* Game doesn't crash on elections
* You can kill multiple tanks, without a raid becoming unwinnible
* You can reconquer lost warehouses
* Hermaphrodites, Transsexuals and Homosexual Dating are removed, due to them beeing akward to translate. To compensate, the "Age of consent" is removed.
* Gender-neutral names are removed, due to being impossible to talk about.
* You can back out while talking in combat
* The Help on Activities is updatet, to reflect the actual gameplay
* Items have now a sex, defined in the XML files
* If you escape a raid, you get now chasers of the apropriate type (I am not sure, if you should get chasers at all ?)
* Then hostile Firemen attack you with their flamethrower, you are no longer charged with arson.
* If the founder is female, the "homosexuality option" in the starting questions mentions playing football, because making out shouldn't be wrong, if a girl does it.

4
Curses / (BUG) never-ending raid (Tank related)
« on: June 05, 2015, 03:36:33 pm »
There is a serious Bug in the Game, that prevents raids from ending.

The Navy Seals raided my Safehouse. The Firemen left my safehouse an almost empty map, so I could reach the Tank without fighting any Seals, and destroyed the Tank. Another Wave of Seals and a second Tank appered. I got to the other Tank and destroyed it too. The raid wasn't over. I started to fight the seals, but inbetween two other waves of Seals and Tanks were spawned. I finally manged to kill all siegeunits and tanks, and now nothing is left on the map. This could be repeated infinitly (or exactly 65536 times).


includes.h :
The structure siegest containes a short variable named tanks.

combat\fight.cpp ; sidemode\advance.cpp :
fight.cpp line 1152 and advance.cpp lines 406 and 466 decrease this variable, if a tank is killed.

sitemode\sitemode.cpp :
line 258 sets this variable to 1 when the initial tank is created.
lines 2449 and 2450 are the conditions to win the raid : siege.tanks must be exactly 0 and siege.kills must be above 9.
The block from 2402 to 2450 contains the actual bug :
                  if(!(location[cursite]->compound_walls & COMPOUND_TANKTRAPS)&&
                     location[cursite]->siege.siegetype==SIEGE_POLICE&&
                     location[cursite]->siege.escalationstate>=2)
                  {
                     count=10000;
                     int hunitnum=1;
                     for(int t=0;t<hunitnum;t++)
                     {
                        do
                        {
                           lx=LCSrandom(7)+(MAPX/2)-3;
                           ly=LCSrandom(5);
                           lz=0;
                           count--;
                           if(count==0)break;
                        }while((levelmap[lx][ly][lz].flag & (SITEBLOCK_BLOCK|SITEBLOCK_DOOR|SITEBLOCK_EXIT))||
                              (levelmap[lx][ly][lz].siegeflag & (SIEGEFLAG_UNIT|SIEGEFLAG_HEAVYUNIT|SIEGEFLAG_TRAP)));
                        levelmap[lx][ly][lz].siegeflag|=SIEGEFLAG_HEAVYUNIT;                     }
                  }
               }

The marked line creates a new Tank, but does not increase siege.tanks.
If you kill more than two tanks, siege.tanks goes negative, and the raid becomes unwinnable.

To fix the Bug, insert the following line after the marked line :
Code: [Select]
            location[cursite]->siege.tanks++;
To harden the Game further replace the following line (2450) :
Code: [Select]
                  location[cursite]->siege.tanks==0&&with the following line :
Code: [Select]
                  location[cursite]->siege.tanks<1&&

To provoke the Bug :
*Get your safehouse raided by the Naly Seals and Tanks
* Kill two or more Tanks without killing more than 9 Seals.
Tips:
* It helps to reach the Tank, if the firemen burned out every tile in another raid.


5
Curses / WHat causes the Crash during Elections ?
« on: October 04, 2014, 05:45:16 pm »
In the "stabile" release, it may happen, that game crashes during elections. Why does this happen ?

After looking at POLITICS.CPP, the line 575 looks suspicious, as it accesses the array canlaw[] without verifying, that its size is nonzero. The algorithm from lines 561 to 565 may produce this result, if all priorities are zero. The acces, to an uninitialized memory location in canlaw[] may read a value, that is out of range in the law array (assuming int is 32bit VERY MUCH out of range). The actual change of the law then causes acces out of the array with the laws. Appearendly, the C-compiler inserts a BOUND instruction before accesing the array, that results in the processor generated interrupt number 5, that has no handler inside LCS and is intecepted by the operation system.

If this assumtion were true, the following questions rise :
* Why does it happen so deterministic ? If you start the game again, the RND should return different values for the mood (lines 534-537), so it shouldn't happen, that it is unavoidable.
* Is it possible to change this in the single day, you have before the elections ? I tried, to raid a location and burn a flag, but it didn't work.
* Is it possible to avoid this by commiting certain actions on the days, before the elections (for example raiding the court hous to affect free speech ?)
* Is there a way, to see it coming from public opinion ? (for example people concerned about CCS terrorists, as there is no law about them)

6
Curses / How to conquer a lost safehouse ?
« on: September 23, 2014, 12:38:21 pm »
While playing LCS it may happen, that that the CCS raids your safehouses, and conquers them. If it was a warehouse, it then shows up as CCS safehouse and can be raided, but there seems to be no way to conquer it.

There is code, to conquer a CCS safehouse if you kill an Arch-conservative / CCS Boss / Hardened Veteran, but theese guys never show up in warehouses. They only show up in siege units or in original CCS safehouses. I explored the whole warehouse, but neither did one show up as an encounter nor is there a special tile.

A certain amount of killed vigilantes also doesn't work. I killed lots of them, but i didn't work nor is there anything in the source code.

Increasing the crime like in the crackhouse also doesn't work, because it checks for RENTING_NOCONTROL, that doesn't work because it has RENTING_CSS, and locations with RENTING_CSS only have code to out sleepers.

After all, it seems to me, that this is a bug, because CCS Bosses as random encounters were commented out, but there is no special tile in safehouses conquered by the CCS or other way to conquer it.

Further, I found another bug. If a liberal is in hospital, and his safehouse is conquered by the CCS, he returns to the safehouse, and becomes a pseudo sleeper (mapping the location). It would make more sense, to send him to the homeless shelter if the location isn't anymore under LCS control.

Pages: [1]