Sponsored By

Sponsored: Putting real map data in Unity game engine - Philly Game Jam

I thought it would be fun to do a game about an evacuation of Philadelphia, and get that map data in a game engine.

July 27, 2015

3 Min Read
Game Developer logo in a gray background | Game Developer

Author: by Amanda Lange, Technical Evangelist, Microsoft

This article is brought to you by Microsoft

Late last year, I was part of the Philly Game Jam with some talented Philadelphia folks – TatianaAndrew, and Laura – at the Cipher Prime studios in Philadelphia! It was a lot of fun and we made a quick game called Evacuate Philadelphia which will be demoed at the next local IGDA meeting. It’s a little rough, but that is the nature of a game jam piece after all.

I want to talk about something that made me pleased about this game. The topic of the jam was “Deconstructing Philly.” I immediately thought it might be fun to use real Philadelphia data from the Open Data Philly project in our game. So I started looking through the data sources for something that might make for an interesting game idea.

One set of data available was the real evacuation routes for a disaster in Philly. I thought it would be fun to do a game about evacuation and get that data in a game engine.

The first step I took was to download the shape file here – Evacuation Data. From that, I got all of these files…

bunchafilesHm… what to do…

The database and .shp file here need to be opened in a visualizer. As text, they’re hard to parse. I used this open-source data visualizer:QGIS Desktop. Uploading the data file into QGIS gave me a visualization of the map:

mapdataqgis

Success! Real great-looking data! But that is not a game.

So now what? QGIS supports exporting the data as a DXF file. The .DXF is an AutoCAD format that can be read in Autodesk packages. So I export the DXF, and import that into 3D Studio Max.

It’s on its way to being a game asset now. But there’s an issue: there’s so many points of data on the splines imported that 3D Studio Max is choking on it. If I click on the generated splines, you can see that there’s tons of points here. If converted to a polygon – which made Studio Max chug, and crash several times – it works out to about 3 million plus polys with untold triangles.

mapdatahipoly

That’s way too much data for a simple game, and a lot of it redundant, with lots of points on straightaways that aren’t necessary to define the shape of the object. But it has to be converted into a polygon to get into the game engine at all, so I have to press on.

Fortunately, Studio Max has some built-in optimization tools that came in handy. Using Optimize, some selective welding, and about an hour or so of manual cleanup, I got to:

optimized

Much better! Not perfect, but good for the boundaries of a game jam.

Import my .Max file into the Unity engine, and add some quick buildings (some modeled by Andrew and some filled in with the “cube” object):

bunchabuildings

And it looks like a real city! It’s small here, so click to see in all its glory.

I was pretty proud of working out this process, so maybe it’ll be useful in your games and other hacks. Thanks to everyone at the Philly Game Jam this weekend for a fun time!

Are you a beginner with Unity? Check out the Microsoft Virtual Academy course done by some of my friends at Microsoft for some starter files and another neat tutorial.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like