• Bubble
  • Bubble
  • Line
Game Devlog - 0x08 - Implementing Tinymaps - Prototype
Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-05-10T17:55:00Z
  • 2 min to read

DevLog 0x08 - Implementing Tinymaps and the RoadMap generation has been very fulfilling.

A lot of work has been put into importing JSON and working with it to generate the proper data structures.
Needless to say, there is a lot of data in the Cataclysm DDA JSON files which makes it AWESOME to work with.

One of the first things I implemented was the examine function and it's aliases (look - info - examine)
Whenever a player calls the examine functon without a thing to examine it always looks at the local tinymap.
Looking at everything it can see from a bird eye's perspective and will return the following:

  • A tiny map drawing 24x24 of what the location looks like.
  • A list with information of what each location means
  • A list of interesting locations we can search
  • List of items seen on the tinymap (those lying on the ground)
  • List of NPC players..
  • Zombies!
  • Other players (for the online version)
  • Many other things!

 

Needless to say looking at 1 item doesn't take energy, but when looking or examining multiple things (in our case 24x24 tiles) it does take 2 energy.

The examine function can be used with an item, character, direction, keyword.. This will need to be implemented in the future.

mix run -e 'LifeBeyondApocalypse.CLI.main("")'
.....
examine

Examne - Show INfo - function example examining local map zone

In the above context it generates a


Our prototype is complete. It works the same for all roads, non important places and houses.. As a Proof of concept and prototype it suffices for the moment.
We will update it in a further devlog. I've added 3 other functions which handle the rotation of a tinymap.

Extra Exercises:

Try to implement this in your project so each time you go to a new house tile a house is rotated by 1(90), 2(180), 3(270) degrees.
Combining this with the DataStorage module save each rotation so we don't show the same house rotated in another position the next time.

Implementing Items and a unified Game Database

The next logical step would be to actually be able to search for items with the new system. We're currently searching via the old one.
However if we need to load a new file each time or even if we loaded all json files to memory we wouldn't knowwhere to search exactly.
This brings us to a problem.. Our data sources are very tidy ordered in folders and files but we have to hardcode everything everytime which is NOT efficient.

So in the next devlog I'll create a Game Database that imports all JSON files so we are able to search what we need when we need it.

Ideas and comments

Andrei Clinciu
Andrei Clinciu

I'm a Full Stack Software Developer specializing in creating websites and applications which aid businesses to automate. Software which can help you simplify your life. Let's work together!

Building Great Software
The digital Revolution begins when you learn to automate with personalized software.

Find me on social media