What role will data play in your game?
It doesn’t matter what type of application you’re building. Data will be important. You need to decide what parts will be driven by data and what will be driven by code.
But first, why is this important? I mean, you’re programming so shouldn’t everything be written in code? And what do I mean by having parts of your application driven by data? Data by itself is just a bunch of numbers or maybe some strings, dates, and flags that can tell if something is true or false. You can’t build an application of any kind with just data. You wouldn’t be able to make any sense of it. There needs to be code.
But you don’t have to do everything in code. As an example, consider the maps that I described in the previous episode. These aren’t the map data structure but a map showing the location of towns, roads, trees, and mountains in a game.
Now, it would be possible to specify in code that a tree should be located at some location. Maybe the constructor for the tree class takes coordinates right from the beginning. There’s probably going to be lots of trees in the game. So the code could go through a loop and read coordinates from an array of data points specified in the code. This is using data but listen to the full episode for a better way.
And if you like this podcast and want more, then your can select a reward level at Patreon. Every patron gets access to a special episode each month and you can even help choose the topic. Click the link at the top of the page to “Become a Patron.” Thank you!