[DEVLOG]Pandemic

If it is Mercator then we merely need an adaptation of the code from this answer:

2 Likes

Excellent! I will either figure out the correct algorithm or change the mapping format in use, whichever is easier.
Probably I will make a separate tool.

1 Like

The link to the map he posted is labeled as a Miller projection. Is this not the case?

Either way if the map is using a standard projection then there should be a simple formula for projecting a set of latitude and longitude coordinates to image coordinates. From there it would be relatively easy to create a list of cities and their latitude/longitude coordinates and pre-compile that list into a list of image coordinates. When I downloaded the image he linked to and tweaked the formula slightly to account for the oddities between the northern and southern hemispheres the resulting image coordinates seem to line up really well (adding a slight offset for the prime meridian not being in the exact center of the image, though I only guestimated an offset by projecting latitude 0).

2 Likes

#DEVLOG 6

Added “dust trails”. Here are the animation frames:

Only up and right positions should be made. The other positions can be handled by mirroring and flipping. I just play this animation in one position and after it has been finished, I play it in the next position.

This is how it looks in action:
pandemic6_b

8 Likes

#DEVLOG 7
After a long sidetrack, I am back in the Jam again!
I have tried to the map city coordinates to the pixels (Miller projection). While still not perfect, but I think I now have quite good results.
worldmap_test

I am precompiling the pixel coordinates using a Python program in PC. Then I am going to embed the resulted array into the MicroPython game.

I prefer the Miller projection over Mercator because the sizes of the countries look more realistic.

6 Likes

We need to add Quebec, Canada in there! :wink:

2 Likes

Can’t wait to be able to deliver the remedy to all those cities and futures one, including the elusive Zero City !

3 Likes

It’s actually called “Null Island”, and it’s a tiny weather buoy rather than a city:

3 Likes

Damn 
 the pandemic has come to Melbourne. I thought I was safe.

Athens appears to be floating towards Turkey - this could start a war!

1 Like

#DEVLOG 8

I have now 200 world capital cities to start with :slight_smile: I found the table here: https://lab.lmnixon.org/4th/worldcapitals.html
So I copy-pasted the table to a text file, wrote a python function that reads a simple text format and used that as a source for the processing and outputting a python list with the city name and the map pixel coordinates, like this:

cityData = [
   [ "Akkala", 123, 456],
   ...
]

The python script for processing the table is here: https://github.com/haviital/pandemic/blob/master/tools/gencoords.py

Here are the capitals marked in the map:
image

The resulting picture above reveals interesting things. For example, I did not know about this capital before: https://en.wikipedia.org/wiki/Saint_Peter_Port.
There also seems to be a huge number of capitals in Caribbean.

5 Likes

Hey 
 what’s that one in the middle of the Atlantic?

I assume the one near Australia is Dili (East Timor), but what happened to the island itself?

982c2de4a50de3dba789856f4f7987d4aca33cd1

I am loving where this game is going (no pun intended) - its sort of like ‘Where in the world is Carmen Santiago’.

2 Likes

We also now have Pokitto users in the Caribbean which I think is just super cool!

3 Likes

The data shows it is Jerusalem :laughing: That was a mistake (31.71N,35.10W) instead of (31.71N 35.10E).

I know their neighbours have been hoping they would move for years but that is ridiculous.

Besides, I am not sure Finland recognises Jerusalem as the capital of Israel. Australia does but many countries do not.

1 Like

#DEVLOG 9

Time to optimize! As expected the city list is too big for Python and resulted out-of-memory error (in RAM). Firstly, the list goes to RAM (and ROM), and secondly the list is very inefficient as e.g. all values are 32-bit.

The solution would be using a Python “bytes literal”. That is a block of bytes that is allocated in ROM. For that I need to pack the needed data to bytes. I use only that much of bytes each field needs, no more. Below is an example. Each line is a city record.

citydataBytes= b'\
\x0a\x4b\x61\x62\x75\x6c\x01\x67\x00\x8e\
\x0b\x54\x69\x72\x61\x6e\x65\x01\x10\x00\x7f\
\x0c\x41\x6c\x67\x69\x65\x72\x73\x00\xf2\x00\x89\
...
'

The format of the city record is as follows:

\x0a\x4b\x61\x62\x75\x6c\x01\x68\x00\x8c\
 ^-^-------------------------------------- The city record size in bytes (e.g. 10)
     ^-----------------^-------------------The city name (e.g. "Kabul")
                         ^-----^-----------The x coordinate (e.g. 360)
                                 ^-----^-- The y coordinate (e.g. 140)

So the record length takes only one byte and each coordinate takes two bytes. As there are currently about 200 cities each saved byte means 200 bytes less used in ROM. The whole array is saved in a bytebuffer sequentially, which means that to find the 150th record I have to go through 149 records before it, but it is not a problem in this case as that is done only when a target city is raffled.

The total ROM increase was roughly about 3 KB for 187 cities which is very reasonable, I think.
Also having the record packed like this makes it a bit harder to snoop the city coordinates from source :wink:

As there are no fancy pictures this time, just the boring text, so here is one for you!

4 Likes

I just copied the (erroneous) data from here: https://lab.lmnixon.org/4th/worldcapitals.html
I also noticed that Tokio is totally missing. Have to fix that too.

By the way, if these are meant to be headings,
you have to leave a space for the markdown parser to interpret them properly.

I happen to enjoy boring text.

1 Like

Good to know someone actually reads my devlog :wink:

4 Likes

As opposed to just turning up for the pictures and giving a like regardless? :P

2 Likes

The text is where the awesome details are :slight_smile:

2 Likes