Author Topic: Procedural generation  (Read 2772 times)

0 Members and 1 Guest are viewing this topic.

Offline coolsnake

  • LV2 Member (Next: 40)
  • **
  • Posts: 36
  • Rating: +2/-0
    • View Profile
Procedural generation
« on: September 08, 2010, 10:30:09 am »
I've taken an interest in procedural generation lately. More specifically for the generation of areas in space.

Here's a snippet from wikipedia:

"The earliest computer games were severely limited by memory constraints. This forced content, such as maps, to be generated algorithmically on the fly: there simply wasn't enough space to store a large amount of pre-made levels and artwork. Pseudorandom number generators were often used with predefined seed values in order to create very large game worlds that appeared premade. For example, The Sentinel supposedly had 10,000 different levels stored in only 48 or 64 kilobytes. An extreme case was Elite, which was originally planned to contain a total of 248 (approximately 282 trillion) galaxies with 256 solar systems each."
http://en.wikipedia.org/wiki/Procedural_generation

I tried to do the same thing in TI-Basic. If my math is right, the size of the universe I've created on my calculator is in the magnitude of ~10^40 calc screens.
I did this by using the pseudorandom number generator of the calculator and by using predefined seed values.
The downside is, they aren't unique.
In other words, I want my calc-universe to be made up of unique calc screens only, I don't want to come through the same screen twice.
I've been thinking of a way to make this happen, but I didn't find one. Does anyone have an idea?

I've added the universe thing as "space2d.8xp". I did a quick optimisation with sourcecoder and the code itself could probably be more optimised but that isn't my main concern right now.
I've also included the individual subroutines in source.zip

ENGIN is the main game loop.
COLLIS checks for when you reach the edge of the screen and updates the X,Y coordinates, generates new seeds
NUMBERS puts the seeds into rand and generates a pseudorandom number from which the stars are generated.
CONV converts the pseudorandom number into individual numbers. e.g 123 becomes 1, 2 and 3.
COORD uses the individual numbers to generate the coordinates for each individual star while also providing collision detection.
« Last Edit: September 08, 2010, 10:32:04 am by coolsnake »
Unpretty Integrals
This program gives you a graphical representation of the "fnint(" function, which allows you to calculate definite integrals. It is extremely similar to the functionality MathPrint provides, minus the extreme bloat that slows your calculator down to a crawl.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Procedural generation
« Reply #1 on: September 08, 2010, 01:32:09 pm »
I tried doing dungeon randomizing in BASIC before but it seemed pretty hard. I never could figure out a good algorithm to draw walls without ending up with a dead end or something. It would be nice to see such game in BASIC, providing it runs fast enough. Also walls would have to be stored somewhere like strings, matrices, etc, to ensure fast collision detection (should be possible to do at least 3 frames per second unless there are plenty of enemies moving around)

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
Re: Procedural generation
« Reply #2 on: September 08, 2010, 04:31:10 pm »
A vastly intresting topic, not something I have experience in though. Reminds me of borderlands (a game) with its procedural gun generating system to make over 17.5 million guns (according to the last official count). Yep that is more then CoD has :P
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Procedural generation
« Reply #3 on: September 08, 2010, 04:33:07 pm »
Yeah I noticed that game has so many x.x it's insane. I dislike how you need to be a certain level to use most, though. I miss the days where it was possible to 1-hit kill bosses at low level when you got powerful weaponds ;D

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Procedural generation
« Reply #4 on: September 08, 2010, 09:08:46 pm »
This is really interesting. I'll check out your code and look into it. This is interesting :)
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)