Well, hello again, boys and girls of the internet! 👋
Today’s article is all about how Ghent Theft Auto uses open data to build the world and drive gameplay.
First things first. What exactly does ‘open data’ mean?
In the case of this article, the term covers (geo-tagged) data that’s available freely in many forms: from fully fledged out API’s with GET and POST calls to geotagged serialized .xml or .json on disk, specialized spatial files like .shp or .geojson in software like QGIS, GeoPandas dataframes in Python, rasterised tilemap images, satellite imagery, weather forecasts, etc.
Anyway, regardless of where and how I get the stuff: the search for inventive ways to leverage this data is easily one of the most fun parts in developing my monster pet project! 🤓
Open Data Gent
Ghent hosts and distributes a slew of datasets about things like population numbers, car parking occupancy, vegetation coverage, schools, hospitals, public transport, etc.
Some of the use cases are pretty obvious, stuff that you think of instantly.
Like: gathering every single tree in the map’s area, converting their coordinates into a custom coordinate system, splitting them up by the tiling level and ray-casting them to my terrain, giving them attributes such as their species, plant date or height, parsed from a live link.🌱
Then there’s more unexpected ways of using open data. Take for instance, the dataset containing the doctors of Ghent.
When a player dies in Ghent Theft Auto, a global Death() function is called. After taking care of the basics, this function checks where he/she died exactly and then finds the nearest doctor, who in turn sends a ‘respawn request’, literally respawning them at their front door.👩⚕️
Likewise, the people populating the game’s world went to the same schools as me and my friends have gone to, they’ve been born in the hospitals of Ghent, the postmen collect letters from real mailboxes at the right time, shops open and close at their real-life hours, public transport runs in real-time, etc.
The vast array of available data out there theoretically even allows me to spawn the correct types of trash in the right streets on appropriate days, having it get picked up in the morning by garbage trucks following the streets and traffic rules I parsed from online sources.
I’ve thought of using Natural Language Processing and the Wikipedia API to fill in eventual gaps in the data. It kinda feels like the only limit is my own imagination. There’s so many possibilities. 🙃
Now, you may think I’m wasting my time on details such as these, hear me out for a second. If there’s anything I’ve learned from my two years stint making architectural visualisations, or the countless hours I plunged into open world games, it’s that that the devil is always in the details.
To really sell the illusion of computer graphics, the background matters more than you think. It’s the things your eyes only pick up in a second or third pass, maybe never at all, those are the things that make you believe an image.
Making a timelapse of Ghent Theft Auto using a fully functioning day/night cycle, hooked up to any open data I can parse, has been my dream since I’ve started learning programming about a year ago.
I’m pretty sure I’m just around the corner of finally pulling it off. 🤸♂️
Open Street Map
Open Street Map (or in short, OSM) is the second big source of the data framework that the game’s world is built on.
It’s very much like the Wikipedia of online maps: users can enter, edit and remove all kinds of geolocation data using the web client or specialized software. OSM doesn’t only act as the source of a whole range tilemap servers, it also powers stuff like reverse geosearching or outright data downloads.
Open Street Map’s biggest strength is easily the huge community behind it. Allow me give you an example.
In September 2018, just a stone’s throw away from my beloved Sint-Baafskathedraal, a major infrastructure project was completed. Two rivers were rejoined, restoring a waterway that got filled in during the sixties, in order to create more parking space. 🙄
While Google Maps, Apple Maps, Bing Maps, etc. are still not up to date, four months after project completion, OpenStreetMap-based tilemaps literally had water running through the ‘Nederschelde’ on the exact same day as in real life.
Believe me, I checked. 🧐
The notion of user generated maps has the direct result of there being lots more data for low population areas, as people rely on OSM for hikes and bike trips. There’s also a lot of information about the accessibility of places for those of use who are less mobile.
Some major players in the tech industry build their services on Open Street Map, for example: Foursquare, Facebook, Niantic, Flickr, Uber, Strava, Craigslist, TripAdvisor, Snapchat, etc.
I’m actually pretty sure the open source mapping provider has better coverage than Google’s or Apple’s maps for the Flemish region. Maybe I should write some unit tests for backing up my claim. 😉
Anyway, and did I mention all of these services are 100% free? 💕
All these factors allowed me to rely solely on OSM as the data source of my map building tool, read about it in Making Ghent Theft Auto with Python 🐍.
My long term goal is to also to write data from my game back to the servers.
Not only as a way of giving something back to the service/community but more importantly: as a way of building my game.
I got the idea from collaborative world building games like Minecraft or Open Rollercoaster Tycoon, where I would see friends of mine toil away for hours in their shared multiplayer worlds, making a complete world out of empty maps that are now just gathering dust on some disk or server.
I figure, if I could deliver a multiplayer build of a city’s digital twin, it would basically build itself.
Yeah. That one was pretty meta. Sorry. 🙈
Next time we get practical again, when we get to read ‘Making Ghent Theft Auto using Blender! 🤖’. Stay tuned!