 Above is a screenshot from my game **Amber Sol**, currently in development. You can try the latest demo version out by downloading it from the projects [itch page](https://anorstudios.itch.io/amber-game-project). The above planet is generated with filled cells each being drawn every frame using a random seed value which is also derived based on a master seed and the location of the cell. So given the same master seed and the location the same planet image will be generated. This is a really cool property of pseudo-random number generators. It is also a really useful technique used to create large unique but reproducible worlds. Pseudo-Random Number Generators... === So pseudo-random number generators use __seed values__ to derive a unique list of numbers with an even distribution. Meaning the order will be unique but you will also see each number close to the same number of times. This means that we have some predictability to the sequence as well as reproducibility, which is really cool. Effects of seed values --- In other words, if I use one of these pseudo random number generators to generate a random number between 1 and 10 with a specific seed value. I will get the same sequence with that seed each run of the program. Or each time I reset the seed value for that generator. In the solitaire game that I wrote [_available on itch and android_](https://anorstudios.itch.io/simply-solitaire) I save games simply by saving the seed value used to shuffle the cards. As well as every move you made since you started. Those moves are then used when loading a game to get you back to the state you were in when you left the game. This minimizes the game saves. Is very quick to save and reload. And provides a way to undo all moves you've ever made even after loading an old save. Even distribution --- If I generate 10,000 integers I will get each of the ten numbers approximately the same number of times. One thing that you want to do in many games is give something a chance to happen. Maybe it's dice roles or whether a monster attacks you or not. You can apply chance to these generators pretty easily, by picking x in y chances. Writing a chance function --- So you can write a simple chance function knowing that every number in any sequence will occur a similar number of times. Say you want 1 in 5 odds that a statement is true. Have your generator generate numbers between 1 and 5 pick a number lets just say 1. If the number is 1 then the statement is true. And the function will return true approximately once for every five generations. But depending on the sequence it could happen at seemingly random intervals. Here is an example of a chance function. For the [Love2D engine](https://love2d.org/) which is what I am writing my games in: ```Lua function chance(once, everyn) return love.math.random(1,everyn) == once end ``` We can write this in just plain lua using the `math.random` function instead by just removing the `love.` part. Here is what happens if we add a random amount of green to each cell with a 1 in five chance for a cell to contain green if the planet is gray.  So each cell has a 1 in 5 chance of being randomly some amount of green. In the future I hope to add multiple types of random features to each planet making them more distinguishable and unique. Things like lakes, and rivers, mountains. Volcano etc. Here is another one I added.  _P.S. The green rectangle is where enemy ships appear orbiting the planet that you need to eliminate in the game._
author | zealouscoder |
---|---|
permlink | very-simple-random-pixelated-planet-generation |
category | gamedev |
json_metadata | {"tags":["gamedev","gaming","technology","steemstem","programming"],"image":["https://cdn.steemitimages.com/DQmZ5RCPUEefyVnGdihrZuWTuXHGq55H3kwmUYkP68sdGNU/1529503346.png","https://cdn.steemitimages.com/DQmNbiMqH4fq85HTRcyTg3V6Nzre5GACqyZWFkWmD1ViAZB/1529515941.png","https://cdn.steemitimages.com/DQmWtKo9wpUYYc5f97kcVXe5zRQepuc37D976Y8jP8cesEv/1529516095.png"],"links":["https://anorstudios.itch.io/amber-game-project","https://anorstudios.itch.io/simply-solitaire","https://love2d.org/"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-06-20 19:48:09 |
last_update | 2018-06-20 19:48:09 |
depth | 0 |
children | 3 |
last_payout | 2018-06-27 19:48:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 4.806 HBD |
curator_payout_value | 1.549 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 3,867 |
author_reputation | 109,466,698,511 |
root_title | "Very Simple Random Pixelated Planet Generation" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 0 |
post_id | 61,538,375 |
net_rshares | 3,105,957,737,914 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
lafona-miner | 0 | 175,406,501,228 | 5% | ||
kevinwong | 0 | 76,813,841,993 | 0.75% | ||
justtryme90 | 0 | 113,798,837,562 | 5% | ||
arconite | 0 | 301,814,107 | 0.37% | ||
lemouth | 0 | 23,394,200,843 | 5% | ||
rjbauer85 | 0 | 309,266,112 | 5% | ||
anarchyhasnogods | 0 | 10,440,662,732 | 3% | ||
lamouthe | 0 | 1,667,420,795 | 5% | ||
thecastle | 0 | 32,901,439,338 | 20% | ||
steemstem | 0 | 145,932,229,165 | 5% | ||
foundation | 0 | 692,806,899 | 5% | ||
the-devil | 0 | 657,527,259 | 5% | ||
thevenusproject | 0 | 2,814,165,348 | 5% | ||
borislavzlatanov | 0 | 430,777,429 | 5% | ||
jade56 | 0 | 125,907,191 | 2.5% | ||
kryzsec | 0 | 3,060,653,741 | 5% | ||
fredrikaa | 0 | 13,324,585,651 | 5% | ||
dber | 0 | 1,037,942,457 | 5% | ||
mahdiyari | 0 | 3,173,668,908 | 2.5% | ||
kerriknox | 0 | 5,241,130,670 | 5% | ||
alexander.alexis | 0 | 626,673,028 | 2% | ||
saunter | 0 | 1,686,973,248 | 5% | ||
ertwro | 0 | 2,073,641,227 | 5% | ||
juanjdiaz89 | 0 | 72,838,273 | 5% | ||
nitesh9 | 0 | 1,255,422,675 | 5% | ||
fancybrothers | 0 | 760,847,888 | 1.5% | ||
churchboy | 0 | 899,854,275 | 5% | ||
howo | 0 | 4,761,973,493 | 2.5% | ||
himal | 0 | 385,451,605 | 5% | ||
abigail-dantes | 0 | 86,032,595,095 | 5% | ||
suravsingh | 0 | 66,295,647 | 5% | ||
planetenamek | 0 | 144,145,934 | 0.25% | ||
alexzicky | 0 | 814,663,990 | 1.25% | ||
mountain.phil28 | 0 | 3,605,815,384 | 25% | ||
akeelsingh | 0 | 209,418,421 | 5% | ||
mountainwashere | 0 | 2,432,348,953 | 5% | ||
zest | 0 | 1,595,142,133 | 3.5% | ||
felixrodriguez | 0 | 144,284,429 | 2.5% | ||
masterwriter | 0 | 171,880,915 | 5% | ||
alokkamboj | 0 | 0 | 100% | ||
laylahsophia | 0 | 1,499,868,560 | 5% | ||
ksolymosi | 0 | 1,194,333,534 | 5% | ||
simplifylife | 0 | 894,820,293 | 2.5% | ||
espoem | 0 | 3,182,031,628 | 3.5% | ||
mayowadavid | 0 | 265,189,322 | 2.5% | ||
zeeshan003 | 0 | 60,106,089 | 5% | ||
enzor | 0 | 85,474,044 | 2.5% | ||
pratik27 | 0 | 199,444,681 | 2.5% | ||
carloserp-2000 | 0 | 1,193,303,366 | 5% | ||
rachelsmantra | 0 | 214,559,082 | 5% | ||
gra | 0 | 1,753,691,764 | 5% | ||
utopian-io | 0 | 2,282,406,566,032 | 1.5% | ||
tfcoates | 0 | 98,421,118 | 1.25% | ||
ajayyy | 0 | 2,163,991,089 | 100% | ||
physics.benjamin | 0 | 103,274,166 | 5% | ||
kenadis | 0 | 1,415,404,642 | 5% | ||
amavi | 0 | 780,859,306 | 1% | ||
florae | 0 | 273,733,349 | 5% | ||
robotics101 | 0 | 231,005,169 | 4% | ||
aamin | 0 | 97,484,934 | 2.5% | ||
sco | 0 | 501,993,333 | 1% | ||
adetola | 0 | 378,118,832 | 5% | ||
rharphelle | 0 | 1,227,788,168 | 25% | ||
dysfunctional | 0 | 274,836,465 | 2.5% | ||
shoganaii | 0 | 260,464,492 | 2.5% | ||
whileponderin | 0 | 420,360,968 | 5% | ||
mittymartz | 0 | 111,027,718 | 5% | ||
hadji | 0 | 223,683,811 | 5% | ||
sakura1012 | 0 | 202,936,731 | 5% | ||
terrylovejoy | 0 | 1,263,449,440 | 2.5% | ||
saunter-pl | 0 | 104,080,174 | 5% | ||
brian-t-penguin | 0 | 229,284,329 | 100% | ||
steepup | 0 | 76,123,687 | 2% | ||
steem-hikers | 0 | 94,217,411 | 5% | ||
deutsch-boost | 0 | 480,809,730 | 20% | ||
kingabesh | 0 | 110,126,837 | 2.5% | ||
drakahn | 0 | 127,982,128 | 100% | ||
kelos | 0 | 435,641,176 | 10% | ||
dexterdev | 0 | 488,575,800 | 5% | ||
ugonma | 0 | 232,533,402 | 5% | ||
marketstack | 0 | 2,519,573,533 | 0.85% | ||
joelagbo | 0 | 123,190,525 | 5% | ||
spederson | 0 | 93,865,326 | 4.5% | ||
cryptoitaly | 0 | 240,804,013 | 2.5% | ||
lionindayard | 0 | 2,107,492,443 | 0.85% | ||
effofex | 0 | 102,085,034 | 2.5% | ||
mrbreeziewrites | 0 | 300,724,970 | 5% | ||
de-stem | 0 | 2,123,501,845 | 4.5% | ||
serylt | 0 | 817,411,013 | 4% | ||
yann85 | 0 | 413,417,928 | 12% | ||
event-horizon | 0 | 50,517,276 | 5% | ||
chloroform | 0 | 821,877,473 | 5% | ||
vanessahampton | 0 | 301,945,810 | 2.5% | ||
albatar | 0 | 242,298,268 | 25% | ||
temitayo-pelumi | 0 | 313,557,710 | 5% | ||
doctor-cog-diss | 0 | 305,678,907 | 100% | ||
dick.sledge | 0 | 6,336,097,092 | 0.85% | ||
star-vc | 0 | 118,060,463 | 5% | ||
biomimi | 0 | 220,267,082 | 40% | ||
astrophoto.kevin | 0 | 380,490,887 | 2.5% | ||
pi10000 | 0 | 61,131,867,449 | 51% | ||
dalz | 0 | 898,715,700 | 100% | ||
teck | 0 | 145,829,518 | 100% | ||
up-quark | 0 | 1,225,224,808 | 5% |
Upvote this for me please? https://steemit.com/christianity/@bible.com/verse-of-the-day-hebrews-4-16-nlt
author | a-0-0-0 |
---|---|
permlink | re-zealouscoder-very-simple-random-pixelated-planet-generation-20180620t194842499z |
category | gamedev |
json_metadata | {"tags":["gamedev"],"links":["https://steemit.com/christianity/@bible.com/verse-of-the-day-hebrews-4-16-nlt"],"app":"steemit/0.1"} |
created | 2018-06-20 19:48:45 |
last_update | 2018-06-20 19:48:45 |
depth | 1 |
children | 0 |
last_payout | 2018-06-27 19:48:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 104 |
author_reputation | -846,595,185,511 |
root_title | "Very Simple Random Pixelated Planet Generation" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 61,538,440 |
net_rshares | 0 |
Pixelated ... never go out of style :) I see you have quite a method to genrate this... appreciated.
author | dalz |
---|---|
permlink | re-zealouscoder-very-simple-random-pixelated-planet-generation-20180621t065540036z |
category | gamedev |
json_metadata | {"tags":["gamedev"],"app":"steemit/0.1"} |
created | 2018-06-21 06:55:39 |
last_update | 2018-06-21 06:55:39 |
depth | 1 |
children | 0 |
last_payout | 2018-06-28 06:55:39 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 100 |
author_reputation | 1,923,327,531,356,790 |
root_title | "Very Simple Random Pixelated Planet Generation" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 0 |
post_id | 61,599,612 |
net_rshares | 126,721,883 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
zealouscoder | 0 | 126,721,883 | 100% |
#### Hi @zealouscoder! Your post was upvoted by utopian.io in cooperation with steemstem - supporting knowledge, innovation and technological advancement on the Steem Blockchain. #### Contribute to Open Source with utopian.io Learn how to contribute on <a href="https://join.utopian.io">our website</a> and join the new open source economy. **Want to chat? Join the Utopian Community on Discord https://discord.gg/h52nFrV**
author | utopian-io |
---|---|
permlink | 20180621t024503273z |
category | gamedev |
json_metadata | {"tags":["utopian.tip"],"app":"utopian-io"} |
created | 2018-06-21 02:45:03 |
last_update | 2018-06-21 02:45:03 |
depth | 1 |
children | 0 |
last_payout | 2018-06-28 02:45:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 426 |
author_reputation | 152,955,367,999,756 |
root_title | "Very Simple Random Pixelated Planet Generation" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 61,576,182 |
net_rshares | 0 |