Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

21 JAN 2023:

Just got back from my business trip last night! 

Since I wasn't able to work on Scrapship, I spent some time learning more about QBASIC and basic computer concepts, especially how "Random" Number Generators work. Why is "Random" in quotes? Because computers are actually just using PSEUDO-Random Number Generators -- run any RNG long enough and you'll start to see little patterns here and there.

In a nutshell, most RNG programs take a Real World value, like time and then perform an operation against it to generate a random number. 

This ties into Scrapship since the game makes heavy use of "random" numbers. As I soon found out, not all "random" number generators are equal! In some cases you might even be better off writing your own!

What you see above is called a RANDOGRAM or a histogram that tracks random numbers. This is a visualization I made to see how the QB64 RNG looks like.

It has a nice "random" static look to it and the colors are almost equally distributed. 32,000 instances of each color (red, blue, green, purple). 

Now if we applied this to Scrapship, that would mean that if I spawned 4 types of enemies, the spawn-order would have a lot of variance, but ultimately each type of enemy (e.g. shield fighter, bomber, cruiser, battleship) would spawn about the same number of times. If you wanted an output that was more irregular you'd have to tweak the original RNG or make your own.

I had mentioned earlier how I had been reading about Procedural Generation in game design. That, coupled with my experiments in RNG led me to try creating random maps -- possibly for a future game???

Below you can see my early attempt at procedural map generation:

 

It looks pretty good -- but there are still some straight lines that are a little too obvious. 

When I tried to do this with the built-in RNG from QB64, it looked awful because -- as mentioned before -- it tends to distribute evenly. You can render a thousand randograms and you'll almost never see "slabs" of similar colors next to each other. So if you want to make a continent made out of pixels, you got to be creative.

If you're interested in Random Number Generation I highly suggest this website that has some excellent articles to read and tech demos to try out!


QUOTE OF THE WEEK:

"Timing, perseverance, and ten years of trying will eventually make you look like an overnight success." -- Biz Stone

Thanks for reading and have a great rest of your week! 

(+1)

Hi,

it's quite incredible how you kept focus on your game for so long, I saw the first posts compared to what you got now, it has been a long way ! Congratulations for that.

Regarding procedural generation, I don't know QBasic, you'll get great results using Perlin noise, even if you don't have ready-to-use library or code, it's not that's hard to implement. It generate very nice smooth patterns full of clouds that can be turned into mountains and water for a on-the-ground game (exploration/mining, RPG, whatever), in space like your game, you'd to decide which level is what, for instance you can generate value between 0 and 9 (after rounding up), each one could be bonuses, resources and some enemies.

It's also pseudo-random, so the same seed will always produce the same pattern, useful for testing.

Here is a little example of what I've made years ago in C# & MonoGame using hex numbers instead of tiles for debug (with SharpNoise library):


Like the quotes you add to your posts ;).

Cheers.

Hi Infini-Creation, thanks for the kind words and feedback! 

Perlin noise does sound intriguing and I've seen it mentioned quite a bit when I was researching procedural generation. Simplex noise is another type I remember being talked about. 

Your InfiniteTileMap looks like an efficient tool for debugging. Not sure if you are in the process of making any games, but I wish I had made more debugging tools like that early on because it saves so much time troubleshooting problems as the project gets larger.

(+1)

You're welcome ;).

There are a few algorithms for noises, Perlin and Simplex are two of them, I guess there is no need to fully understand everything behind for using them, and implement them may not be too hard to do if no one already done for the language you use, in C++ there is quite a huge probability some already exists.

It was in fact not fully debugging tool, then numbers are just to have a quick view of what was generated, then replaced by tiles gfx, it become a nice world to play on like below when it is partially done:


here with some "developer's assets".

The strength of using noise allow to have an actually infinite worlds with very tiny memory footprint as the same seed generate the same map and "moving" is just generate a new map with a little shift in each step to one direction.

I guess this is experience talking, as a professional software engineer, I did lot's of such small step to move forward with the least possible issues (it's like building a house, starting by foundations which have to be strong) and I'm always interested by making game but never really get fully committed to I've only started doing some core stuff, until now maybe, Godot is very great tool and simplify a lot's of annoying low-value work.