Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Logic Objects  (Read 1684 times)

NemoNihil

  • Bay Watcher
    • View Profile
Logic Objects
« on: May 06, 2016, 02:00:13 pm »

Greetings to all DF Forum-Goers!

I've been playing for some time now, and I'd like to suggest something I believe hasn't been suggested before (or, at least, I haven't seen suggested before...). If it has, I am sorry for being redundant.

Well, let me get to the point: the way signals sent from levers and pressure plates currently work, even doing something as simple as a "two bridge airlock"-type entranceway becomes an exercise in dwarfputing. I understand completely that it may be completely dwarfy for there to be over-complicated machinery to accomplish simple tasks (Goldberg FTW!), and trying to put the necessary things in motion can be quite FUN, but, in the interest of the (lazier?) fortress designers, I believe it would be a good addition for there to be some kind of object that manipulated the signals sent by sensing devices (levers and the such).

What I envision is some kind of one-tile object that could be linked (with the cost of a mechanism) to other devices, and then could be set up to perform logical operations, the simplest (and perhaps most useful) of which should be NOT, but AND and OR also come to mind as very practical. And, if we want to be thourough, it wouldn't hurt to have XOR and NAND as well...

I fully understand that this behaviour can be replicated by all manners of dwarf logic, but it strikes me as a much more practical (and I'd wager less processing-intensive) form of creating all sorts of systems, so I believe it could be a great addition to the game.

Thank you for reading, and until the next time.
Logged

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: Logic Objects
« Reply #1 on: May 06, 2016, 05:13:53 pm »

I'm not sure what search terms you used to search, but you might want to try broader terms.  Proposing new mechanics pieces has been popular for a while.  Logic and dwarfputing mechanics were a major component of the Additional Mechanics thread was a major and popular thread back in the Eternal Suggestions Voting days, and managed to get 9th place.  As such, at least some of its suggestions were added to the dev goals under the header "Improved Mechanics".

In fact, if you haven't seen many threads on the topic recently, it's because minecarts radically changed dwarfputing and made it far easier than it had been, previously.  Minecarts are less space and CPU-intensive than fluid logic, and also solve some problems of transition between signal and power. (Likewise, the addition of workshop raws allows powered workshops to be added to the game, which quiets some of the concerns in that thread.)

With all that said, Toady has publically stated in the past that he is leery of outright machinery built for the purpose of being giant, physical logic gates, as what we can accomplish right now are basically happy accidents of emergent gameplay, not deliberate game goals.  Outright making mechanical logic gates isn't something he's supported in the past.  Hence, the Goldberg-esque nature of dwarven mechanics right now is somewhat deliberate, as far as I can tell.  Regular dwarves, and even regular Dwarf Fortress players, don't make these things, only some players do, and when they do, they're going against the nature of the world and gameplay.  Making fortress mechanics that outright demand the player be functionally programming with fortress pieces is something that changes the tone of the game in a way Toady may not agree with. 

That said, "moving fortress pieces" and having to assemble one's own traps mechanically on the map in physical space is something that already delves into this territory, already...

What I would honestly prefer (and have suggested in the past, actually,) would be "black box" mechanical buildings that allow players to program a set of inputs and outputs.  Hypothetically, this could go the extra mile of having a fully simulated internal space that simulates all forces that could be applied to it, and then creates an abstracted set of rules that it operates by when "zoomed out" again to normal fortress space.  This allows for hypothetically any arbitrary logic problem whose mechanical implementation fits within the confines of the simulated area of the box to be produced, including all basic boolean logic, although potentially with a greater degree of inputs and outputs.  This would also have the advantage of being computationally much simpler than a minecart-based, much less fluid-based "dwarfputer", as the internals of the system could be abstracted to "signals in" and "signals out".

Spoiler: to specify (click to show/hide)
« Last Edit: May 07, 2016, 08:11:38 pm by NW_Kohaku »
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Logic Objects
« Reply #2 on: May 06, 2016, 07:10:19 pm »

(Likewise, the addition of workshop raws allows powered workshops to be added to the game, which quiets some of the concerns in that thread.)

woah what no

NemoNihil

  • Bay Watcher
    • View Profile
Re: Logic Objects
« Reply #3 on: May 07, 2016, 06:30:17 am »

Thank you for pointing me to that thread. My stupid brain never remembered to tell itself to search for "mechanic" or something like that, so only by chance would I get to that suggestion. Well, sorry for repeating the suggestion.

Anyway, I wasn't aware of the fact that the developer slightly disapproved of logic devices built through Dwarf Fortress; I can understand that it may be somewhat gamey, and not "lore-friendly" (in the sense that a dwarf, in a fantasy world, might not have the knowledge/skills to do that kind of computing), but, since we already have more or less complex machinery represented in-game (I mean, you have to know some physics to create a pressure plate or a pump...), it doesn't take that much suspension of disbelief to think that it is plausible for some hairy drunken little things (no offense meant to dwarfs!) to develop some knowledge of logic...

In any case, your suggestion, albeit a bit more complex than having a "customizeable logic gate"-type building, should work even better and even cleaner than that.

So, thank you once again for showing me I was not the first to think of this. Let us hope that it becomes reality sometime in the future...
Logged

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: Logic Objects
« Reply #4 on: May 07, 2016, 07:48:13 pm »

woah what no

Your statement needs nouns and verbs to be intelligible. I cannot discern what you protest without them.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Logic Objects
« Reply #5 on: May 07, 2016, 07:50:44 pm »

Powered workshops are not and have never been possible to be added to the game with the raws.

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: Logic Objects
« Reply #6 on: May 07, 2016, 08:03:35 pm »

Powered workshops are not and have never been possible to be added to the game with the raws.

Hmm... That's funny, I thought people had made workshops using power before, but I don't see any tokens in the wiki to do so.  I guess my mistake on that part. 
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Dozebôm Lolumzalìs

  • Bay Watcher
  • what even is truth
    • View Profile
    • test
Re: Logic Objects
« Reply #7 on: May 08, 2016, 12:17:33 am »

It's possible with DFHack.
Logged
Quote from: King James Programming
...Simplification leaves us with the black extra-cosmic gulfs it throws open before our frenzied eyes...
Quote from: Salvané Descocrates
The only difference between me and a fool is that I know that I know only that I think, therefore I am.
Sigtext!

NemoNihil

  • Bay Watcher
    • View Profile
Re: Logic Objects
« Reply #8 on: January 23, 2017, 04:52:16 pm »

Hello. Sorry for necroing my own post (auto-necromancy, perhaps an idea to explore in the magic arc?  ;D ), but I had an idea last night, while drifting somewhere between consciousness and unconsciousness, and I was surprised by how (relatively) simple it was, but incredibly useful in terms of logic in the game.

Currently, signal processing (if you allow me to coin such a term) is handled in a way that seems... insufficiently standardized to me, with some objects (such as doors) opening with a signal and others closing (like bridges), some instantly, others not so much... I do understand that the way things are currently done does have some degree of sense, but it seems... slightly unelegant for it to be so.

What I propose is as follows:
  • All objects that can be linked by mechanisms have two states (more or less like it is now), "activated" and "deactivated"
  • Depending on the object, these states have different effects, quite similarly to what we have now, but an activated object sends a signal to its connected devices during the entire time it is activated
  • All objects should be able to be linked to one another, without regard to their type (so, we could get gear assemblies linked to levers, levers linked to pressure plates, and so on)
  • When linking an object to another, one should be able to specify the type of link, namely "Activate with signal" (the object remains in "activated" state while the object to which it is linked is activated), "Deactivate with signal" (the opposite, of course) and "Toggle with signal" (the object alternates between its "activated" and "deactivated" state while signalled, with a configurable delay - in ticks, perhaps? - between the toggling, and retaining its state while not signalled)
  • (Optionally, and if the inner workings of the system allowed it, there could also be a way for the user to specify a minimum number of received signals to enable the linking behavior, so as to allow for situations like "close the bridge if there are at least 5 pressure plates triggered" or similar)

At the programming level, I do not know what would be the performance impact of this change, but I suspect that it wouldn't be too overwhelming, especially since it would simplify most dwarfputing attempts and, I hope, dealing with any and all linkable objects too.


I did have another idea about implementing some kind of "counter-like object" that, in case what's described inside the brackets above is implemented, sends out its (integral) value as a signal, with its activated state corresponding to a kind of operation - say, multiply by the number of active signals that reach it - performed upon the number it stores (in essence, what one would call a variable in a programming language).

That is all. Thank you very much for your attention.
« Last Edit: January 23, 2017, 05:08:29 pm by NemoNihil »
Logged