Game Devlog - 0x08 - Implementing Tinymaps - Prototype

// = Game Devlog - 0x08 - Implementing Tinymaps - Prototype :id: 18b50fb1-0c37-4348-a960-4bfff9c05002 :author: Andrei Clinciu :website: https://andreiclinciu.net/ :publish_at: 2018-05-10 17:55:00Z :heading_image: /images/lba/tinymap_elixir_prototype_examine_functionality.png :description: \N :type: article :tags: :keywords: :toc: left :imagesdir: ../assets/

image::{heading_image}[] 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

image:file:///home/lostone/Notebooks/CyberProSecurity/Elixir_Phoenix/Life_Beyond_Apocalypse_Zombie/0x08_-Implementing_Tinymaps-_Prototype/tinymap_elixir_prototype_examine_functionality.png[image]image:/images/lba/tinymap_elixir_prototype_examine_functionality.png%20[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.

Comments:

Subscribe to my Newsletter

Receive emails about Linux, Programming, Automation, Life tips & Tricks and information about projects I'm working on