PROCJAM / 7DFPS 2018: Day 4

PROCJAM, 7DFPS

Day 1, Day 2, Day 3

Building Burning Man is really fun, so I neglected the photography part of the game to generate even more types of things.  I happen to have an extensive list of galleries of photos from Burning Man, so I perused a few of them to see what types of tents and vehicles people used in their camps.  It turns out that’s the least interesting part of Burning Man.  Most people photograph the huge installations, the mutant vehicles, or their friends, not the tent they sleep in 3 hours a day.

I made a few tents, a small cargo truck, a “fifth wheel” trailer, and a school bus to put in camps, as well as a street sign for intersections.  I had to look up dimensions, because I want these objects be the proper size in the world.  I still create 3D models in Milkshape, a program I got almost 20 years ago to do Half-Life 1 mods.  This encourages a low-poly, flat-shaded styles, since I don’t have the skills or the tools to make fancier objects.

Now that I have these objects, how do I place them into the city blocks I have defined?  I have an algorithm for packing rectangles into a 2D space from last year’s PROCJAM entry: Spaceship Wrecker!

The constraints are different.  Instead of packing a per-determined list of parts into an unbounded space, I want to fill a bounded space with whatever will fit. I also had to pad the dimensions of these vehicles and structures, since people need space to walk between them.  I pick an object at random, and if I have to push it out of bounds to avoid colliding with objects that have already been placed, I discard that object and count a failure.  After a certain number of failures, I figure the camp is full and move on.  Since the algorithm pushes objects in all directions equally, it works well for squarish camps, but not for the very long camps at the far rim of the city.

This algorithm still needs improvement.  I could try something more like Tetris, where I try to fill things up from one end to the other, or I could just use the current algorithm at multiple points along the long campsite.  With relatively cheap, simple algorithms, and especially with the time constraints of a game jam, finding the most efficient solution may not be worth the trouble.

To make camps look unified, structures in a camp will have similar colors.  How similar? That varies by camp. The camp in the foreground above has blue, green, cyan, even purple, but the ones behind it are all green or all magenta.

So I planned to generate photos, and what am I generating?

  • Width, number, & spacing of radial & concentric roads
  • location & size of landmarks
  • Structure type, structure position, structure color, and range of structure color.in camps
  • Also photos, I guess

PROCJAM 2018: Photo Copy, Day 3

PROCJAM, 7DFPS

Day 1, Day 2

Now that the game could display photos and the player could move around to recreate them, I wanted something to photograph.  The weird snowy test map with its bright primitive shapes wasn’t doing it for me.  But what landscape could I create that would have cool landmarks and not be too hard to navigate.  Well, remember the toy I made back on day 1 that had no relation to this project?

Burning Man is a geometric city on a flat plain.  It can’t be too hard to generate radial and concentric streets, right?  Man in the middle, temple in the gap where the roads don’t touch. Simple, right?

Yeah, it’s pretty simple.  I’m approximating the concentric roads with straight segments between the radial roads, which mostly works.  After defining the roads, I defined “blocks”, spaces between roads where structures could go.  Most would be basic tents & shelters, but a few would be landmarks.

A mistake in the code that rotates the blocks into place created something that looked like the solar collectors from Blade Runner 2049.  While cool, that’s the wrong sci-fi alternate universe.

The block in the center will eventually be the giant “Man” statue, and the large cylinder will be the “temple”

These temporary assets are already more interesting than the old landscape.  The shape of the city creates pleasing leading lines.  I did increase the height of the player character and the AI photographer to 6 meters so they can see over the camps, but are still shorter than the landmarks.  Maybe they are piloting quadcopters. If so, I’ll have to remove the footstep sounds that came with the FPS controller.

PROCJAM / 7DFPS 2018: Photo Copy, Day 2

PROCJAM, 7DFPS

Day 1

Today I worked on mostly the non-procedural parts of the game.  Of course the procedural generation is the reason I’m doing the jam, but I have to build a game around it so that other people can actually find and experience what I generate.

Updates to the AI photographer were minor.  Instead of placing the camera completely anywhere on the terrain, I picked a distance from my selected landmark based on that landmark’s size.  Distance and a random angle gave me X & Z coordinates, and I ray-casted downwards to place the AI Photographer on the terrain.  That ensured the player could reach the same position.

Setting up the camera views were trickier.  Unity can send a camera’s output to something called a RenderTexture instead of the screen. I thought I’d make a few of these RenderTextures, get the AI photographer to render photos to them, then display them on the UI.  But I couldn’t figure out how to do that, despite clicking around in the Editor and the documentation for a while.

Instead I decided to have two cameras render to the same screen.  On the left, the player’s view, controllable with standard FPS controls.  On the right, the AI photographer’s view.  There’s a key to hide the AI photographer’s view and fill the screen with the normal FPS view.  There’s a nice transition where the FPS view shrinks and the AI photographer’s view slides in from the edge of the screen.  In photo comparison mode, both viewports are square, regardless of the window the game is running in.  Again, the player needs to be able to recreate the AI photographer’s photos perfectly, so the two views need to be identical.

With the cameras sorted, I was able to play the game!  Even in its simple form, with temporary assets and no scoring system, I found it very satisfying to match up every little thing in the photo.  I’m probably biased, since I really enjoy composing photographs with physical cameras, but it’s a good sign that this game is going to work.

PROCJAM 2018: Photo Copy, Day 1

I’m participating in PROCJAM, a low-pressure game jam whose motto is “Make Something That Makes Something.”

What should I generate?  I like photography, and I had an idea for teaching an AI to generate photographs of landmarks in a landscape. The player would walk through the landscape to the location where the photo was taken.  Breath of the Wild and Skyrim both have sidequests where players try to find a location based on a drawing or photograph, and I enjoy them.  I also relish the chance to pass some of my photographic knowledge on to an electronic protege. The player’s goal in my game is to replicate the generated photograph as closely as possible, so I call the game “Photo Copy.”

I had uninstalled the version of Unity I had used last year to create Spaceship Wrecker (play in your browser, blog post), and thought I might as well get the latest version instead of re-installing that one.  So I downloaded Unity 2018.2 and set about trying to mock up some test assets: some terrain with landmarks on it.

I didn’t enjoy sculpting the terrain in the Unity Editor. I wanted vertical walls around the edge to keep the player contained, and thought it would be easier to make them by drawing a heightmap in an image editor.  Alas, Unity only accepts heightmaps in .RAW format, and my image editors didn’t output to .RAW.  I found a tool that could import a normal image (BMP, PNG, or JPG) and output a RAW, so I had to use 3 programs to get my terrain.  GIMP -> L3TD -> Unity.

I needed normal FPS controls for the player to move around on the terrain.  Surely something like that is included, right?  Forum threads indicated it was, but those threads were old.  Previous versions had “Standard Assets” included as part of the installer, but this version didn’t.  I would have to use the Asset Store to download them separately.

Last year I used MonoDevelop as my code editor.  Visual Studio felt like overkill, and it was another account to create, another EULA to accept.  Unity 2018 dropped support for MonoDevelop.  Visual Studio was my only option.

Because of this sequence of frustrations, I uninstalled Unity and looked at some cool photos from Burning Man.  All the art installations and quirky camp themes are fun and inspiring.  I started another Tracery project to generate some wacky camps.  I’ve used Javascript and Tracery a lot, so starting a new project and getting some output was quick and easy!

I considered using Cheap Bots Done Quick, to put the output in a Twitter Bot, but I don’t see many benefits to that format, so I kept it on a local webpage. What a fun distraction that is not at all related to my PROCJAM project.

Feeling much better, I downloaded Unity 2017. Now I had the First Person Controller and could write code in MonoDevelop. Once i had the landmarks in the terrain, I made the first photography algorithm: place the camera in a random location, high above anything it might collide with, and point it at a random landmark.

It is technically a photo!  That was enough excitement for day 1.