Using real-world data in games

0 favourites
  • 2 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I remember playing the classic roguelike Nethack, and I always thought it was neat how the game would calculate the moon cycles in the real world, and, if I recall correctly, the player had a chance to turn into a werewolf when it was full moon. Then there are games that will let you run away from zombies in the streets of Chicago retrieved from Google Maps.

    I was wondering what options there are in Construct 2 to get data like that to be used in the game. There's date and time, at least, but what else? I believe mobile sensors can be harnessed. And what about interfacing with websites or other services in the web?

    Do you have any creative ideas, or know of projects made in other platforms that would be doable in Construct? I'm very much interested in the different possibilities.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you want to pull data from sensors you would need a plugin to interface with the hardware (If the browser supports it anyways), then it's easy to manipulate and format the data to what you need it in.

    But if you have data collected already - like in a file, but it's not in JSON or XML - you could use the token functions to split the text and parse the data into a format easier to use in Construct, like a formatted array.

    BINARY data is much harder though; Construct does not have native support for reading binary from disk. You could pull everything in as bytes, but for numbers like 16/32 bit ints (2/4 bytes), floats (4 bytes), and doubles (8 bytes, and more likely to run into if you're getting data collected for science), you'll need to find out what's what and use setbit and getbit on variables to rebuild them. This is far and beyond what you want to work with, so I recommend using a tool to reserialize the numbers into strings, which Construct can parse natively (Not sure about double precision though, or especially large numbers)

    Things like overhead pictures of cities and streets - like in the Google maps example you described - can scraped (read pixel by pixel) and used to associate colors to a tile in a tilemap, but a combination of edge detecting algorithms and grouping would lead to the most efficient results. Again, this is hard, but still possible to do.

    It's possible to do, but if you're doing it from scratch it's going to be a lot of work depending on what you're doing. If you can't find a plugin for the hardware you want to use, or to get data from a server in a format you can use, and you REALLY want to do it, you'll have to dig deep and either make a plugin for it or use events.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)