Showing posts with label Covert Action in Space. Show all posts
Showing posts with label Covert Action in Space. Show all posts

Friday, October 06, 2017

Project 16: Covert Action in Space: Update 2

I've been working on my Covert Action in Space project and reached the point where I wanted to be able to see a graph of the spaces I'm generating. Particularly, when I was working on my first system, it was difficult to get a feeling for how the spaces work (or if they worked). At first I had been thinking that I’d look and find a simple algorithm to draw a graph and then implement that in something simple like Processing. Fortunately, poor google-fu prevented me from finding a good algorithm and instead I found GraphViz.


I'm not sure I want to work here, but I'd look for their industrial secrets.



Despite that tweet, I managed to keep my wits about me and realize that I don’t need to create my own graphing system, I just want to see a graph of the space layout. So instead of spending time learning a graphing algorithm and dealing with all of the problems that’s likely to create, now I just need to output a simple text file and let the magic happen.


GraphViz is great. It’s capable of doing a lot of stuff of which I only need it to do a little bit. To output, I need to make a list of all room connections and put it in GraphViz’s dot format. Internally I’m keeping this information in a map so that each entry has all of the rooms that a room connects to. This produces duplicates in the list, but using the strict keyword GraphViz automatically ignores those.
The code to generate the dot file works out to be quite simple.

And the dot file for the graph up top. Again I'm not particularly stressing GraphViz.



As I said, this makes it really easy to look at how spaces are connected and how those spaces work. I’m really glad I was able to get this working without needing to spend too much time on it.

The next job from here is to start laying out an actual floor plan based on the given space. I have a rough plan, basically starting with a default shape for each room and then expanding them to fit together. I can probably come up with something more complex, but as with the space generation, I’d like to start simple.

Saturday, September 30, 2017

Project 16: Covert Action in Space: Update 1

I spent quite a bit of time working on my first approach to procedurally generating spaces. I based a lot of what I did on [this paper] and ended up with a system that worked, but that ended up pretty complicated. It had a system for creating an arbitrary hierarchy of spaces, as well as an arbitrary rules engine, which provided systems for determining how rooms were connected to the outside and each other.

I had already finished that work when I first posted about the project and I thought I'd keep working with that system. I realized, though, that solution was overbuilt and over complicated. So I ended up spending a quick evening rewriting it. The arbitrary hierarchy was very difficult to maintain and creating rules that abstractly described space was frustrating, so I dropped all of that and went back to figure out what I needed to make a minimal viable product.

If my goal is to play with guard AI, then I need space for the guards to guard, furniture to play hide and seek in, graphics to see what's going on and some AI. Plus possibly an interface to play.

The new system was a little messy, but thanks to a timely beer with a friend who had just been reading Uncle Bob, I came out with a nice clean system. I now have:

  • A model which describes how to make a space:
    • Model rooms which include a room name and a probability that the room should be on the space. 
  • A space that includes:
    • A list of rooms and a map 
    • A constructor that builds a space based on a given model 

The first question I had was would it still be interesting. And I think (at least for limited test situations) it is. Using a basic model of a Hall (with probability 1.0), Office (0.75), Storage Room (0.6), Lounge (0.5) and Bathroom (0.25), it has provided an interesting set of rooms and connections that, I think, could each provide an interesting encounter in a game.


At this point, I’m just producing the text outputs of the system, but I think the above sampling produces something “interesting”. My evaluation for “interesting” right now is: Can I imagine how an interaction between my spy and a bad guy would go down in that space. For the samples above I think I can, and I think with more models, I can expand the interest of the space.

My system has a known bug right now in that it isn’t guaranteed to produce a fully connected graph of rooms. I think that’s a quick thing that I should fix in the near future. Other than that my next step is to put together a quick graph viewer to show how the rooms connect. Once that’s finished then it’s on to expanding the graphs to physical space.

The Books I Read - November 2024

November was a bit weird. The Hands of the Emperor is long, but excedingly good. I'm continuing to find Anna Lee Huber a very engagin...