Putting Real Map Data in Unity Game Engine – Philly Game Jam

In November I was part of the Philly Game Jam with some talented Philadelphia folks – Tatiana, Andrew, 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!


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *