PDA

View Full Version : ColecoVision Game Basic...



opcode
12-04-2003, 08:48 PM
My good friend Zaxxon has pointed me a new “creative game machine” being developed, the XGameStation. While the machine itself seems very early in development, there is already a BASIC compiler (called XGS BASIC) available for game programming, though the current version (0.6) is still in a very, very rough stage, almost useless IMHO.
Maybe a few of you already know I am planning an expansion module for the CV, and I found it interesting someone else had a similar idea, including a hobbyist programming language.
Well, while I am busy with several CV games right now, I was thinking about a good game programming language, mostly motivated by the disappointing XGS BASIC. In the first I thought it would be a good idea to develop a programming language around a conceptual machine (the above mentioned expansion), maybe an emulated one. But a little ago I realized it would be interesting to have a good base language developed before the module is even started. So why not create the language around the base CV.
It would prove a very interesting project for several reasons.
1) The CV is a feature rich machine compared to its pre-crash contemporaries.
2) A good game language needs several specific functionalities to allow the programmer to create games with little programming effort.
3) It needs to be very optimized, since the CV has just 1KB of RAM.

So I am thinking about creating a BASIC variation with the characteristics above.
Just as an example, lets think about a macro statement capable of playerfield scroll:

The CV is a tile (or pattern) based machine, meaning it uses 8x8 chars to create a game screen. Since the screen resolution is 256x192 pixels, it means we have 32x24 chars. Doing the math we end with 768 chars. Well, if we create a “frame buffer” to map characters on screen, we would need 768 bytes, which would leave us with just 256 bytes for game variables. So it isn’t a good solution. It is an example of limitation you will find with the CV.
But now think: what if we construct the screen from bigger virtual chars? For example, if we define big chunks of chars as our basic building block, like chunks of 32x4 chars (4 full screen lines). This way we would need just 6 bytes to define the whole screen! Of course I would define smaller chunks if I wish.

So lets do an example code:

Const Chunk1 as chunkline
Const Chunk2 as chunkline
Const Chunk3 as chunkline
Const Chunk4 as chunkline
Const Block1 as chunkblock #or array of chunkline, maybe
Const Block2 as chunkblock
Var PF[12] as playerfield #12 is the number of chunkblocks for this PF

Chunk1 = “34,45,78,56,01,02” #the numbers are character numbers
Chunk2 = “12,90,24,89,02,03”
Chunk3 = “34,89,12,90,00,02”
Chunk4 = “56,90,78,56,00.,09”

Block1 = “chunk1,chunk2”
Block2 = “chunk3,chunk4”

PF = “chunk1,chunk2,chunk1,chunk2,chunk1,chunk2,chunk1, chunk2,chunk1,chunk2,chunk1,chunk2”

# a playerfield var is a circular list
# PF[DISP] will return the current scroll pointer displacement inside a chunkblock, it means, the chunkline inside the chunkblock
# PF[START] will return the starting chunkblock in a playerfield, which will change as "scroll" is used
#PF[SIZE] will return the size of PF list, in this case 12
.....

on interrupt (30) do #it means the scroll will happen every 30 VDP interrupts (twice times every second)
begin
scroll (PF,1,0) #move the whole playerfield 1 char line down
end

#this small example will keep scrolling the screen every half second

Ok, just an example. We can extend it and create many other macros...

Thoughts, suggestions?

Eduardo Mello

ManekiNeko
12-04-2003, 08:56 PM
Sounds good to me! Will this be a BASIC compiler, and will it be capable of creating games on par with Coleco's commercial releases?

JR

opcode
12-04-2003, 09:24 PM
Sounds good to me! Will this be a BASIC compiler, and will it be capable of creating games on par with Coleco's commercial releases?

JR

Hi Jess!

Yep, it will be a cross-compiler for the PC. Well, I hope the language will be very optimized and capable, so I think it would be able to produce games on par with most commercial releases, if the programmer is talented enough... :)

Eduardo Mello

Zaxxon
12-04-2003, 09:33 PM
Is there a way you could make it so we could easily program games way beyond the 32k limit, having the technical bits of bank-switching somehow handled by CV BASIC for us? I read you would have to divide your program up into 31k chunks or something. I realize this would require a special cart design.

opcode
12-05-2003, 07:02 AM
Is there a way you could make it so we could easily program games way beyond the 32k limit, having the technical bits of bank-switching somehow handled by CV BASIC for us? I read you would have to divide your program up into 31k chunks or something. I realize this would require a special cart design.

Bank switching is difficult to control beyond the ASM realm, but it's still possible. The greatest problem is with the CV cart slot, which is very poor in bus lines (you just have address and data lines, but no R/W, etc).
We could use 8KB memory pages, and switch between them though reserved addresses.

Eduardo Mello

opcode
12-05-2003, 11:14 AM
A few more thoughts about Playerfield implementation with CV Game Basic...

GraphLine

GraphLine is a unidimensional array of graphic characters which will be horizontally presented on screen. A GraphLine array needs to be defined at creation time. It means, the array size and elements need to be declared at creation time and can’t be changed after it. The GraphLine data will be compacted at compilation time and will become ROM only data.

GraphBlock

GraphBlock is a unidimensional array of GraphLines which will be vertically presented on screen. A GraphBlock array size and elements need to be defined at creation time and can’t be changed after it. The GraphBlock data will be compacted at compilation time ifever possible and will become ROM only data.


Figure 1

WWWWWWW } GraphLine1 \
SSSSSSSSSSSS } GraphLine2 | GraphBlock1 (You can have as many GraphBlocks as you want.
BBBBBBBBBB }GraphLine3 |
HHHHHHHHH }GraphLine4 /

Dim GL1(W,W,W,W,W,W) as GraphLine
.....
Dim GB1(GL1,GL2,GL3,GL4) as GraphBlock


Playerfield

Playerfield is a bidimensional array of GraphBlocks which can be completely or partially presented on screen through a Window object. A playerfield array elements need to be defined at creation time and can’t be changed after it. It will become ROM only data at compilation time.

Dim myPF(2,20,GB1,GB1,....,GB2,GB2) as playerfield #this playerfield will have 2 columns and 20 rows.


Window

Playerfield are presented on screen through a Window object. For games which require scroll, usually yje playerfield will be larger than the visible Window. Beside that, sprites (movable objects) will always act relative to Windows objects. There can be as many Windows as desired, but usually just 1 or 2 will be necessary (a good example for 2 Windows is a head-to-head split screen game). Window dimensions are defined at creation time and can’t be changed, though it’s possible to change the associated Playerfield. Functions for showing, clearing, scrolling will be available. Window uses RAM to save pointers.


Screen

Screens make for the final object in this chain. Screens bound Windows objects together, positioning them on TV screen. You can create as many Screens as you want, but just a Screen can be used at a time. For example, you can create a intro Screen, a selection Screen and a gameplay Screen. When creating Screens, you need to define the composing Windows and their coordinates on TV screen. Functions for selecting, showing and clearing Screen will be created.


The structure above seems highly optimized from a memory usage point of view. Most important, a minimum of RAM is necessary, which is crucial with CV games.
If animation of large portions of a Window is necessary one would dynamically switch between Playerfields for a given Window. Small animations could be archived though GraphBlock animation (explained later).


Please, suggestions.

Eduardo Mello

Aswald
12-05-2003, 03:56 PM
Would there be a sort of ColecoVision Programmer's Reference Guide available? My Commodore 64/ Vic-20 programming abilities are all but useless for CV games, so I wouldn't know where to begin, even if I do get an emulator running.

Zaxxon
12-05-2003, 08:52 PM
Is there a way you can add a feature so that we can easily use MIDI music files(3 or 4 note poly only, of course) in our games? I think I've seen a program that will convert CV music to a MIDI file but nothing that will convert MIDI to CV format. There must be something like this already for the MSX.