Well, I saw an interesting 8-bit programming competition, and I thought I'd write an entry.
A roguelike. In 10 lines of 8-bit Locomotive BASIC on the Amstrad CPC. Well, to be fair, it's barely a roguelike, apart from the overhead view, and the fact you walk into monsters to kill them. Otherwise, it's a multi-level collect-the-gold game with very slow lethargic hungover monsters. Like many roguelike games, there is certainly an aspect of grinding if you want to get every gold and kill every monster.
In terms of random map algorithms, this has a very primitive 'spam rooms onto map' method that can lead to blocked off areas. And 10 lines of code is not very much, even if they are long lines.
Here's an example first level:
And here's a sample eleventh level:
The monsters move using a 'Doctor Who and the Daleks' game mechanism - that is, they head straight for you if they can. Also the concept of HP, CP, stats, is simply not there - not in 10 lines! Maybe someone else can squeeze that in!
Sunday, 12 February 2017
Tuesday, 31 January 2017
Agile 8-bit RPG Design
Agile. A wonderful process for some, a barren desert for those who like scenic waterfalls. But I'm not sitting around for two months researching RPG design and coming up with concrete final data structures before populating them with my game data. Now most of this project's dev process is going to be closer to Cowboy Development of course, but it's my project.
Regardless, I'm going to need an easy manipulatable data format for my in-development game that it easy to modify when I make changes to the engine because I haven't thought things through. But such a format is not going be directly usable in the game.
So I will need tooling.
My initial idea is to use a readable plain-text format for game definitions - I'm considering YAML right now - and to create some build tools to compile these into the final binary game images.
I'll probably do the same for the graphics, converting easy-to-edit PNGs into native CPC format and embedding them into the cartridge image.
And I'll need some metadata to tie everything together so everything knows what everything else is, and the game is linked properly, and my conversation trees are attributed to the correct NPC and my quests award me the Elven Sword rather than the Clay Pot.
And it might make the game data itself nicely portable.
But regardless, I expect many posts, especially up-front, to be more about data formats and data conversion, and stressing about page switching on an 8-bit console.
Regardless, I'm going to need an easy manipulatable data format for my in-development game that it easy to modify when I make changes to the engine because I haven't thought things through. But such a format is not going be directly usable in the game.
So I will need tooling.
My initial idea is to use a readable plain-text format for game definitions - I'm considering YAML right now - and to create some build tools to compile these into the final binary game images.
I'll probably do the same for the graphics, converting easy-to-edit PNGs into native CPC format and embedding them into the cartridge image.
And I'll need some metadata to tie everything together so everything knows what everything else is, and the game is linked properly, and my conversation trees are attributed to the correct NPC and my quests award me the Elven Sword rather than the Clay Pot.
And it might make the game data itself nicely portable.
But regardless, I expect many posts, especially up-front, to be more about data formats and data conversion, and stressing about page switching on an 8-bit console.
Getting Started...
Obviously, I haven't just started a blog to document things without having done a little bit of thinking beforehand. Not a lot mind you, but some. And like many ideas, the idea came from playing some games (in this case, Oblivion, which I had managed to avoid playing before) and having a new toy (the C4CPC for the GX4000, an easy-to-update virtual-cart system using an SD card for storage).
I also saw a Kickstarter for a C64 RPG and I guess that also played on my mind.
My first thoughts were scribbled onto paper, and are certainly not complete - more basic ideas about what features should be included, how the game would be presented (I have a note: "Zelda-style, not Dungeon Master") and how the screen would look, perhaps. I thought about graphical styles for different areas of the game - castle, caves, sewers, outdoors, mountain, etc; what the game should feature - shops, NPCs with conversations, quests, objects; and how to save memory on a limited memory system whilst having large game maps.
My first idea was that some maps would be large, and some would be small. Some would be stacked, and some would be quite flat. Yet they should all follow the same definition format.
For example - a central point of my game (for now) would be The City (with no name yet).
One of the things that irked me about Oblivion (and many RPGs), is that cities and towns are a little bonkers. A massive fortification supporting 20 houses, an inn, a church and a castle, for example. Now even back in medieval times, cities weren't tiny like that. So I wanted some sense of scale without using too much memory, or too complex data structures.
One option is auto-generation of a large city from an approved random seed value. But that would generate the large map in my limited amount of RAM which I need for tracking dynamic game state - and I expect an RPG to have a lot of that. However I'm not ruling it out for dungeon generation later in the game.
So what you need to do is create an effectively detailed city from large building blocks, which themselves are not giant graphical assets, but built-up from smaller assets. If you've ever used SEUCK on a C64 you will know the concept, and many games did this on the 8-bit machines.
After some iteration, I have settled on a full-screen 36x28 cell display of the playing area, and a map can have, for example, 64 of these screens in an 8x8 arrangement. A 'tile' (wall/floor/road/water/etc) in the game is 4x4 cells, so each screen only needs 9x7 tiles to define it, which may hopefully be a mere 63 bytes if I limit the number of tiles (I can use different tilesets for different maps for variety). Additionally, I am considering that we can store a 4x4x4 set of screens for a map with 4 levels (The Castle Keep, for example) in the same format. I might as well round up the screen to 64-bytes for alignment (one byte metadata per screen perhaps?). The memory requirement here is 8*8*64, or 4KB if we keep a lid on things. Or we could consider allocating 128KB of our Plus ROM to screen definitions, allowing a 2048 screens within the game.
Obviously every map will have associated metadata - not only what tileset to use and the dimensions of the map, but we need a record of intra-map portals (e.g., up these stairs to another floor) are, and links from this map to other maps (out of the city gates to wilderness, down this well to the caves, etc). We may also want sparse maps rather than grid maps, so we don't waste memory on empty screens (for example, mountains are mostly non-traversable - unlike Oblivion where you can ride a horse on a sheer cliff-side - so let's store the valleys and passes and not the peaks).
Additionally object instances within the map need enumerating - although these may be global as they can move (e.g., with the player). Each instance of an object will have a location, which at this stage will certainly be a Map Id (I'm sure the game can limit itself to 256 maps!), a Screen Id (within the map - theoretically we could have 16x16 screens), and a Location within the screen. Note that we have a 9x7 screen, so there are 63 locations. Additionally, we can have more fine-grained object locations - an 18x14 grid gives us 252 locations - conveniently this fits inside a byte.
I'm not going to get too het up on memory allocations and the like now - the game will evolve and decisions now may prove distressing to fix later on if a non-agile approach to the game is taken.
In my mind, I'm guessing a screen will be around 10 metres wide by 8 metres high, and a tile just over a metre square - at least in the city. In the mountains and wilderness we can have a different scale, games have gotten away with a lot less!
I wouldn't be surprised if eventually I end up with a small castle with 20 houses, an inn, a church and a castle. But let's aim a little higher...
I also saw a Kickstarter for a C64 RPG and I guess that also played on my mind.
My first thoughts were scribbled onto paper, and are certainly not complete - more basic ideas about what features should be included, how the game would be presented (I have a note: "Zelda-style, not Dungeon Master") and how the screen would look, perhaps. I thought about graphical styles for different areas of the game - castle, caves, sewers, outdoors, mountain, etc; what the game should feature - shops, NPCs with conversations, quests, objects; and how to save memory on a limited memory system whilst having large game maps.
My first idea was that some maps would be large, and some would be small. Some would be stacked, and some would be quite flat. Yet they should all follow the same definition format.
For example - a central point of my game (for now) would be The City (with no name yet).
One of the things that irked me about Oblivion (and many RPGs), is that cities and towns are a little bonkers. A massive fortification supporting 20 houses, an inn, a church and a castle, for example. Now even back in medieval times, cities weren't tiny like that. So I wanted some sense of scale without using too much memory, or too complex data structures.
One option is auto-generation of a large city from an approved random seed value. But that would generate the large map in my limited amount of RAM which I need for tracking dynamic game state - and I expect an RPG to have a lot of that. However I'm not ruling it out for dungeon generation later in the game.
So what you need to do is create an effectively detailed city from large building blocks, which themselves are not giant graphical assets, but built-up from smaller assets. If you've ever used SEUCK on a C64 you will know the concept, and many games did this on the 8-bit machines.
After some iteration, I have settled on a full-screen 36x28 cell display of the playing area, and a map can have, for example, 64 of these screens in an 8x8 arrangement. A 'tile' (wall/floor/road/water/etc) in the game is 4x4 cells, so each screen only needs 9x7 tiles to define it, which may hopefully be a mere 63 bytes if I limit the number of tiles (I can use different tilesets for different maps for variety). Additionally, I am considering that we can store a 4x4x4 set of screens for a map with 4 levels (The Castle Keep, for example) in the same format. I might as well round up the screen to 64-bytes for alignment (one byte metadata per screen perhaps?). The memory requirement here is 8*8*64, or 4KB if we keep a lid on things. Or we could consider allocating 128KB of our Plus ROM to screen definitions, allowing a 2048 screens within the game.
Obviously every map will have associated metadata - not only what tileset to use and the dimensions of the map, but we need a record of intra-map portals (e.g., up these stairs to another floor) are, and links from this map to other maps (out of the city gates to wilderness, down this well to the caves, etc). We may also want sparse maps rather than grid maps, so we don't waste memory on empty screens (for example, mountains are mostly non-traversable - unlike Oblivion where you can ride a horse on a sheer cliff-side - so let's store the valleys and passes and not the peaks).
Additionally object instances within the map need enumerating - although these may be global as they can move (e.g., with the player). Each instance of an object will have a location, which at this stage will certainly be a Map Id (I'm sure the game can limit itself to 256 maps!), a Screen Id (within the map - theoretically we could have 16x16 screens), and a Location within the screen. Note that we have a 9x7 screen, so there are 63 locations. Additionally, we can have more fine-grained object locations - an 18x14 grid gives us 252 locations - conveniently this fits inside a byte.
I'm not going to get too het up on memory allocations and the like now - the game will evolve and decisions now may prove distressing to fix later on if a non-agile approach to the game is taken.
In my mind, I'm guessing a screen will be around 10 metres wide by 8 metres high, and a tile just over a metre square - at least in the city. In the mountains and wilderness we can have a different scale, games have gotten away with a lot less!
I wouldn't be surprised if eventually I end up with a small castle with 20 houses, an inn, a church and a castle. But let's aim a little higher...
The Target System
The current target system is a little esoteric. It is to run on an Amstrad 464/6128 Plus or GX4000 cartridge. As a backup, a disc game on the standard Amstrad CPC range will be considered. A secondary idea is to run on an Amiga. I also own a C4CPC cartridge adaptor and GX4000.
The Plus range of computers is interesting - the cartridges provide 512KB of data, and the systems have a minimum of 64KB of memory. Sure, 16KB is used up by the display, but that leaves quite a bit of space for the dynamic data the game engine will require. However, this is not a contiguous memory space - there is a primitive memory mapping system that I will have to get to grips with, and the 16KB page size will drive some of engine design.
My general plan is to have a game engine that fits entirely within 16KB of ROM, so it can be paged in once. The screen is another 16KB. There will be various tables of dynamic data in the game (object instances, flags, counters, NPC dynamic data, etc) - this will have to reside in RAM. However the fixed data backing these up will live on the ROM, and be paged in as required for scoring, UI, etc.
As for the game world, I am currently envisioning a set of maps, linked by portals (okay, doors), covering standard fantasy fare - a city, a castle, a wilderness, a desert, mountains, inns, caves, etc.
The representation, at least on the CPC, will be an overhead 2D graphical view. The Plus range has a decent 16-colour chunky graphics mode where I can pick from 4096 colours, and 16, 16-colour sprites with their own palette. The sprites have their limitations (not easy to animate), but should be more than enough for this game.
My current plan is for a map to be up-to 8x8 screens in size, and a screen to be composed of 9x7 'super-blocks', which themselves are 4x4 character cells in size. This means the view will be full screen, on a 36x28 display (did I mention that the CRTC chip inside the CPC range of computers is very programmable - a C64 version would target 10x8). The idea is that this will save lots of memory without affecting the game too much, especially if the player isn't limited to tile by tile movement.
The Plan
The plan is to write an 8-bit RPG engine, and RPG compiler to create RPGs that run upon that engine. The aim is that the RPG description will be self-contained, and in theory a new compiler could be written to target a different system.
This blog will document my progress. It will likely in the beginning be more ideas and specifications and talking about what I want in my engine. It will have dead-end explorations of RPG game design. Hopefully it will show first an evolution of a design, an evolution of tooling, and finally an evolution of an engine to run what my tools generate - hopefully a bug-free game that might be mildly okay, story-wise.
What qualifications do I have to do this? Well, pretty much not many in terms of RPG design (I've played a few!), not much in terms of programming 8-bit computers (in reality, I have some in-depth knowledge about the target machine which will drive some design decisions).
This blog will document my progress. It will likely in the beginning be more ideas and specifications and talking about what I want in my engine. It will have dead-end explorations of RPG game design. Hopefully it will show first an evolution of a design, an evolution of tooling, and finally an evolution of an engine to run what my tools generate - hopefully a bug-free game that might be mildly okay, story-wise.
What qualifications do I have to do this? Well, pretty much not many in terms of RPG design (I've played a few!), not much in terms of programming 8-bit computers (in reality, I have some in-depth knowledge about the target machine which will drive some design decisions).
So why do it?
The general reasons:- something to do
- something to be creative
- something to make use of what I can do well currently (high-level programming in finance!)
- I like retro computers, and I grew up with my target system
- I like the challenge they provide, I'm just one person and bigger targets are really not viable in my spare time
- I like pixel graphics design
- This year the internet is full of despair and I need a break
Subscribe to:
Posts (Atom)

