Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / Procedural Generation [WIP]

Author
Message
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 21st Aug 2016 22:53 Edited at: 22nd Aug 2016 00:29
Okay, so old ideas have a way of coming around.

I have been thinking more about infinite worlds lately, so I wanted to give some procedural generation a try.
Well, this is semi really, since I am using images and not drawing them, but laying them out for an infinite stream is fun.
I am generating 2d terrain based from 25 separate land images that are numbered based on left starting and right stopping points...



The image above shows number 24 starting at the #2 position and ending at #4.
This layout is simple and makes matching images easy.
The next image to the left would need to end with a 2 to match this starting number.
The next image to the right would need to start with a 4 to match this ending number.

So, 25 images numbered as so, cover the possible transitions between tiles...

11,12,13,14,15
21,22,23,24,25
31,32,33,34,35
41,42,43,44,45
51,52,53,54,55



20 sprites are used to create a loop with 16 on screen, and 2 off screen on either side
Number 1 to 19 are drawn randomly in a way to connect in a stream, then 20 is the master link connecting 19 and 1 for the loop.
As tiles are pushed out of bounds either way, they are re-positioned for the loop and assigned a new image randomly to match its new neighbor.

Planting a new seed will reset the 20 sprites being used for the loop.
A continual direction will allow for reviewing the seeded patterns.
However, once a directional change has been made, the randomness will be mutated and unrecognizable.

Give it a try if you like... http://www.conjuredentertainment.com/agk/wips/pro_terrain_2d.zip

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Attachments

Login to view attachments
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 23rd Aug 2016 15:55
No comments eh?

I have added a bouncing ball to the example in the ZIP, so your terrain scroll exploring won't be so boring.

I plan to add many variables to this system, so that the random seeds will be controlling everything from planet positions, to their mass, gravity, atmospheric conditions, lifeforms, plants, minerals, weather, etc.

This space game will be 3d for ship construction, space exploration, and space battles with other ships.

Then, the game will switch to 2d when exploring planet surfaces for mineral probing/mining, and gathering of other resources and specimens.

The bouncing ball will be a probe for planet surface exploration, and the game will offer a mining robot which users build and customize based on available resources.

The idea is that you start the game with minimal resources and a basic space ship, then you must explore the universe to find what you need to upgrade your ships and equipment.

Upgrading the ship will be crucial for surviving alien battles in order to venture out into uncharted areas, and venturing out will be necessary for gathering resources for upgrades and fuels.

The seeds will provide an expansive (infinite) universe, and I hope to develop a mineral/item system that will be complex enough to allow for an insane amount of possibilities for unique game play.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 24th Aug 2016 13:50
Sounds good. I loved Elite as a kid.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 24th Aug 2016 14:56 Edited at: 24th Aug 2016 17:06
Quote: "Sounds good. I loved Elite as a kid."

I never played it, but the latest installment of Elite looks awesome.
It even looks as if you can download a copy of the 1984 version for FREE!
Here is a link to a nifty article about the game, and it makes for a really good read about the developers.
It seems we started programming around the same time, but they obviously had much more success with the dream.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 24th Aug 2016 15:49
Hehe. Cool! Downloaded.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Aug 2016 11:31
This is basically how I generated the maps for Kingdom. The maps were procedurally generated too. It's amazing what you can do using random numbers and the more I did the more ideas I had. It's great fun to play with this kind of stuff and if you are clever with it you never have to build a level manually again. It can also give the player effectively an infinite number of maps to play / explore!
Using AppGameKit V2 Tier 1
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 25th Aug 2016 15:09
Hey buddy! Amazing work and great game foundation. I sent you a private message, with a bunch of thoughts and some ideas. Send me a PM or if you can, reply with email: joshlmooney@gmail.com.

This project of yours is oddly very VERY similar to a project I'm working on right now, with allot of the same science fiction ideas and the randomly - procedural levels and similar details. I've been designing my game for over 2 years now and have just recently started it as my next major project. My offer is we could team up, or at the very least help each other out.

Let me know what you think and take a read of my private message and get back to me. Thanks bud!
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 25th Aug 2016 19:15 Edited at: 26th Aug 2016 08:16
Quote: "This is basically how I generated the maps for Kingdom. The maps were procedurally generated too. It's amazing what you can do using random numbers and the more I did the more ideas I had. It's great fun to play with this kind of stuff and if you are clever with it you never have to build a level manually again. It can also give the player effectively an infinite number of maps to play / explore!"

Kingdom looks really awesome!
If I can get my scenery half that nice I will be very happy.
I'll definitely be checking out the stuff you are sharing there, because I have a lot of work left for the plants, and animals in 2d.

Yeah, an old idea that is still the way to go and the future. You are right about the fun and flow of ideas for using the random numbers. I am just getting started playing around with it, but I'm already hooked and will be using procedural generation in all of my future games.

Quote: "This project of yours is oddly very VERY similar to a project I'm working on right now, with allot of the same science fiction ideas and the randomly - procedural levels and similar details. I've been designing my game for over 2 years now and have just recently started it as my next major project. My offer is we could team up, or at the very least help each other out.

Let me know what you think and take a read of my private message and get back to me. Thanks bud!"

PM's sent

I am willing to share my algorithms for PG ideas, except one. I developed it for finding extremely long prime numbers with limited math processors (digit limitation removed - coded in DB). Part of that algorithm will be used for infinity, and that part I don't plan to share freely. Most of my math is very basic, so no big secrets. Some of it so simple it will probably be laughed at, but it gets the job done. I plan to openly share the simple stuff to anyone interested.

I worked on Name Generation yesterday, and it was a lot of fun.




EDIT

Here is another snippet...


As you can see, I add combinations of consonants to the alphabet, as well as combinations of certain vowels.
I also, avoided using double letters like "ll" or "nn" as the first consonant selection in a word, and also avoided ending with double vowels like "ee" and "oo"".
This was a simple addition to the code above that gets somewhat different results, and shows how simple expansions are possible to the snippet.

If you run the second snippet and set it to seed #5, then hit ENTER twice, the answer to the question of "when will this game be finished?" will be revealed.

On a side note:
The bouncing ball has its trajectory based on the number of the image used.
For instance, the above 24 tile shown would result in 2 - 4 = -2, so the -2 is used in the algorithm to set the X value of the force.
If the tile were a 42, then is would be angled in reverse, and the 4 - 2 = 2, so a 2 would be used to calculate the X of the force.
The ImageID for each sprite is used to read the number for the tile, so an array for those values did not need to be created.


EDIT

My last routine had an error for following a "q".
I changed the next vowel to a "u", but I should have added a u instead, so another vowel would follow it.
lol easy fix though.

Here is my latest demo.
It names the Planet, and it's ten most abundant minerals, for each seed, and also sets that planets colors for land and air.
I have changed the name generation since this screenshot, but it gives you an idea...

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Attachments

Login to view attachments
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 27th Aug 2016 03:25 Edited at: 29th Aug 2016 21:40
Here is a demo that has a mock up of the mining process.
I have added some sound effects and a teleport beam for the ore.
The ore's molecular structure will be broken down for teleporting.
Instead of molecular reconstruction into the original form, the teleporter transforms the elements into useful items.
Steel and other raw materials for ship construction, and fuels for ships, with left over elements being sold for credits.
The ore's structure/mineral worth will be based on its name, and math used to convert it the name back to numbers.
This way, if two worlds generate the same mineral name, that mineral will be worth the same amount in both places regardless of planet seed.

The probe (bouncing ball) energizes the soil on contact for preparation for teleportation.
The effect only lasts for a fraction of a second though, so the soil must be energized inside the beam to be teleported.
Once teleported, that section of soil will not be able to be mined again immediately., and its color will reflect that.
Teleport as much ore as you can before your probe's fuel runs out.



Upgrades in probes/teleporters will allow for greater yields when mining, and offer larger fuel capacities.
Upgrades in probes will change game mechanics, and requires different skills for varying mining mini-games.

Edit

Inspired by the Skyway menu, I decided to begin some of the 3d stuff...
Not your average sphere, and it has a separate rotation speed from the cloud layer, so it looks better in game.
Now, I get to try my hand at procedural texture generation, so I can create unique looks for these planet seeds.
There will be 3 types of celestial bodies to visit; moons, planets like Earth with water in habitable zones, and planets that are not.
The potentially habitable planets will have life and can be explored as a 2d platformer, the others can only be mined in mini-games.



Edit

I have not started the procedural textures for the planets yet, but I have been working on the layout of the Navigation Menu more.

Top Left = Informational Display

Bottom Left = Resource Status

Top Right = Solar System Menu (select planets of current star system to explore/mine)

Bottom Right = 3D perspective of targeted planet in system menu above.

Note: Clicking on a star in the perspective window will tell you its name and the distance you are from it.
It will highlight in red (star & information) if you don't have enough fuel to reach it, or green if you do.
Traveling to other star systems will offer you chance encounters with other ships for 3d space battles...


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Attachments

Login to view attachments
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 29th Aug 2016 23:09
Hey there CE, not seen you around for a while and I have not been on here myself for some time too with doing this Eduguru stuff so it is good to see you on here when I take a look.

I like your project, some great ideas here and it looks like there is a big game waiting to escape


Looking forward to seeing where this goes, keep up the good work CE.
The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 30th Aug 2016 20:47 Edited at: 31st Aug 2016 18:52
Thanks SpecTre,

My schedule has been hectic too, so I missed my launch window for the EduGuru journey.
I know you guys are going to have a big hit with that endeavor, so congratulations in advance.

I'm back to hobby time with tier 1, and I hope to get this procedural project finished one of these days, but I do plan to keep it on the front burner.
That is the best thing about procedural generation though, take the time to make one good algorithm and it will save lots of development time later.
It may take awhile to get a nice set of algorithms together for each function, but when it's done it will be "the most expansive virtual universe possible".
I'll need to compound names or even add numbers to them as it expands, but there is no limit to the number of digits I can add to the left side of my odometer.

Edit
Still giving thought to a title, but leaning towards... "somnium infinitus"

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 30th Aug 2016 21:30
Quote: "It may take awhile to get a nice set of algorithms together for each function, but when it's done it will be "the most expansive virtual universe possible"."


Very true!

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!

Login to post a reply

Server time is: 2024-04-20 10:28:26
Your offset time is: 2024-04-20 10:28:26