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.

Messages - Merkator

Pages: [1] 2
1
DF General Discussion / Re: Xenosynthesis and magic fields
« on: September 18, 2014, 07:38:53 am »
My proposals:
  • Adding aether
  • Making ecosystem resembling the real life once



Aether

Why not add just third basic element to the game. In vanilla DF there are already two basic elements - namely water and magma.
Adding something like Aether would make finding energy source for every magic creature just easier.
It would function just like real-life water veins. Flowing around, stopped only by for example Iron Ores. Make magnetic fields work with aether and you can easily create nice rivers and pools of energy.
More aether - bigger probability of small or even major mutations. Necromancer Tower would grow around the Aether filled spots.
The same elves. Some real world objects should let the aether to concentrate. From visual point of view player most of the time would see just effects of the Aether. Building something like Shrine/Pyramid or other Religion/Magic oriented building enable one more screen.
One keypress and you see just the half transparent violet and pink glow. More shrines and field of observation grows.
Building some special massive objects like for example rooms filled with silver statues should concentrate aether.
Aether would become major source of otherwise magic energy. The source of aether - core of planet / small StarWars like bacteria /
Glowing Pits. Deeper you go, closer to aether you are.
When enought of this stuff would be stored in one place it could alter the nature of reality or just mutate some poor dwarf that stand too close to our machines.
Elves would use their big trees (I mean Yggdrassil like trees, far bigger than anything else with roots reaching deeply)
Dwarves would have Stonehenge like objects/ Altars / Rooms filled with sets of columns.
Humans got piles of stones / big menhirs.
Necromances got towers.

There is (I don't know if translated to english) Polish SF/Fantasy book with similar concept - 'Lord of Ice Garden (Pan Lodowego Ogrodu)'
by Grzędowicz.

Aether would have on some creatures mutagenic effects. Changing their appearance.
Good biomes have filtered/light aether field and exist in spots without iron (remember iron change flow of aether).
Bad biomes are iron reach, but the aether there is chaotic and in vastly less stable form.

In my proposal mages are just units attuned to seeing and after practice (Alchemy skill) controling flow of third elements.
 

Food chains

As far as my biologic knowledge goes chemosyntesis are not the best source of energy for any kind of bigger creatures.
The oxygen is must-have and deep in caverns the air isn't the most clean thing. Secondly cavers are lacking in another basic source of energy - sunlight.

That's way if you want well-sounding caverns biome you need to find basic source of food down there.
Muchrooms you need some kind of humus.
That mean we need much smaller and fragile life down there. Something closely resembling normal plants. I mean the lowest level of
food chain.

Now I think there is a time to come back to Aether. Plants down there can grow using aether as energy source.
Some of theme may even learn how to cumulate Aether. That's the reason for stuff like faster evolution, Plump Helmet men.

The DCSS ( for not aknowledged Dungeon Crawl Stone Soup ) have nice mutation system that involve magic contamination.

If we really want to create new biology using some kind of magic as the source, we should work on this bottom-up.

 
TL: DR:
Spoiler (click to show/hide)

 





2
I do some research on parsing front. For now I can parse files and make nice group of tag. Caste for know not work correctly, sadly.
More interesting for me can be one template with every, single possible token in that can exist in some place.
For example most object files have some major token like ENTITY, ITEM_*, PLANT.
After that almost always exist `head` section of raw which have name of the token, and information about it.
Next go `body` which describe features that some token have. Like GRAZER of AMPHIBIOUS.
Lastly goes `caste` section and applied variation. And few tokens that can happen almost anywhere.
Having dictionary of every token and context wher some token go make so much easier parsing raws into workable form.
But as far as I know this is gaming community and we love to have Fun.
And writing schemes for in game text format isn't the fun that we want, sadly.

But if anyone have to much time. Can you post here the tokens that happen to exist in sections.
In this gist is the list of every token (only exception are language files).
Gist

3
Sorry I don't inform you guys, still my code need (probably need) flattened raws.
I will post my script with everything in.

BTW the ./text/*.txt files should be treated different. Because they are completely different than standard raws.
In those files the tokens work as variables.
In rest of the raws, they create visible structure.
My approach work only on the normal raws, and remove the comments :(

4
I already wrote basic raw parser with pyparsing.
I will post it here later.
For now I don't have access to my linux machine.

UPDATE:

Ok. Here it goes :)
Link to gist

The grammar look like that:
Code: [Select]
from pyparsing import Word, ZeroOrMore, Suppress, Optional, Regex
from pyparsing import alphas, alphanums
from pyparsing import ParseException

lbracket = Suppress('[')
rbracket = Suppress(']')
tile = Regex("\'.\'")
arg = Suppress(':') + (Word(alphanums) ^ tile)
self.token = lbracket + Word(alphas) + Optional(ZeroOrMore(arg)) + rbracket


UPDATE2:

I am moron.
Script has some problems with handling comments and names with _ inside.
Now everything is working correctly.

5
I am dumb...

Yep, this was easy.
For anyone interested

Code: [Select]
BSTART = '['
BEND = ']'
STR = ASCII+
TYPE = STR
TILE = "'" STR "'"
ARG = SEP STR|TILE
TOKEN = BSTART TYPE ARG* BEND


6
For parsing there are literally tons of tools and libs.
Even re may be all we need. Only problem I found was stuff like
[TILE:1:3:':':4]
It is just sample. In C I would just parse char by char. In python to.
If not this little uggly things whole parser could be almost in one line like
Code: [Select]
l = l.strip('[').strip(']').split(':')
token = (l[0], l[1:])

Damn, i would love to know how you solve this...



7
Button: sound great. I thought myself about something like that.
It may be really much better way.
Storing object is not much problem.

But you remember about tag order and the whole [CASTE] thing.
What kind of data structure you use? List with tuple for each token or ordereddict with tuples or ordereddicts as values?


8
I think we end up with full featured parser. Anyone here with some knowledge about Haskell and Parsec. ;)

BTW I wrote my small diff parser and end up with 100 LOC.

I post it when I do some bugtesting and clean up this piece of... I mean beauty. :P
 

9
We have still problems with diff. Maybe use something like little extension to diff format, in that way the script can find correct line numbers and fill them. That way we can easily generate correct diff file without much additional work.
I think using git for mod management is overkill. KISS rule win ;P.

My idea is use something like that:
Code: [Select]

Standart diff format look like this

@@ -4,6 +4,6 @@
- something
+ something else
...

We can use something like that

@@ =[CREATURE:WOLVERINE]>[CASTE:MALE], 6 =[CREATURE:WOLVERINE]>[CASTE:MALE],6
-something
+something else
...


The stuff after equality sign describe where the mod will be placed.
The whole expression can be read as:
First [CASTE:MALE] token after [CREATURE:WOLVERINE] token.
And what is important modder don't need to even see them.
The script can find those marks and fill them with correct line numbers.

PROS:
  • This just work
  • Portable
  • Don't need any external app. Just tiny (<100 LOC) script.

CONS:
  • Still not solve problems with merging two or more raws. Only make merging much simpler
  • I don't know if this is big problem, but my approach need special case when mod add raws at the end of file. Something like =END should sove this.

10
If I am wrong somewhere in the the middle please correct me.
The biggest diff issue is that, when you apply one mod as diff file to the vanilla, every single mod or at least most of them invalidates.
That's because line numbers change.
3-way diff sound pretty nice, but still the problem with conflicting mods stay.

Of course the best thing is to have just context dependent diff format, and not format that depend on line numbering.
Or format that use relative line numbering. For example apply some patch after n lines from point x.

And I think using git is not the best option here. Git is great, but IDK if this is best use case for it, but if you insist. ;P


Why not just squash all patches in to single diff like that http://stackoverflow.com/questions/616556/how-do-you-squash-commits-into-one-patch-with-git-format-patch?rq=1
 

11
This short script should extract every single token in file. Maybe someone find it useful.
Code: [Select]
import re
import sys

if len(sys.argv) < 2:
    filepath = str(input("FILEPATH> "))
else:
    filepath = sys.argv[1]


def reader(filepath):
    tokens = []
    name = ""
    with open("test.txt", 'r') as file:
        for line in file:
            if name == "":
                name = line
            for i in re.findall("\[[A-Za-z0-9:]*?\]", line):
                tokens.append(i)
    return (name, tokens)


def main():
    name, tokens = reader(filepath)
    for i in tokens:
        print(i)

if __name__ == "__main__":
    main()


BTW why not use something like robocopy \mir or cp -rvu for major mods.
Or just add small manifest file with information about compatibility. Number of major mods is not that big after all.
They are maybe 10 really big mods and no one will try to merge Masterwork with MLP  :P

Code: [Select]
  {
     "name":<name of the mod>,
     "version":<version of the mod>,
     "compatible-major":{
         "name-of-major-mod":"version-of-major-mod"
  }
}

Something like this. Where * is wildcard.

{
  "name":"Mycrazymod",
  "version":"0.0.1",
  "compatible-major": {
     "MasterworkDF":"5.*"
   }
}


For smaller mods you insist on merging raws itself. Why not merge diffs first?

12
I was thinking about some more complex version of extended diff format.
For example:
Code: [Select]
raw>object>entity_default.txt
?[ENTITY:MOUNTAIN]
+[NOPAIN]
-[PERMITTED_REACTION:SMELT_IRON] # just sample.
@[ENTITY:DWARVES]

Where

Code: [Select]
     ? find line
     + mean insert line
     -  remove line
     @ replace line
     # comment

This can be easily connected with each other.
For example if you want replace tag ITEM_WEAPON:Sword with ITEM_WEAPON:Big Sword
You need to just write it like that
Code: [Select]
raw>object>item_weapon.txt
?[ITEM_WEAPON:Sword]
@[ITEM_WEAPON:Big Sword]

It should be much easier that regexp.

13
DF General Discussion / Re: Dwarf Fortress 40_08 Starter Pack r2
« on: August 15, 2014, 09:02:02 am »
It is usable. Just create new dfhack.init file.
Please, this pack don't have `lazy` in name anymore. Copying single file is not that hard.  ;)

Pastebin with fix is in the dfhack thread

14
DF Suggestions / Re: Undead civilization?
« on: August 01, 2014, 04:08:36 pm »
Maybe just add something like "Families" of towers.
For example if on start of the game they are more then one tower, the every one of them can be from different family.

Then necros from different families could faith with each other over power and territory. That could stop the whole necro-invasion in worldgen.

15
DF General Discussion / Re: Dwarf Fortress 40_03 Starter Pack r2
« on: July 15, 2014, 09:43:38 am »
@PE What do you think about replacing batch save script with powershell?
PS give you a lot more power and make writing scripts much easier.
I wrote quick&dirty program for making backups & copying saves & copying configs (for now only colors.txt, but it can be adjusted)

Just click the raw file display and save file with ps1 extension. If you use windows Vista or newer it should display nice blue console with file picker. Of course if you have your DF copy somewhere else just change $MAIN_DIR path to something better.

Link: https://gist.github.com/anonymous/aad0254801c71ae79e71

Pages: [1] 2