Thursday, June 27, 2013

Could the world of Doriath from C64 fit into the Coleco Vision? (Part 1)


Everyone need to relax sometime. We usually play or do one of our favorite activity. Could be your best video game on your latest iPhone or a puzzle like SUDOKUFor me, my real puzzle I have are rated: Expert! In fact, they often cannot even be solved without some specialized assisting tools!


Back in June 2010, I went to a Coleco Vision/Adam convention near my place where I did a speech. Having not follow what was going on since then, I look back on YouTube last week-end and watch one presentation made last year. CollectorVision was there presenting a brand new Arcade Joystick and also new games. I am amaze to see that hobbyist produce what was the cutting-edge technologies back in 1984! Also, they promise more games to come for 2012.




Thinking about games... On my first computer, there is 1 game I play seriously in my childhood: Doriath. Back then, we (me and my brother) got dozens of diskettes with games. Most of the time, we just LOAD them, try and go to the next one. But, that one seemed easy if you are patient enough. It's an adventure game which look more like a puzzle. You have to find new amulets that allow you to kill a specific type of enemy. And when you kill an enemy in a room, it's gone forever! Plus, don't be impress by the fire or water, they do almost nothing.


Wow, Great, playing this game to the end will be a piece of cake!




But there are a lot's of rooms... the maze consist of a 16 by 16 rooms map (256 rooms). And after playing for more than 3 hours, we were still looking to the QUASILIN's amulet. 

Me and my brother got really serious about it! Let's draw each room to monitor the places we already visited and what was there! We end up with many many pages with room diagrams... But based on our maps, the QUASILIN amulet was missing in the game!!!


We may not have reached the end of the game but it was a good team effort for us. Both tie together to reach a single goal! Just to say, the ending of this game is even more strange than this...

Hum, I think it's on purpose that this game seem easy, but the reward you keep looking at cannot be achieve. I think the author probably design it as a lesson of life.


But, back then we felt bad about it and though: it's nonsense, must be a bug in his game!!!



Back to the Coleco Vision, were deception could also be found. That was our very first (and last) video games system we got together. We bought a lot's of cartridges and when looking to the system box or game guide that come with it, there was some games which we never found in store. We though, maybe it's our stores!? But end up that those games (like Side Trak) where vaporwares!



However, Collector Vision's guys are working hard to make them real! Including the cartridge box and instruction manual! They released it in 2011. They design this game on what they believe the game would have been. Because that game never got released on any other system!

---

Then, I was thinking... if Doriath could have been made for the Coleco Vision? Probably, yes? 




I knew someone already did a map capturing all 256 rooms into one big .GIF file. I will just need to extract the common tiles (8x8 pixels on C64) and get a way to display them on screen, and you could get the 256 rooms!

A long week-end, a rainy day or two... a not too busy schedule. As I work on some home tasks, I kept thinking about it and though, I knew I already have coded functions to LOAD and SAVE image files somewhere. All I need is a modified version of the map (where I will remove the enemies and a couple of adjustment here and there). Then I will code something to parse the image to get those tiles within one image file.

Some people still familiar with the C64 might think: or just use a C64 emulator memory viewer to view the tiles directly? Bah, I don't like cheating... got to find the solution from reverse engineering things.



I started to clean up the map by removing the enemy. I clean up the water (removing white dots and waves effects) and I remove the fire flames tiles. Also, I put back the colors of the chest box which was colored in the map I find to identify what are in. But, in the actual game they are all the same brown color. 

Did I mention there are 256 rooms? Well, yes... it took some time.

Once the map was cleaned, I convert it into .BMP format. Within couples of minutes, I got a first program loading and saving the image into a different name, just to verify that the LOAD and SAVE were working properly.

Tile Extracting Information File

I though to extract the tiles but also keep note for each tiles where in the image they were first taken from. This is to help validating what is going on. After all, maybe the clean-up process did left some pixels here and there.





The answer... 91 tiles! How much I was hoping for? Well, it has to be less than 256. I was hoping for half or less than half. I know more tiles need to be added for graphic effects and giant enemy.

This result is good. My puzzle solved? Well, not exactly... there are 256 rooms and each room contain 40 columns by 20 rows of tiles. If you store each room as they appear on screen, it will take 200 Kb to store them. The C64 has only 64 Kb and the ColecoVision only has up to 32 Kb ROM.

The tiles are assembled together to form objects which are used to draw each room. How many of those meta-tiles are needed?

This question is harder to answer than the previous one. First, the meta-tiles has different sizes. I also don't know how they were assembled to form the final layout. Maybe some were placed partially on top of other meta-tiles?

Our eyes can easily see and recognize patterns. But there are just too many graphical elements to extract them one by one. First, let's see how the rooms look like by generating text output using the tiles index  from my extracted tile bitmap.

Here, the letter W represents water (a blue tile).

To make a short story of how I extracted the meta-tiles, I create a system which deconstruct every room into the biggest meta-tile which can be find elsewhere in the map. The system take as an input a series of meta-tiles which are use to clean the map before processing it. This way, I can take out objects which are obvious or target those which I want to be separated anyway. The more meta-tiles I add in the input directory and less content are left on the map.


The answer... 95 meta-tiles. So, would the game be feasible on Coleco Vision? Well, 256 rooms it's a lot and 32 Kb it's small! This give 128 bytes per room... and at 128 bytes you are not getting a game but just a useless piece of data. Hum, so this problem is a quest of size-efficiency!

Another problem ahead... The graphic resolution on a Coleco Vision is 256 pixels by 192 (32 tiles by 24), while the C64 is 320 pixels by 200 (40 tiles by 25). Both system use the same tile size (8 x 8), but the Coleco Vision has 8 columns less than what we need. Also, rooms need to fit together on the map to stay consistent, so part of it as to be remove carefully.

To develop an automatic tool, first you need to know all the rules. Here, I just don't know until  I visit each room more than once and list those rules out. The solution I came up with is to generated an image which can be easily read by human and computer to visualize the meta-tiles. I will then modify each room by starting with the one I know what to do. Placing those modified room into a new map like the one generated. This new map will then be read back by the computer which will be replacing the old one.

The visualization read by the computer consist of a green (I pick up green color has no tiles contain green) rectangle around each meta-object but where RED and BLUE are equal to the meta-object ID.

Note: map color has been modified, to show as blueprint. Normal color are black (background) & green (lines).

Here you see just a portion of the map. But, the giant blue print is really impressive by it's complexity and it's size.

But to be human readable, we need to see the actual map. I need to know what I will be removing or changing and how it will look like.



Here I am back to Step 1. With a map to modify and with another long week-end ahead!

But...  would it rain?