Acorn Island

developing/porting a new game or gaming framework? post in here!
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Acorn Island

Post by ChrisB »

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".
land.ssd
(4.5 KiB) Downloaded 44 times
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
User avatar
0xC0DE
Posts: 1300
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Procedural Landscape Demo

Post by 0xC0DE »

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"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

Slight update with "surf" at the edges of the water.
land.png
land.ssd
(4.75 KiB) Downloaded 47 times
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

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.
land.ssd
(5.5 KiB) Downloaded 41 times
land2.png
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

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.
land.ssd
(5.75 KiB) Downloaded 38 times
land3.png
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

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....
land.ssd
(6 KiB) Downloaded 44 times
land4.png
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
JohnH
Posts: 85
Joined: Thu Aug 11, 2016 10:59 pm
Contact:

Re: Procedural Landscape Demo

Post by JohnH »

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?
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

Could this be the basis for a port of Attack of the Petscii Robots?
Not sure it's suitable - no real map data being stored.

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.
land.ssd
(5.25 KiB) Downloaded 37 times
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Procedural Landscape Demo

Post by Rich Talbot-Watkins »

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!
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

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
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

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.
land.ssd
(6.5 KiB) Downloaded 43 times
land.PNG
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
Cybershark
Posts: 736
Joined: Wed Jun 14, 2006 11:16 pm
Contact:

Re: Procedural Landscape Demo

Post by Cybershark »

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.
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

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.
land.ssd
(7.25 KiB) Downloaded 26 times
textbox.png
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo

Post by ChrisB »

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.
WholeMap.png
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
User avatar
fizgog
Posts: 618
Joined: Thu Jun 17, 2021 3:18 pm
Location: Nottinghamshire
Contact:

Re: Procedural Landscape Demo

Post by fizgog »

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 :(
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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).
land.ssd[/attach ment][attachment=0]land2.png
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
land2.png
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
User avatar
lovebug
Posts: 1739
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Procedural Landscape Demo

Post by lovebug »

this is amazing work

congratulations =D> =D> =D> =D> =D>
Image Image Image Image
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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.
land.ssd
(7.75 KiB) Downloaded 41 times
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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...
land.ssd
(6.25 KiB) Downloaded 31 times
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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:
  • "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.
Obviously this is all totally linear but I don't recall much with branching narratives from BITD and I think it will allow a storyline to be built up.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
tricky
Posts: 7694
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by tricky »

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.
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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.
land.ssd
(6.5 KiB) Downloaded 20 times
aaisland.png
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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+).
land.ssd
(7 KiB) Downloaded 18 times
land5.png
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
Rob_hawk
Posts: 477
Joined: Mon Jul 12, 2021 6:50 pm
Location: Valmeinier, France
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by Rob_hawk »

ChrisB wrote: Fri Sep 30, 2022 7:40 am
I would be interested in how this looks on a real BBC B and Master (works fine on my B+).
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
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
Rob_hawk
Posts: 477
Joined: Mon Jul 12, 2021 6:50 pm
Location: Valmeinier, France
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by Rob_hawk »

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
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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
User avatar
Rob_hawk
Posts: 477
Joined: Mon Jul 12, 2021 6:50 pm
Location: Valmeinier, France
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by Rob_hawk »

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
User avatar
ChrisB
Posts: 547
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Procedural Landscape Demo/Acorn Island

Post by ChrisB »

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.
land.ssd
(7 KiB) Downloaded 28 times
Next will be a means to fight back...
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Post Reply

Return to “new projects in development: games”