Heyo, it seems like I might be a good person to join this thread since I'm mentioned in the OP
Yeah, my old blogspot is long gone sorry, but I do have some scraps from that project.
I wanted to be able to design an AI using an easy tile drop interface that could be used by non programmers. If you build something you think is intelligent enough, you can then watch your brain battle through some preset scenario or duel another person's brain.
Looking back at this makes me want to make this game all over again haha.
That AI editor looks totally sweet. One could easily build a game around just that. It's not quite what I had in my mind when I was asking about logic programming though. I'm more after thing where you specify goals and constraints and computer then figures out how to fullfil them. Or where you have a given situation and you want to check if it fulfills are the specified goals.
I see. So perhaps what you have in mind is first running some procedure that generates a basic dungeon layout without a lot of structure and features a priori, then running some kind of analysis procedure to produce a set of geographical facts about your layout (e.g. it has a dead end at some location, the distances between various points of interest, etc.), then using some logic engine to apply a set of rules using these facts to generate instructions to fill out features like stairs. I wonder if this is significantly simpler or better than coding if-else ladders by hand. It quite possibly is. Probably more data-oriented anyway.
The general idea of replacing code for decision making, which is often quite complicated (or isn't complicated and results in boring decision making), with code that computes some relevant facts then hands them off to a logic engine seems nice to me. The question is whether this really reduces the complexity or length of code.
That's the basic idea. I'll generate a graph that tells me how rooms are connected and then let the logic engine try and figure out the rest. It probably makes goals easier to understand at high level, but their actual implementation probably will be harder to understand, especially since this is radically different to what I have ever done before.
If I were to use those goals only in one or two problems, the effort for writing them would be too much when compared to the results. But if I could use the same routines for figuring out where melee and ranged fighters want to position themselves during combat or how to place some other dungeon features it might make sense.
I use constraints and attributes in level generation, though without any logic engine. Every tile contains a set of attributes, and every generator can add and remove attributes from a tile after doing its work. I can set constraints on where a generator will work, for example for a village generator I use and(not(MOUNTAIN), not(LAKE)). Some generators take constraints as arguments, for example for placing NPCs (usually empty tile).
There is a natural order to use the generators, typically: terrain, buildings, NPCs, items, etc, so I don't see any need for a logic engine here, but I may be wrong.
You can read a little on how I designed the level generation system here:
http://keeperrl.com/index.php?option=com_content&view=article&id=20&Itemid=102
That posting was interesting to read. But if I understood correctly, you can go only to one direction? After a generator has finished the given task, results of that task are final, unless some other generator overwrites them?
This is some pseudo-code that I wrote to highlight what I'm after:
(run 5 [q]
(fresh [chest trigger boulder dart-trap]
(next-toᵒ chest trigger)
(straight-lineᵒ trigger boulder)
(in-angleᵒ chest trigger boulder)
(condᵉ
[(long-distanceᵒ trigger boulder)]
[(medium-distanceᵒ trigger boulder)])
(next-toᵒ boulder dart-trap)
(≡ #t(chest trigger boulder dart-trap) q))))
I'm after maximum of 5 solutions to a problem where:
- there is a chest and next to it there is a trigger
- in a straight line from trigger, there is a boulder
- chest, trigger and boulder form an angle (so the rolling boulder will roll over trigger, but not break the chest)
- trigger and boulder are either long or medium distance from each other (preference to long distance)
- next to boulder there is a dart trap
- result of all this is a list of locations for chest, trigger, boulder and dart-trap
For example, if the initial placement of the chest is such that not all goals can be satisfied, a new location is considered and process starts from beginning. I could also fix the position of chest (or any other components) before starting and let the routine figure out the rest.
But all this is pretty far-fetched currently. I'm still learning how to write goals and programs and how to overcome even simplest problems.