How to encode large amounts of text/data.

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
Einar Saukas
Bugaboo
Posts: 3097
Joined: Wed Nov 15, 2017 2:48 pm

Re: How to encode large amounts of text/data.

Post by Einar Saukas »

Joefish wrote: Wed Feb 07, 2018 3:37 pmElite uses procedural generation of data. That is, it's all calculated from pseudo-random patterns.
All puzzles in ZEN and ZEN II are procedurally generated. There are 10,000 puzzles in each game and they are all guaranteed to be solvable.

The Sentinel is another good example of procedural generation to produce levels.
User avatar
Joefish
Rick Dangerous
Posts: 2058
Joined: Tue Nov 14, 2017 10:26 am

Re: How to encode large amounts of text/data.

Post by Joefish »

I wouldn't bother with Fibonacci anything. Having it generate unpredictable amounts of data doesn't help.
A pseudo-random number generator is much simpler; you simply ask it for however many numbers you need. If you really want varying amounts of data, use one number to tell you a random amount then ask for that many random numbers.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: How to encode large amounts of text/data.

Post by Nomad »

I think part of the problem with the proc-generated games like no-mans sky its a 'thousand miles wide but an inch deep'. Trying to get interesting things to happen and have meaningful interactions I think its the difficult part. But with careful design of the NPC state machines and terain generation/events tables a pretty decent experience could be had.

I remember D&D encounters were ok but if I were to write a game I think I would go more the way of RuneQuest. Much less was left to chance with the rules - the nice thing is much of the rules are just lookup tables (well so is much of D&D) but with RuneQuest a lot of the decisions are taken care of by the tables.

I take your point about just getting a pseudo random number generator that has good characteristics.

What I like about elite is how you can expand the description table generation to do other things like quests. It wouldn't be so difficult to have a table of different quest objectives that could be strung together. Most modern games its just a matter of kill quests, fetch quests, escort quests and location scouting quests. If you built a table that would just build up elements when the player met a quest giver it wouldn't be that difficult to have a great many random quests generated. Much like how star wars galaxies used to handle the missions. Not expecting crazy quality here just enough that it works and keeps people interested.

With the introduction of quests, thats another need to have persistent data - but I think thats a manageable problem. The way I would deal with that is have a limit to the number of active quests/missions and just have a stack type structure. That way you know exactly how much memory to allocate and the player can't go around accepting quests willy nilly and running up a huge amount of memory.

I always felt that for example Darklands could have probably have been implemented as a procedurally generated game and been done a lot faster and within budget. Not to take away from Darklands its a great game but to my mind there was a lot of blood and tears put into that project that could have been saved with a different approach.
User avatar
Seven.FFF
Manic Miner
Posts: 744
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: How to encode large amounts of text/data.

Post by Seven.FFF »

Nomad wrote: Wed Feb 07, 2018 5:45 pm I think part of the problem with the proc-generated games like no-mans sky its a 'thousand miles wide but an inch deep'.
That is the exact problem. I used to make a lot of generative music on modular synths back in the day, and it's extremely difficult to set up a situation where startlingly unexpected and pleasing things happen, without losing all structure.

I used to describe it as a logarithmic fractal scale of similarity or unexpectedness. Most of your nice random variations and feed-back selected choices have a similarity of 1, where the sweet spot is 3 or 4. Most of the interesting stuff happens where you have a few orders or magnitude of differences, and it's very hard to get in that zone with algorithms.

There's an xkcd about cuils that kinda captures how everything gets too similar after a few levels of abstraction.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
User avatar
Joefish
Rick Dangerous
Posts: 2058
Joined: Tue Nov 14, 2017 10:26 am

Re: How to encode large amounts of text/data.

Post by Joefish »

You're right about games not having so much depth. Although there's been a big update to No Man's Sky that makes it worth exploring. LEGO Worlds uses procedural levels and quests but they do all start to look the same. The problem is that in a purely procedural game, there might be plenty to do, and there might even be grand objectives, but simply knowing that it's random makes you question what the point of it all is.

What I'd suggest would work best is one main plot that's written specifically for the game, and just use the randomness to generate the environment. And maybe some unimportant side-quests. You can record which ones you've done, but it wouldn't kill the atmosphere if you left an area and the game forgot about it, then presented the same quests if you go back. Perhaps a quest generator that just records the types of quest you've done recently, and always offers up something different wherever you go.

A map generator that can interpolate or fill-in around data you fix yourself would be the most useful. You wouldn't use it to generate lots of different games; you make one game that you've tested and are happy with. The randomness just allows you to present a vast world without having to specifically program every little bit of it.

I'd love to be able to understand the 'fractal' code that went into something like Rescue on Fractalus or The Eidolon to generate the scenery. That was adding pseudo-random features to simple structures in real-time. And the features would scale up as you got closer, which is hard to achieve with random data.
Ralf
Rick Dangerous
Posts: 2283
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: How to encode large amounts of text/data.

Post by Ralf »

When you say auto-generated game I immediately remember Daggerfall, a very famous game from the 90s if you somehow missed it:

http://www.mobygames.com/game/dos/elder ... daggerfall

"Famous" doesn't mean "great" unfortunately. Daggerfall was an incredibly ambitious project which sadly failed in many areas.

It has really huge world but it's mostly randomly generated and it's a weakness. You end with hundreds of towns which look the same as you enter them and thousands of people who also look the same and have names built randomly from some smaller parts. They give you some random quests, somethimes very stupid if you think more.

I remember an example that a game generated a quest to kill some giant spider dwelling in the guild of warriors. You get it, this spider wouldn't have a chance to survive a second in a real guild of warriors ;)

Add hundreds of autogenerated 3D dungeons looking all the same. And tons of bugs, some of them probably coming from the game complexity.

Some people loved it, I didn't like it.

I don't want to play dozens of random but similar levels. I want variety in the game.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: How to encode large amounts of text/data.

Post by Nomad »

Einar Saukas wrote: Wed Feb 07, 2018 4:19 pm
All puzzles in ZEN and ZEN II are procedurally generated. There are 10,000 puzzles in each game and they are all guaranteed to be solvable.

The Sentinel is another good example of procedural generation to produce levels.
Thank you for this, being able to see the source code and figure out how the game worked its great.
Seven.FFF wrote: Wed Feb 07, 2018 7:15 pm That is the exact problem. I used to make a lot of generative music on modular synths back in the day, and it's extremely difficult to set up a situation where startlingly unexpected and pleasing things happen, without losing all structure.

I used to describe it as a logarithmic fractal scale of similarity or unexpectedness. Most of your nice random variations and feed-back selected choices have a similarity of 1, where the sweet spot is 3 or 4. Most of the interesting stuff happens where you have a few orders or magnitude of differences, and it's very hard to get in that zone with algorithms.

There's an xkcd about cuils that kinda captures how everything gets too similar after a few levels of abstraction.
Are you a banana plug type of guy or more of the 1/4" jack persuasion? If I had won the lottery I always wanted one of these bad boys. http://www.vintagesynth.com/misc/buchla200.php

:lol:

A lot of generative patches seem to end up in a steady state. But then its better than it sounding like a fart in a wind tunnel after 1 hour of wiggling (Looking at you Daniel Miller.) I think the hardware was around since the 70s its just a matter of applying the right patch. I always was curious what would have happened if a guy like Joseph Schillinger had access to such a machine he would have got a symphony going out of a few patches and a phonebook for input :lol:

But then even using Schillingers routines it has a tendency to sound like lift music. I once spent a month trying to generate drum breaks for a synth project that went nowhere. Something that on paper should be easy has lots of hidden depth. It's like I could generate the breaks but they were so hit and miss. Even with a bunch of example patterns to combine it would always sound kinda off. So I feel your pain about trying to generate a whole track.

With that said, the csound people have done amazing things with that language. I just wish I had the patients to learn to use it properly. That is like having a modular synth inside your terminal :lol: Its weird its not more popular with computer music people but then it does not have a cute gui so I guess that is off putting.

As far as sequences go for the randomness, yea What I like about the modulated Fibonacci sequences is you have some low level variations but also a strong sense or order. Numbers repeat in a predictable way but then out of nowhere you get these spikes of volatility. I think for the game this is a great way to simulate market instability. You have the mods where you get unusual amounts of complexity simulate crashes/rallies.

What gives me the cold sweats is knowing there are sequences and especially in topology - structures that probably would be perfect for the application that we are talking about just gathering dust in a paper or monograph somewhere lol. I think a lot of this stuff exists its just not widely known about.
Joefish wrote: Wed Feb 07, 2018 7:21 pm You're right about games not having so much depth. Although there's been a big update to No Man's Sky that makes it worth exploring. LEGO Worlds uses procedural levels and quests but they do all start to look the same. The problem is that in a purely procedural game, there might be plenty to do, and there might even be grand objectives, but simply knowing that it's random makes you question what the point of it all is.

What I'd suggest would work best is one main plot that's written specifically for the game, and just use the randomness to generate the environment. And maybe some unimportant side-quests. You can record which ones you've done, but it wouldn't kill the atmosphere if you left an area and the game forgot about it, then presented the same quests if you go back. Perhaps a quest generator that just records the types of quest you've done recently, and always offers up something different wherever you go.

A map generator that can interpolate or fill-in around data you fix yourself would be the most useful. You wouldn't use it to generate lots of different games; you make one game that you've tested and are happy with. The randomness just allows you to present a vast world without having to specifically program every little bit of it.

I'd love to be able to understand the 'fractal' code that went into something like Rescue on Fractalus or The Eidolon to generate the scenery. That was adding pseudo-random features to simple structures in real-time. And the features would scale up as you got closer, which is hard to achieve with random data.
There was a really nice documentary made in the early 90s all about fractals. I'll see if I can find it on youtube. Yes fractal geometry is such a rich area for study. But to be honest I don't really understand it enough to be able to use it. I agree with you about having a strong story to be the backbone of the game. It's like generative stuff should be the icing on the cake but not the whole thing. As you say - it should be to enchant an already good/solid game and add depth/extra tasks/behaviours.

One thing I always wondered why it was not done was generating lore, documentation stuff to make a world feel really real. Like you wouldn't need to remember the documents contents after the player had left an area but just generate it on the fly so you could say walk into a study or library and pick up a book and read it. I always found that unrealistic that all the things you could pick up and read were related to you and the quest or interesting important lore. Like in Morowind. There would have been far more documents that were just every day stuff. It would have made it much more of an achievement to find interesting/reliant documents if you had to really search for them. That is a quest in itself. But I kinda understand why you wouldn't want to do that for filthy casual playing the game getting frustrated picking up a invoice or bill for the 5th time in a row. :lol:
Ralf wrote: Wed Feb 07, 2018 7:36 pm When you say auto-generated game I immediately remember Daggerfall, a very famous game from the 90s if you somehow missed it:

http://www.mobygames.com/game/dos/elder ... daggerfall

"Famous" doesn't mean "great" unfortunately. Daggerfall was an incredibly ambitious project which sadly failed in many areas.

It has really huge world but it's mostly randomly generated and it's a weakness. You end with hundreds of towns which look the same as you enter them and thousands of people who also look the same and have names built randomly from some smaller parts. They give you some random quests, somethimes very stupid if you think more.

I remember an example that a game generated a quest to kill some giant spider dwelling in the guild of warriors. You get it, this spider wouldn't have a chance to survive a second in a real guild of warriors ;)

Add hundreds of autogenerated 3D dungeons looking all the same. And tons of bugs, some of them probably coming from the game complexity.

Some people loved it, I didn't like it.

I don't want to play dozens of random but similar levels. I want variety in the game.
I waisted hours in that game :lol: it had its limitations but I still remember forgiving them because it was so much better than anything before. I have to admit I much preferred morowind. It was always a head to head for me between darklands and dagerfall. I liked aspects of both games.

The thing about kill quests generating monsters in unrealistic areas - that seems to happen a lot in the MMOs also. I used to put it down to lazy coding (like how hard is it to have zones in the map where you can't spawn monsters? or just have the npcs react to monsters turning up inside their guild :lol: thinking it through though I can understand not wanting the NPCs to handle the quest for the player. In a large game the slow down would be something else. It would be awesome to watch from a birds eye view multiple NPCs going postal taking the monsters to task all over the game world. The player would be walking through a aftermath. Thinking about it thats exactly what you want to happen in a first person 'war simulator' type game.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: How to encode large amounts of text/data.

Post by Nomad »

As a quick addition, as we were talking about music and generating notes.

Pisano points generated from the Modulo 7 (or if you are into early music or alternatively avant garde another number base)..

Map each generated integer value to a note in your scale.

A - 0
B - 1
C - 2
D - 3
E - 4
F - 5
G - 6

Given the sequence you then get

B B C D F B G A G G F E C G B A

But wait there is more, you can use the same technique to obtain your note lengths, the tempo, the octave..

Lol heres my little ditty with it in Beepola..

https://ufile.io/gu3re

If you were to do this with sample based music you can just assign the integer value to your sample.

Hi Hat Open - 0
Hi Hat Closed - 1
Snare - 2
Kick - 3
Base - 4
Tom - 5
Cowbell - 6

To make it a bit more interesting - map a different modulo sequence and use that to indicate what pattern to play in the song sequence...

It's a trivial method but if you were pressed for time and wanted to try a bunch of patterns that is how I would do it. You are bound to find something that would be ok..

Stockhausen's lectures are good for thinking about how to write music using algorithms.

[youtube]https://youtu.be/lYmMXB0e17E[/youtube]

There is a whole series you can find them with that. Stockhausen is a bit Marmite; I understand but even if you can't stand his music or as a person I think the method is sound.
User avatar
R-Tape
Site Admin
Posts: 6402
Joined: Thu Nov 09, 2017 11:46 am

Re: How to encode large amounts of text/data.

Post by R-Tape »

Lol heres my little ditty with it in Beepola..
Mostly painless.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: How to encode large amounts of text/data.

Post by Nomad »

R-Tape wrote: Thu Feb 08, 2018 9:14 am
Lol heres my little ditty with it in Beepola..
Mostly painless.
I'll get me coat :lol: structure of the 'tune' ideally would have gotten a lot more love. the main channel, second channel and drums are all using that sequence. (Lol just to show it could be done if it was 'legit' I would have used a more conventional drum track.) The mod5 pattern might be good to spice things up a bit. I would have to have a play.

Could just use the shillinger method and pick a phone number, That works just as well. :lol:

In fairness the rest of the mods produce some interesting dittys also. combining the various patterns into a complete song. I am crap at composition haha I will be honest I would struggle to beat some of these generated melody's they sound ok. Especially if you are up against it time wise these cheats seem to help.

Makes you wonder what the other modulations sound like I only tested it up to 8.. Could get really creative and move away from equal temperament .

Another simple hack, turn the sequence into a set. (thereby removing all duplicate notes in the sequence).

Another hack. take the set and now sprinkle in the missing notes from the scale (if any).

:lol: There are loads of things you can do - this will result in starting point for composition. Like unless you are like super self disciplined I think everyone cheats with these and wiggles the sequences to make them sound better. That was the joke about Serial music nobody followed the rules anyway.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: How to encode large amounts of text/data.

Post by Nomad »

Seven.FFF wrote: Wed Feb 07, 2018 4:16 am I’d like to see a sf epic where all the alien races and planets were west country villages.

I don’t think this is suited to your strings, but runtime RLE reencoding is interesting.

http://www.cpcwiki.eu/forum/programming ... -encoding/
Not quite sure how I missed this. :lol: hmmm well for tables where there is lots of continuous repeating data bytes this would be all kinds of awesome. So if you had like a sparse array with tons of 0's this would be really sweet.

Code: Select all

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
now becomes*

Code: Select all

00177 0100 00249 0100 0068 0100 00176 0100 0093
*I think...
Wall_Axe
Manic Miner
Posts: 500
Joined: Mon Nov 13, 2017 11:13 pm

Re: How to encode large amounts of text/data.

Post by Wall_Axe »

so he is saying that in the game north star the 'screen decoration' ie the still graphics around the gameplay area are unpacked onto the screen?

I take it you would have to unpack it to read a certain set of coords?
Post Reply