Acorn Island
Acorn Island
OK - so not sure if this should go here as it's not yet a game - and I'm not sure it's going to make it into one. However, here's a demo of some procedural landscape generation that I've been messing with. I originally had this with my own generation routines but went looking for some "inspiration" elsewhere. (https://www.reddit.com/r/proceduralgene ... _1mhz_cpu/).
Anyhow there are three programs here
MAP1 and MAP2 are BASIC programs (CHAIN to run) that display sections of the map (I've limited it to an Island approximately 512x512 locations). MAP2 is lower res but more colours. Both really need to be run in "turbo" mode in an emulator.
LAND is machine code (*LAND to run) that allows you to explore this landscape. Use Z/X/K/M to move around. There is no bounds checking or anything like that so I'm sure it's possible to make it go "wrong".
Anyhow there are three programs here
MAP1 and MAP2 are BASIC programs (CHAIN to run) that display sections of the map (I've limited it to an Island approximately 512x512 locations). MAP2 is lower res but more colours. Both really need to be run in "turbo" mode in an emulator.
LAND is machine code (*LAND to run) that allows you to explore this landscape. Use Z/X/K/M to move around. There is no bounds checking or anything like that so I'm sure it's possible to make it go "wrong".
Last edited by ChrisB on Mon Nov 28, 2022 5:11 pm, edited 2 times in total.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo
What a coincidence, I have been playing around with something similar: https://twitter.com/0xC0DE6502/status/1 ... C4P_2dc7zw
0xC0DE
"I program my home computer / Beam myself into the future"
Follow me on Twitter
Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
"I program my home computer / Beam myself into the future"
Follow me on Twitter
Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
Re: Procedural Landscape Demo
Slight update with "surf" at the edges of the water.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo
Added "Points of interest". These are items at a fixed location. The demo has around 50 items. Also sped up the drawing when plotting water. There are extra calls to calculate the surf. I've introduced a small cache to reduce the number or recalculations that need to be done.
Next is roads.
Next is roads.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo
Well that was somewhat easier that I expected. Now with roads (which are pre-defined - 3 bytes each straight section). As before wandering off the edge of the map will cause a hang.
Next on the list is single point POIs (possibly included with the generic ones) and mountain ranges.
Next on the list is single point POIs (possibly included with the generic ones) and mountain ranges.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo
Now with support for lines of mountains and single tile POIs.
This is about as much as I think I want to add to the engine. Now to see if I can make a game around it....
This is about as much as I think I want to add to the engine. Now to see if I can make a game around it....
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo
Interesting development, need to download and have a play later (at work just now).
Could this be the basis for a port of Attack of the Petscii Robots?
Could this be the basis for a port of Attack of the Petscii Robots?
Re: Procedural Landscape Demo
Not sure it's suitable - no real map data being stored.Could this be the basis for a port of Attack of the Petscii Robots?
Attached is a very small update - added a blob/cursor in the middle of the screen and prevented it from moving into obstacles. This also prevents you from wandering off the edge of the map. Oddly to me it starts to feel much more like a game with that in place...
I've dropped the "map" programs from this one as well.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
- Rich Talbot-Watkins
- Posts: 2054
- Joined: Thu Jan 13, 2005 5:20 pm
- Location: Palma, Mallorca
- Contact:
Re: Procedural Landscape Demo
I came across the horribly-named "wave function collapse" algorithm the other day, a somewhat hyperbolic name for a fairly straightforward concept, but it generates some very cool procedural tilemaps, based on some simple adjacency rules about which tiles may be placed next to each other.
Here's a YouTube video which explains the idea and goes through an implementation in Javascript:
https://www.youtube.com/watch?v=rI_y2GAlQFM
The basic idea is that you start with a blank grid, and in each slot you maintain a list of which tiles you could place there. Initially, each slot is as good as any other, and you can place any of your tiles, so choose a slot at random and place a random tile. Once you've done that, you have immediately added some restrictions. For example, maybe a vertical wall can only have another vertical wall or a corner piece above and below; maybe a corner piece can only have grass tiles on the 'outside' neighbour slots, etc. So, find the tile slots with the fewest possibilities, choose one of them at random, and assign one of the allowed tiles to it (this is what they call "collapsing" the wave function - committing to a concrete state from a list of possibilities). Now your choice has impacted its neighbours, so recalculate the possibilities for unfilled slots and repeat the process until everything is assigned.
I've seen this algorithm applied to 3D as well, with some stunning results!
Here's a YouTube video which explains the idea and goes through an implementation in Javascript:
https://www.youtube.com/watch?v=rI_y2GAlQFM
The basic idea is that you start with a blank grid, and in each slot you maintain a list of which tiles you could place there. Initially, each slot is as good as any other, and you can place any of your tiles, so choose a slot at random and place a random tile. Once you've done that, you have immediately added some restrictions. For example, maybe a vertical wall can only have another vertical wall or a corner piece above and below; maybe a corner piece can only have grass tiles on the 'outside' neighbour slots, etc. So, find the tile slots with the fewest possibilities, choose one of them at random, and assign one of the allowed tiles to it (this is what they call "collapsing" the wave function - committing to a concrete state from a list of possibilities). Now your choice has impacted its neighbours, so recalculate the possibilities for unfilled slots and repeat the process until everything is assigned.
I've seen this algorithm applied to 3D as well, with some stunning results!
Re: Procedural Landscape Demo
Interesting. Might be more use for an "infinite runner" or similar or perhaps a dungeon layout where the area is limited. From the brief look I had it would seem to require a grid to be populated with objects which limits the grid size to available memory - but you could keep generating more land as you moved on. Might be interesting to pull something together.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo
Some more updates.
Firstly I've added an interrupt routine (based on this code viewtopic.php?p=337687#p337687) to scroll only part of the screen. I've also attempted to use mixed modes with this to create a status bar. Timing of the various emulators seems problematic here and bebjit appears to the one that matches my real beeb. Therefore if you use another emulator expect a small amount of screen corruption at the change. Also - because most of the OS is still in use the transition line isn't totally solid.
I've also added "monster" that follows you around. This is early days so there will be occasional corruption/duplication. At the moment the sprite is 1 bit and moves one tile at a time. Either of these might change.
Lastly the "surf" also animates.
*LAND or <SHIFT><BREAK> to run.
Firstly I've added an interrupt routine (based on this code viewtopic.php?p=337687#p337687) to scroll only part of the screen. I've also attempted to use mixed modes with this to create a status bar. Timing of the various emulators seems problematic here and bebjit appears to the one that matches my real beeb. Therefore if you use another emulator expect a small amount of screen corruption at the change. Also - because most of the OS is still in use the transition line isn't totally solid.
I've also added "monster" that follows you around. This is early days so there will be occasional corruption/duplication. At the moment the sprite is 1 bit and moves one tile at a time. Either of these might change.
Lastly the "surf" also animates.
*LAND or <SHIFT><BREAK> to run.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
- Cybershark
- Posts: 736
- Joined: Wed Jun 14, 2006 11:16 pm
- Contact:
Re: Procedural Landscape Demo
Hey, wow, this is looking amazingly promising so far!
The setup reminds me of Sim City quite a bit but it'll be very interesting to see which direction you choose to take it.
The setup reminds me of Sim City quite a bit but it'll be very interesting to see which direction you choose to take it.
Re: Procedural Landscape Demo
Quick update - added a (proportional) font routine and notification window for "events". I think there will be a lot of text so I will probably end up using the huffman routine.
I've also added multiple monsters to chase you around and a couple of graphical tweaks. No interaction as yet and plenty of plotting issues.
I've also added multiple monsters to chase you around and a couple of graphical tweaks. No interaction as yet and plenty of plotting issues.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo
I'm continuing to fiddle with this on and off. I think I'm heading in a sort of action/adventure direction. Updates (which aren't visible) is a revamp of the palette definitions. This will allow me to have alternate colours for some of the tiles. Something I have been meaning to do is produce a dump of the whole map for planning purposes - so here it is. POI and Roads/Mountains are simply test values.
Next to look at is monster spawners and/or a "quest" system.Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo
Getting better and better with each iteration.
Love to know your secret in finding the time to code things like this, as I’ve not been able to touch coding in a few weeks
Love to know your secret in finding the time to code things like this, as I’ve not been able to touch coding in a few weeks
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
Re: Procedural Landscape Demo/Acorn Island
Bit more work on this. Altered the generation parameters again - so the previous map is no longer valid...
Started on the monster spawner logic. There are a couple dotted round the map but they don't do anything as yet. Because I had room in the data structure for them I've added the ability to position them on any tile (POI tiles are only every 2 map tiles) and also allowed me have some more scenery/quest items. Font updates for colours and the monsters now disappear after a while.
Screenshot shows an example of the recolouring of tiles (each POI tile can have an original and alternate colour set). Edit: Quick explanation regarding palettes - the tiles are stores as 2 bits per pixel to save space and translated to screen colours on plot. So each tile can only have 4 colours - but they can be any of the 8.
Started on the monster spawner logic. There are a couple dotted round the map but they don't do anything as yet. Because I had room in the data structure for them I've added the ability to position them on any tile (POI tiles are only every 2 map tiles) and also allowed me have some more scenery/quest items. Font updates for colours and the monsters now disappear after a while.
Screenshot shows an example of the recolouring of tiles (each POI tile can have an original and alternate colour set). Edit: Quick explanation regarding palettes - the tiles are stores as 2 bits per pixel to save space and translated to screen colours on plot. So each tile can only have 4 colours - but they can be any of the 8.
- Attachments
-
- land.ssd
- (7.5 KiB) Downloaded 32 times
Last edited by ChrisB on Sun Sep 11, 2022 9:40 am, edited 1 time in total.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
Anther small step. The spawners now spawn monsters (which still have animation issues and don't do anything apart from move towards you). There is a spawner to the left of your start location and a couple together to the right and down a bit.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
Another update.
Improved monster plot when they go off the edge of the screen.
Fixed a bug with the spawner rates so monsters will spawn more consistently.
Added the first stages of a quest system.
Introduced a decompress/move down routine. Space isn't an issue yet but there are more graphics, text and routines to include.
The pink castle is down from your start location...
Improved monster plot when they go off the edge of the screen.
Fixed a bug with the spawner rates so monsters will spawn more consistently.
Added the first stages of a quest system.
Introduced a decompress/move down routine. Space isn't an issue yet but there are more graphics, text and routines to include.
The pink castle is down from your start location...
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
For the interested a quick explanation of the "quest" logic. I haven't fully implemented it as yet but this is where I intend to go.
Each stage of the quest consists of two bytes. The first byte contains the number of lines of text and the "type" of quest. This might be a "goto x location" or a "kill y monsters" or similar. The second byte is then the location number and/or number of things to do with the occasional bit being set to modify the actions.
So an example quest line might be:
Each stage of the quest consists of two bytes. The first byte contains the number of lines of text and the "type" of quest. This might be a "goto x location" or a "kill y monsters" or similar. The second byte is then the location number and/or number of things to do with the occasional bit being set to modify the actions.
So an example quest line might be:
- "Go and find the key for the castle door under the cactus in the desert" with the cactus as the target.
- "You found the key go to the castle" with the castle as the target.
- "The wizard in the castle asks you to kill 10 baddies" with 10 monsters as the quest
- "Well done you killed them" with the castle as the target.
- "The wizard thanks you ..." with some other object as the target etc.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
What about multiple concurrent quests?
You might have to change current quest or you might be killing baddies for the wrong quest.
It feels tiny, but the UI probably wouldn't be.
You might have to change current quest or you might be killing baddies for the wrong quest.
It feels tiny, but the UI probably wouldn't be.
Re: Procedural Landscape Demo/Acorn Island
As soon as I posted the above I then had second thoughts. It would be possible to make a quest dependent on a previous one being completed (and simply flag this) which would allow multiple quest chains. Probably another byte per quest to track but not significant in the grand scheme of things. Makes the story design more complex and means that I'll have to "gate" things off somehow to stop you simply skipping to the end. More to think about - but I've got plenty of other mechanisms to get in place in the mean time.
UI is another concern. Do I need to have a "track" of the quests that are currently in progress which gets more complex - or do you simply have to remember?
Edit: Thinking about this some more this becomes quite a bit more complex with tracking states of collect x style actions and similar. Will require more thought.
UI is another concern. Do I need to have a "track" of the quests that are currently in progress which gets more complex - or do you simply have to remember?
Edit: Thinking about this some more this becomes quite a bit more complex with tracking states of collect x style actions and similar. Will require more thought.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
A minor visual update but quite a lot "under the hood".
Text is now centred horizontally and vertically and can be coloured during the line. There is going to be quite a lot of text so it is now compressed (huffman). Quest logic updated slightly to make the spawner poi's disappear when activated - used in this case to allow a tree to be removed from a path allowing areas to be blocked off until a point in the quest has been completed and similar.
Text is now centred horizontally and vertically and can be coloured during the line. There is going to be quite a lot of text so it is now compressed (huffman). Quest logic updated slightly to make the spawner poi's disappear when activated - used in this case to allow a tree to be removed from a path allowing areas to be blocked off until a point in the quest has been completed and similar.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
New version.
Added a player sprite rather than a fixed tile that was being used before (with lookup table mirror routines)
Controversial - added a detection for beebem so that the screen timing works on beebem and beebjit. The various emulators all do something different here. Wondering if I'm simply doing something wrong... I would be interested in how this looks on a real BBC B and Master (works fine on my B+).
Added a player sprite rather than a fixed tile that was being used before (with lookup table mirror routines)
Controversial - added a detection for beebem so that the screen timing works on beebem and beebjit. The various emulators all do something different here. Wondering if I'm simply doing something wrong... I would be interested in how this looks on a real BBC B and Master (works fine on my B+).
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
Hey Chris,
I’ve been following your progress along in the background and it’s been great to see this coming together. I’ve just given your new player character a good run around for 10 minutes on my real Model B and he seems fine. The character itself is looking great as well.
Cheers
Rob
Re: Procedural Landscape Demo/Acorn Island
Hi Rob,
Is the line between the white box at the top and the main screen "clean" as per the picture (there is some wobble due to various interrupts being enabled) but the mode change should be at that point. Also the "TOP" should be black on white and not corrupted. Here' a picture on jsbeeb showing the kind of issues I'm talking about:
Is the line between the white box at the top and the main screen "clean" as per the picture (there is some wobble due to various interrupts being enabled) but the mode change should be at that point. Also the "TOP" should be black on white and not corrupted. Here' a picture on jsbeeb showing the kind of issues I'm talking about:
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
ChrisB wrote: ↑Fri Sep 30, 2022 10:53 am Hi Rob,
Is the line between the white box at the top and the main screen "clean" as per the picture (there is some wobble due to various interrupts being enabled) but the mode change should be at that point. Also the "TOP" should be black on white and not corrupted. Here' a picture on jsbeeb showing the kind of issues I'm talking about:
land issues.png
Hi Chris,
A short video is often better than words.... Does this help?
https://youtu.be/dL1pZTMXQj8
Cheers
Rob
Re: Procedural Landscape Demo/Acorn Island
Hmm. That is interesting - and slightly disappointing. Although one of the emulators I tried (forget which one) showed this behaviour - fine on B+ not on B. I'll need to put together an isolated example and do some testing. Thanks for your help.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Procedural Landscape Demo/Acorn Island
Hi Chris - Glad to be of help even if it's not what you wanted to see. I'm sure you'll find a solution.
Let me know if you'd like another test and I'll run through again when you are ready.
Cheers
Rob
Let me know if you'd like another test and I'll run through again when you are ready.
Cheers
Rob
Re: Procedural Landscape Demo/Acorn Island
Going to leave the timing for the moment and address it in a separate thread. For the moment please use beebem or beebjit.
This version adds collision detection between the player and enemies (where the enemy moves into the player or vice versa). This just flashes the outline of the player red and destroys the monster at the moment - obviously later this will reduce health/lives etc. Reminder: there is an enemy spawner to the west of the start location and a couple to the southeast.
Next will be a means to fight back...
This version adds collision detection between the player and enemies (where the enemy moves into the player or vice versa). This just flashes the outline of the player red and destroys the monster at the moment - obviously later this will reduce health/lives etc. Reminder: there is an enemy spawner to the west of the start location and a couple to the southeast.
Next will be a means to fight back...
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters