Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Four-Dimensional Dwarf Fortress (xpost. of mine from reddit)  (Read 3096 times)

mszegedy

  • Bay Watcher
    • View Profile
Four-Dimensional Dwarf Fortress (xpost. of mine from reddit)
« on: February 25, 2012, 05:02:26 pm »

This got good reception on reddit and I want to see what the rest of you think about it.

For some time I have successfully grasped n-dimensional geometry now. I am always looking to expand my view of worlds both real and imagined, and I one of the ways in which I seek to do this is visualizing any number of dimensions. I can now successfully comprehend things like simple rotations of x-dimensional hyperplanes in a y-dimensional cross-sections of z-dimensional space, and similar operations on polytopes and such. The spatial dimension that I understand the most, however, is the next one, the fourth. I mentally feel as comfortable in it as in the third dimension, naturally processing the movement of objects in eight directions rather than our six (up, down, left, right, forward, backward, or however you wish). Recently, I have been searching for a way to bring it into ours: some sort of way to view and interact with a four-dimensional world, so that we may grasp it fully in its beauty.

You probably do not like where this is going.

I believe the fourth dimension can be modded into Dwarf Fortress. You know how we have z-levels? We break the three-dimensional world of Dwarf Fortress down into layers, for comfortable two-dimensional viewing on our two-dimensional computer screen. We cycle through these layers, viewing one slice at a time because we can not view the whole thing in one pseudo-three-dimensional shot, except in a clumsy manner with things like StoneSense, which require abstract rotation to view the whole thing. It's much better for us to take our square slices, in complete certainty of the x and y position of everything we see. This is practical in general for viewing the fourth dimension as well: take gradual, periodical, three-dimensional slices of the whole thing, each of which can be individually comprehended quite handily. To look at different parts of it, just cycle through the layers, in w-levels, like in Dwarf Fortress but with three-dimensional layers instead of two.
However, who is to say that these three-dimensional layers cannot be broken down into two-dimensional slices like the ones for Dwarf Fortress? No one. Simply, one must cycle through two axes of layers: the z-layers, with < for up and > for down, and the w-layers, with { for ana, and } for kata. Each pointy bracket press sends you to another vertical layer in the pile, like a delicious stack of pancakes peeled apart pancake by pancake. Each curly bracket press sends you to a different three-dimensional plane entirely, like several stacks of pancakes lined up next to each other, with you choosing to move to a stack on the left or right.
There is, then, the matter of mechanics. In three dimensions, you have a floor and ceiling, yes? You are usually attracted to the bottom layer, because there is a force pulling you downwards. Therefore, you place a floor underneath yourself, downwardly oriented to your center of being (analogous to a "tile" in Dwarf Fortress: floors are in the bottom of the tile). However, in four dimensions, it would be kind of stupid to be attracted to either end of the series for whatever reason, just because... well, all stacks are made equal. But the reason we can traverse in three-dimensional space at all is because of gravity: STAIRS. It is therefore prudent to come up with such an attraction anyway, for the sake of practicality. Where are we to put this magical source of attraction, however? I say place it on your embark stack, in the center of the series (it is going to be in the center of the series). Therefore, if you are ana of the home stack, you will be pulled kata, and need some sort of support directly kata of the tile that supports you. If you are kata of the home stack, you are pulled ana, and need to have supports ana of where you are. We do not need supports in both directions; in stacks, only an ana pull or a kata pull exists, but not both. Think of these supports as simply tiles that allow your dwarves to go places, designated "you can walk here" zones. We have walls, floors, ceilings... what do we call these four-dimensional structures? Let's say, marquees. These marquees are difficult to put onscreen: floors are already annoying to represent, as they get covered up when anything is placed on the tile, or even when a dwarf walks across it. Thus, the marquees must be viewed separately, by, say, pressing some button (shift-M?), which will allow you to see where marquees exist or not, preferably in some blinking overlay of plus signs. Of course, you won't have to build a marquee for EVERY tile: for example, underground, unless you are inside a cavern (or there is a cavern ana/kata to you), you have solid rock in all directions. Once you hollow out a tile, a floor is created with it: why shouldn't a marquee also be created as well? However, generally, there's just one rule for building marquees (switch around ana and kata if you're kata of the home stack): if the same tile in the next stack directly kata to you is not solid, then you need to build a marquee. Otherwise, you can just be supported by the tile as it is. Having magma directly ana/kata to you is great fun, I'll bet...
To actually have your dwarves traverse between the layers, you must build/carve marquee stairs, analogous to regular stairs that let you travel between z-levels. On that note, you can also build marquee trapdoors, traps, et cetera... there is no greater fun than watching your opponent splatter on a marquee six stacks kata to you. "Oh no! Now I have to clean up four-dimensional blood!" Or drop him into your magma chamber that's completely walled off in that stack... there is so much potential.
There is also the matter of what to actually put on the other stacks. I have come up with three options:
  • Exactly the same thing. Boooooring.
  • Something procedurally generated from your regular landscape, possibly with platforms getting vanishingly smaller as you venture into further and further stacks...
  • The surrounding few tiles in the overworld, lined up in a Hilbert space-filling curve sequence (because one iteration is a function of 4n steps, rather than 6 or something), with your home stack in the center. This poses the most interest to me: what if you embark NEXT TO a haunted biome, or such? What if you are adjacent to a volcano? What if you are close to both a glacier and a forest? How about a glacier AND a volcano? Four-dimensional pump stacks operational...
Memory problems and such notwithstanding: I'd play it. Thoughts?

tl;dr what if you could have multiple planes you could switch between in fortress mode like z-levels
« Last Edit: February 25, 2012, 05:08:40 pm by mszegedy »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Four-Dimensional Dwarf Fortress (xpost. of mine from reddit)
« Reply #1 on: February 25, 2012, 05:13:38 pm »

Fascinating, not moddable >_>

Believe it or not, this has actually been discussed somewhat in the DFtalks, to be exact, DF talk #16:
Transcript
Download to listen

mszegedy

  • Bay Watcher
    • View Profile
Re: Four-Dimensional Dwarf Fortress (xpost. of mine from reddit)
« Reply #2 on: February 25, 2012, 05:17:33 pm »

Fascinating, not moddable >_>

Believe it or not, this has actually been discussed somewhat in the DFtalks, to be exact, DF talk #16:
Transcript
Download to listen

Wow. O_o

If you restricted embark size, and if DF was more moddable, then you could do it... like, how about x/y size specifies the different stacks, and each embark is only a tile wide?

EDIT: or 2x2 or something, and maybe not as deep
« Last Edit: February 25, 2012, 05:20:55 pm by mszegedy »
Logged

megiddo

  • Bay Watcher
    • View Profile
Re: Four-Dimensional Dwarf Fortress (xpost. of mine from reddit)
« Reply #3 on: February 26, 2012, 01:07:45 am »

Most everything you said makes sense, except the need for an extra 'gravity' force that pulls you along the 4th axis.

I mean, (on our 3D planet) DOWN is the direction of gravity, UP is away from gravity, NORTH/SOUTH/WEST/EAST are 'neutral' to gravity (non-scientifically speaking), and we really don't need stairs to walk east to west or north to south. Why should we need stairs to walk ANA and KATA? I would imagine they're just like N/S/E/W, just another direction to walk in. ANA and KATA don't need a pulling force on them, I imagine.

If a dwarf digs one tile toward ANA, I would imagine hewould be left in a single tile space with walls on all sides except for an open passage to and from KATA (which we can't see graphically, unfortunately).

tl;dr: ANA and KATA should be just like N/S/E/W in every way (but not like UP/DOWN).
Logged

voodooattack

  • Bay Watcher
    • View Profile
Re: Four-Dimensional Dwarf Fortress (xpost. of mine from reddit)
« Reply #4 on: February 26, 2012, 03:31:33 am »

This is not possible without access to DF's source code.

And even then, you'd have to go through every single 3-dimensional array in the game and switch it to a 4-dimensional one, updating every array accessor/indexing/looping operation and adding a fourth variable/loop to sustain the new dimension. (I'm not even going to go into path-finding, fluid dynamics, and UI changes)

Provided that all of this is feasible, memory consumption would increase exponentially.


Traversing a fourth dimension in code is not difficult at all, we store all kinds of arrays in a single dimension (flat memory model); bitmaps are two dimensional vectors stored as consequential rows of colour values (pixels) indexed with this basic function: f(x,y) = (y * width) + x

3D bitmaps are stored in a similar manner (voxels), for example: f(x,y,z) = (z * depth * height) + (y * width) + x

And so on..
Logged
A Dance With Ice and Fire
An open-world roguelike based off the world of "A Song of Ice and Fire" by George R. R. Martin