Product Chat / Procedural / Random Worlds in GG

Author
Message
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 14th Aug 2016 18:13 Edited at: 14th Aug 2016 18:14
Hey all,

thought I'd share some progress here with procedural levels - i.e. levels and world environments that are created/organised by code.

It might be of interest also because "AI at height" seems to be working a lot better than it used to (not perfect as you'll see). I'm not sure if this is something Lee has been working on as part of the latest beta as part of EBE (it's not mentioned in change log). All of these AI are way above the default terrain.

I wanted to add some random game levels to Cogwheel Chronicles, that are not pre-planned and change each time the level is played and so have been working on procedural creation of these. It's taking longer than I expected (doesn't everything?) but am finally starting to get repeatable but random and very different levels to emerge each time the script is run.

This is how the level starts out - approx. 4,000 blocks and 50 enemy AI are used by the cavern/maze generator.



And this is what the level looks like with one run through - it changes quite radically each time, so if I look lost, it's because I am - which is quite weird when you are used to knowing exactly where enemies are and how the environment is placed.



The level looks very sparse, but I haven't worked on placing 'clutter' in there yet. Also what would be really cool would be if I could move/place dynamic lights in the caverns, but don't think the engine/lua lets us move lights unfortunately and I can't place them before hand with this type of level. Bringing down the light levels more than in the video hides the hard edges and is pretty spooky using the flashlight only - the procedural caverns are huge and on many levels and it's very easy to get lost ... but it needs some procedural light placement to highlight the 'rooms' within the maze or will get too lost, too quickly in the dark.

I've also got some levels that place random scenery (trees, foliage etc) across the entire map - 4,000 animated trees (using vertex shader for the animation) and several thousand bushes. Looks quite good and doesn't impact FPS as much as you might expect. I just need Harry's new dinos in there too for some 'sport' .

Comments, observations, suggestions welcome.

Cheers.

Attachments

Login to view attachments
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 14th Aug 2016 21:03
That looks really good, i'm impressed.

Now if only the random map option would actually give a random map, think of the things you could do

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Wolf
Forum Support
16
Years of Service
User Offline
Joined: 8th Nov 2007
Location: Luxemburg
Posted: 15th Aug 2016 02:42
I have no idea how you did this, because all approaches of how I'd tackle this would end in complete disaster. Colour me impressed

(Aside from that, I do have some observations that are unrelated. I believe your rifle weapon would look a lot better if it where smaller/scaled down and thinner. And the lens flares you got going don't really fly with steampunk for me.)



-Wolf

"When I contradict myself, I am telling the truth"
"absurdity has become necessity"
TazMan
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 20th Jan 2011
Location: Worldwide Web
Posted: 17th Aug 2016 11:38
As Wolf said this is very impressive, I have always thought that it would be great if we could have games that changed each time you replayed them. This is a close step to that happening. It must be some mega scripting.
Alienware M15x I7 720QM (1.60Ghz 8mb), 8GB Memory, 1GB NVIDIA GForce GTX 260m, 15.6", 64 Bit Operating System (Windows 10), 1 TB Hard Drive.

I've got something to say - It's better to burn out than fade away.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 17th Aug 2016 11:51 Edited at: 17th Aug 2016 11:55
Nice work!
I've thought about this sort of thing in the past, but the fact I have to place each item manually into the level, has pretty much put me off. Being able to load them via script would be far better At least being able to clone or instance one object over would be a good compromise, meaning you only have to load one of each to begin with. Very cool though and I'm tempted to make my maze generator idea all over not that I got past the thinking stage last time, when I realised I would have to physically place a LOT of objects at the start I decided to wait until there were a few more options in this regard. I'm tempted to have a go now

Quote: "Now if only the random map option would actually give a random map, think of the things you could do"


This was random? I thought that was the point of the post. Edit - Ah I'm guessing you mean the terrain. Yeah, the option should be changed to "generate the same map", lol.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 21st Aug 2016 10:57 Edited at: 21st Aug 2016 12:13
@Belidos - thanks ! And yes the random terrain option could do with some sliders of its own to change its behaviour. Think yrkoon was making some progress with terrain outside of GG using a separate tool he was developing that could generate and/or import heightmaps but not sure how that's moving on now.

@Wolf - thanks for the comments. I agree about the rifle being a little too large, but I'm going to stick with some lens flare of some sort, as of course you would be wearing goggles with steampunk

@TazMan - thanks and it's fun seeing levels emerge by randomness, the scripting isn't too bad at first, but can get into a long cycle of tweaking once the basics are in.

@DVader - thank you. I know exactly what you mean about the manual placement but have found that by using the 'I' spray tool (whilst keeping a record of start and stop of entity range numbers) it isn't that bad - getting all the entities on a map takes a few minutes but then once that done and map saved can concentrate on the scripting and level building.
I'd encourage you to try your maze building ideas - it was just an experiment for me but now I can see some real potential to add some great variability to levels. Your WIP project might be able to utilise this approach for some of the underground areas? I'm finding that I'm needing to blend the random parts with some 'pre-fabricated' parts of the maze to ensure I get control of some parts of the level (the story telling and game changing bits). It's pretty cool overall - I reckon you will get sucked into it once you start . Lots of references on algorithms to get you going via google unless you are rolling your own from scratch.

Really wish dynamic lights could be moved like other entities can be. Moving vehicles, characters etc could be seen with lights with this capabiltity as well being able to move them to the surrounding area of the player - having 3 on at any one time might not be such a big problem if they could be moved by scripting too.

I suspect this procedural approach might work really well for space station type tunnels and hangars - with the correct high quality textures on the building blocks and door placement etc. I tried using block entities created with the EBE to do this and it worked well (but of course as can't save these yet haven't pursued it).



Attachments

Login to view attachments
Isagabe
9
Years of Service
User Offline
Joined: 12th Sep 2014
Location:
Posted: 21st Aug 2016 14:50
Incredible work. Amazingly well done! As someone that only dabbles in the most basic of code this is mind blowing.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 21st Aug 2016 19:38
That is sooo cool
Intel i5 4950 Quad core 3.3ghz
8gb Ram
Nvidia NVS 315 1gb
and a well fed mouse on a wheel

When Reality is broken. Game designers can fix it and make it more realistic
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 22nd Aug 2016 06:18
Very impressive. Now I'm thinking No Man's Sky :o
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GT 740
science boy
15
Years of Service
User Offline
Joined: 3rd Oct 2008
Location: Up the creek
Posted: 22nd Aug 2016 10:16
well in my little man cave house and all is starting to settle at science boy manor.

to start with what how and wow.

followed by blimey this is very promising, a bit like the game called something something sword, made on db i believe, where it is never the same game ever. malevolant sword i believe.

so is the maze done with ebe or your own bits?

i just have no idea how you even come up with the idea let alone create them. i am forever baffled and in awe of your super coding skills with what you do with gg. i can only dream of what you achieve.

well done and keep the conundrum of baffling intrepid madness of professor nuts cybernescence scripts coming.

inspiration and defeat all in one
an unquenchable thirst for knowledge of game creation!!!
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Aug 2016 14:40
its a good idea to place all the models off to the corners so it wont slow the editor down to a crawl too and if it does get slow move the mouse off the terrain (onto the grey menu part is fine) to improve speed a bit.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 22nd Aug 2016 23:26 Edited at: 22nd Aug 2016 23:29
Thanks for the comments

Here's something for you to have a go with to see if you get the 'random bug'.

The script places a tree (well any dynamic entity) randomly on a map at the correct terrain height but avoids water areas. So add the script to a dynamic tree first on a map then extract it and spray (by pressing the 'I' key then left clicking mouse) lots of the same tree entity onto the map - doesn't matter where, but as smallg mentions, once you get several thousand on the map it can slow the map editor down if the trees are all placed on top of each other. I've also included a vertex shader for the trees which will animate them (so use a non animated tree with this shader) - this appears to be a much more efficient way to animate a lot of trees - I've had many thousand on a map and still maintained FPS. You can also use the script for any entity really - turn physics off before spraying onto the map for smaller bushes and small rocks - this helps keep FPS up with lots of entities as collision obtsacles are not calculated by the engine (and aren't needed anyway). You can use a variation of the script for NPC enemies too - just change the script to switch to ai_soldier.lua (see comments in code).

To make it easier I've prepared the files in the attached zip move them into the correct GG folders (as outlined in the zip archive), including the fpm file and then load/run it to see the effect.

There are over two thousand animated trees in the attached map - of course you can use more or less and you can adjust the script so it only populates some of the map rather than all of it (perhaps a random forest in one known area just next to your castle for example).

Cheers.



Attachments

Login to view attachments
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 23rd Aug 2016 05:45
Thanks. Great job.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Isagabe
9
Years of Service
User Offline
Joined: 12th Sep 2014
Location:
Posted: 23rd Aug 2016 07:58
Thank you. Impressive.
science boy
15
Years of Service
User Offline
Joined: 3rd Oct 2008
Location: Up the creek
Posted: 23rd Aug 2016 19:11
thankyou for this nugget of gold. i will experiment one sunday
an unquenchable thirst for knowledge of game creation!!!
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 23rd Aug 2016 21:18
I've done a bit of work in this area before in DB and AGK. To a limited extent in GG also, but never really gone far due to placement of objects as said above, also a lack of commands that would make it far more useful overall (get object size would be needed here imo for good placement of objects). I'll certainly be thinking of looking into it at some point, my current project probably wouldn't work with a random map, apart from possibly in later sections, but a maze may be in order If I can find a hedge that doesn't suck the fps out of the level I could use walls, but would spoil the effect.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 24th Aug 2016 20:31 Edited at: 24th Aug 2016 20:31
I had a thought on this instead of trees could you have random instances e.g say a door/sewer entrance that transports you to an instance area? so you could say take a mission from an npc and it randomly puts it somewhere on the map with a marker? now that would be cool
Intel i5 4950 Quad core 3.3ghz
8gb Ram
Nvidia NVS 315 1gb
and a well fed mouse on a wheel

When Reality is broken. Game designers can fix it and make it more realistic
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 13th Oct 2016 15:48
Not exactly raising this thread from the dead, it's just been a bit sleepy

I've perservered with this random procedural labyrinth idea ... and of course it always takes more time than I think. Still getting there now with some reasonable game play (though my beta testers say it's too difficult ... I guess it must be given the type of full on big studio shooter games they normally play, so am balancing out still). It's too difficult to get through with all the enemies and can get badly lost often (very large maze), so am adjusting ranged weapons and working on providing a limited reveal map once some players achievements are complete.

So a quick summary just in case it helps inspire or reassure others who might want to try this type of approach:

There are 10,000 entities in this level ... all apart from a few dozen are procedurally placed during initial loading (I found you must do this initial level creation, which has lots of large array manipulation, within the 'init' section of the script or stack timeouts occur).
There are several hundred traps, lava pits, animated spikes (and other surprises) and 100 NPC enemies of differing types.
Stairs of correct height are procedurally placed to enable movement up/down through maze levels (though the initial vertical connections had to be carefully tuned in the initial world creation algorithm as having too many is just annoying to traverse as a player)
Random cellular 'prefabs' are applied to make sure there is at least one large open area for ranged battles per level
Save/Load had to be redone a fair bit (it relies on the map having most of the static objects already being placed obviously, with a procedural world you have to rebuild the map each time prior to reapplying the last saved data snapshot - this should have been as easy as regenerating from a saved random seed ... but wasn't/isn't ... think there may be a lua bug (not GG) I haven't quite cracked yet.)
Performance after severe optimisation work (mostly LOD but the last GG update made a big difference here) hovers around 30FPS which feels smooth enough. This is with full post effect shaders but optimised entity shaders (so any GG setting always applies 'high' to core important entities/characters (they need to glow in the gloom), but' low' to all non important clutter etc).
Also implemented 'permadeath' (after last life gone all saved data is erased and player starts again with a new random level not seen before) as an added incentive to approach the game play by stealth but feedback is that this is just really frustrating ... so may lose this aspect .. anyone got any views on permadeath in games?

Anyway, happy days, nearly there with this level (kind of). Feedback on 'permadeath' or any maze related games you've loved/hated and why would be most welcome

I can safely say you can do procedural worlds in GG (with a lot of code) ... but just really wish I could move those lights!!!


Cheers.

Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 13th Oct 2016 17:29
Wow!! Quite the project you have going on there. Very nice.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Login to post a reply

Server time is: 2024-04-27 05:04:26
Your offset time is: 2024-04-27 05:04:26