The Trouble with Transparency

I recently recorded and uploaded my 2nd update video to Youtube.

It documents my progress on the isometric game project I am working. Pixel transparency was a big issue I had to work out in the initial phase of developing the main game screen. When I developed the isometric tile drawing routine I noticed that the existing software was not designed for transparency or overlapping textures, both of which I needed for my game.

So I found the inline assembly code that is used to draw all the textures for the game and started modifying it to suit what I needed. On the original white background it looked as though I had accomplished what I needed, but when I started on the main game screen with a black background the errors in the algorithm were easy to spot. You can see in the video the specks of white.

The way the textures are designed, a 0 in either nibble of a byte means ‘draw nothing and do transparency’. So you should never have a white (color 0) dot drawn by the algorithm. So it was obvious that somehow a 0 was being placed in a byte and then written to screen memory. I looked at the code and realized that while performing bit manipulation I had changed the original value and introduced ‘0’s, but forgot to restore the original value before writing it to memory.

A second harder to find error showed itself with pixels that showed transparency when they should not. I found that when performing a comparison to decimal 16, that if the compared value was >$7f, the algorithm would branch to an unintended destination. After some digging in my 6809 manual, I discovered that the CMP opcode can only be tested with 4 branch opcodes. I was trying to test it with other branch opcodes, therefore it was showing what look like weird behavior when actually it was doing exactly what I told it to do.

I fixed those two bugs and did some testing to see if I could find any other issues, but everything seems to be working fine. It’ll get much more testing as I implement the gameplay.

As you can see in the video, the upper left of the main game screen contains a viewport which will be the play area of the game. The lower left gives information about how much crop the player has in stores. Next to that it shows how much money the player and AI currently possess. To the upper right is shown the value of each type of crop at the selling point.

Next, I want to do a little code cleanup. I’ve been really sloppy, especially with commenting out stuff and leaving it during testing. I would also like to create some functions to generalize the code and reduce the overall code size. After that, it’s head first into gameplay.

That’s all this time, talk to you next post!

Lets’ get this party started!

So, I got an email reminding me that the CoCoCrew are holding a CoCo project contest with CoCoFEST on the horizon. I have been wanting to attempt an isometric game on the CoCo so that will be my entry into the contest. I tried creating one years ago in BASIC and it was way to slow to be playable. This time around I plan to use the CMOC Compiler (w/inline assembly) on a CoCo3. I will be using Ubuntu Linux and Visual Studio Code for my OS and IDE, and MAME for emulation.

On the CMOC site I found a link which took me to a github with a program written in CMOC called Splinter. The game is rendered in 320*192*16 color mode and has keyboard and joystick routines in the source. It is a great base upon which to build. I wanted to use the 320*225*16 color mode, but with the limited time frame having a solid base to work with is more important that a few more line of resolution. To be clear, Splinter is not isometric nor does it have isometric routines , but it does have well written blitting routines, keyboard routines, joystick routines, with many critical pieces written with inline assembly. Having these routines available should enable me to have a shot at getting something playable in the time allotted for the contest.

The game is going to be a simple farming game. Name to be determined.

My goals for the project are:

Develop the fundamental routines necessary for the typical display and gameplay in most isometric games.

Use these routines and lessons learned from this project to make a more complete isometric game.

Have fun and get a playable game done for the contest!

The project objectives will be:

Create a intro screen for the game.

Create a main game screen with an isometric diamond map for the playfield.

Implement controls that will allow for plowing,sowing,growing, and harvesting several different crops. Types to be determined.

Implement an economy for selling crops. This may be the win condition of the game.

Implement AI to compete against.

I think that’s plenty to try to accomplish in the time available. I will also be posting progress videos on Youtube under my NukeJunkie account. Type it just like that (with the capitals) since there are several similar account names on Youtube if you want to follow along. That’s it for now. Wish me luck!!

Create your website with
Get started