Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 05:40:51 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsBraving Procedural Generation
Pages: 1 [2] 3 4 ... 23
Print
Author Topic: Braving Procedural Generation  (Read 213358 times)
ChevyRay
Guest
« Reply #20 on: March 14, 2009, 09:09:31 AM »

Looks like it works great, Cthulhu.



Got a little view-system working so I can see a blown-up view of a section of the map. The numbers currently are land-height, though all the water is just 0s right now. Still got a lot of work to do on those mountains.

Gonna make it so I can switch what digital info is displayed on the right-side there.
Logged
muku
Level 10
*****


View Profile
« Reply #21 on: March 14, 2009, 10:01:35 AM »

Code:
private function expandTerrain(a:Array, v:int, n:int, chance:Number=1):Array {
var na:Array = a;
for (k = 0; k < n;k++){
for (i = 0; i < a[0].length; i++) {
for (j = 0; j < a.length; j++) {
if (a[j][i] == v&&Math.random()<chance) {
if (j - 1 > 0) na[j - 1][i] = v;
if (j + 1 < 127) na[j + 1][i] = v;
if (i - 1 > 0) na[j][i - 1] = v;
if (i + 1 < 127) na[j][i + 1] = v;
}
}
}
}
return na;
}

Your problem is that you set your new array "na" to the old one, "a". So when you change stuff in "na", you simultaneously change it in "a" since they really refer to the same object. You need to make "na" an actual copy of "a" for this code to work.

I would be so happy.  And I would give you sexual favors.
Well, hello there!
Logged
Kneecaps
Level 3
***



View Profile
« Reply #22 on: March 14, 2009, 05:53:15 PM »

Your problem is that you set your new array "na" to the old one, "a". So when you change stuff in "na", you simultaneously change it in "a" since they really refer to the same object. You need to make "na" an actual copy of "a" for this code to work.
Awesome!  It works fine now.  Now I can move on to better things.
« Last Edit: August 12, 2009, 07:20:15 PM by Kneecaps » Logged
Impossible
Level 3
***



View Profile
« Reply #23 on: March 15, 2009, 01:28:26 PM »

wow...
Logged
Zaratustra
Level 7
**



View Profile WWW
« Reply #24 on: March 15, 2009, 01:50:11 PM »

http://zarawesome.googlepages.com/island.png

An island generator I made for a game I never finished.
Logged

eddietree
Level 6
*



View Profile WWW
« Reply #25 on: March 18, 2009, 03:56:22 PM »

Just read your article - now I am in the know.
Logged

agj
Level 10
*****



View Profile WWW
« Reply #26 on: March 20, 2009, 07:45:40 PM »

I liked that post, Chevy; very nice! So far I haven't delved too deeply into procedural generation yet, so it was an interesting read.
Logged

ChevyRay
Guest
« Reply #27 on: March 20, 2009, 07:55:46 PM »

Thanks Smiley

I'm thinking of doing another soon, but have it concentrate on using procedural and random methods for other, more specific aspects of games.

For example, having manually created levels, but having just the treasures randomly placed. Or having enemies behavior based on some randomly chosen factors.

I'd also eventually like to also write one on string manipulation (eg. random name generation, or NPC dialogue).
« Last Edit: March 20, 2009, 11:26:55 PM by ChevyRay » Logged
ChevyRay
Guest
« Reply #28 on: March 25, 2009, 07:26:35 AM »

Hehe, I noticed that pgc.wikidot.com (link) posted about my article in their news (I linked to their site from my article). That makes me happy, because it's probably the best PG wiki I could find on the internet, and the 2nd link that pops up when I google "Procedural Generation".

I need to write more articles. This one doubled the traffick to our site in March.
Logged
nihilocrat
Level 10
*****


Full of stars.


View Profile WWW
« Reply #29 on: March 25, 2009, 03:20:09 PM »

This thread is pure gold, procedural content generation is one of my favorite aspects of programming.

When I find the time to find the code, I will post my dead-simple asteroid generation algorithm I used once for an Asteroids-like game. Small scope and not really that fascinating, but it's a good example of PCG that's dead simple, and the method would give a few ideas for algorithms to people who don't know where to start.

Also, "Slartibartfast" is an awesome name for a terrain/planet generation system. Wizard

http://zarawesome.googlepages.com/island.png

An island generator I made for a game I never finished.

That's a really awesome island... it looks vaguely like Australia.
Logged

vdgmprgrmr
Level 2
**


View Profile
« Reply #30 on: March 26, 2009, 08:46:28 PM »

As a PG fetishist, I salute you, and... other things.

You did the cool land generator and the cave generator and now you say you're going to try and randomly generate freakin' NPC dialog?

I love you. I love you. I love you.

Next is the thing that I've always contemplated; randomly generated story-lines.
Logged
Kneecaps
Level 3
***



View Profile
« Reply #31 on: March 27, 2009, 07:09:42 AM »

Next is the thing that I've always contemplated; randomly generated story-lines.

Any genre in particular that you were thinking about?  And would the story be explained through text/dialogue or in-game actions?

I want something to waste time on.
Logged
vdgmprgrmr
Level 2
**


View Profile
« Reply #32 on: March 27, 2009, 01:07:24 PM »

The randomly generated plot would be played through, not simply read. A preferred genre would be medieval fantasy (low-magic, if it matters).

If someone could make a random-world-generator, then make a system to generate story-lines in the world randomly, it would be totally awesome. So you could play through a huge story in the world, then start a new huge story in the same world, or just play another one in a totally different world.

I figure it would basically make a big map, store a goal in the form of action-object-location (So, destroy-ankh-caves, deliver-letter-city, etc.) and randomly choose two locations in the map, then draw a path between the two points. Each point would be assigned a value. Then it would go through each point, and use the value as the chance for a plot-twist to be added. The plot-twist would basically be the game choosing from a list: betrayal, reveal, change-of-plans, etc. So if originally you have quest:kill-king-dwarfcity, path:city1-forest-mountain-road-city2-cave-dwarfcity, the game might select the road point to add a change-of-plans, which basically moves the end point. So the change-of-plans would cause the dwarven king to suddenly move to city4, meaning you have to reroute, so the path would change to city1-forest-mountain-road-backtomountain-desert-city3-forest2-city4. After that, no more changes-of-plans could happen, so it would continue through there and select some points (or not) to add a betrayal (one of the factions in the world suddenly has their disposition meter changed radically) or a reveal (turns out the dwarven king is actually your father).

So, we could have:

quest:find-powerstone-deathcaves
path:city1-forest-road-city2(change-of-plans:powerstone was moved to icemountain)-road2-city3(betrayal:the king who sent you on the quest suddenly reveals his intent to use the powerstone to take over the world instead of destroying it, he now becomes the main villain)-mountain-cave-icemountain-endfight

Every time I think of this it sounds good in my head, but I never actually try it.

Logged
Hideous
That's cool.
Level 10
*****


3D models are the best


View Profile WWW
« Reply #33 on: March 30, 2009, 02:11:21 AM »

If someone could make a random-world-generator, then make a system to generate story-lines in the world randomly, it would be totally awesome. So you could play through a huge story in the world, then start a new huge story in the same world, or just play another one in a totally different world.

Dwarf Fortress.
Logged

Business Bear
Level 0
***



View Profile
« Reply #34 on: March 30, 2009, 08:57:47 AM »

This tutorial was very interesting and useful to me.  It's got me excited about making some sort of PG game down the road.
Logged
JasonPickering
Level 10
*****



View Profile WWW
« Reply #35 on: March 30, 2009, 12:10:30 PM »

going on the randomly generated story route a neat addition would be adding a love interest,( nothing major think a simple Harvest moon style) once you complete your quest the world jumps ahead 25 years and you are the off-spring of the original hero, and the girl that you chose. (each lady can be given random stats, but they are kind of obvious, the chick who loves books has high intelligence and then the stats are randomly chosen from father and mother.) you get a new story, but feel like your past exploits have helped to shape this world somehow.

also a neat thing would be allow them to chose whether their character is male or female at first, but your child is randomly chosen, imagine if you are a fierce knight, 25 years later you are stabbed by an evil knight and your daughter goes off to avenge you. plus the knight stole that really bad ass sword you spent the whole last game upgrading.

there is a terrible danger in this though cause it would be possible to get the worst stats from both parents making you a bumbling clumsy idiot.
Logged

Lynx
Level 5
*****


Upstart Feline Miscreant


View Profile WWW
« Reply #36 on: March 30, 2009, 12:44:18 PM »

Quote
there is a terrible danger in this though cause it would be possible to get the worst stats from both parents making you a bumbling clumsy idiot.

Just avoid traits that are flatly positive or negative; instead, make both ends of the scale be useful, and the center be balanced.  The number of points you then choose to allocate to the trait would determine the power and importance of that attribute.

I would allow the player to choose which traits to inherit from which parent though.
Logged

Currently developing dot sneak - a minimalist stealth game
SaintXi
Level 0
***



View Profile WWW
« Reply #37 on: April 01, 2009, 01:21:44 AM »

Cool looking caves, very natural effect.

I have always found procedurals much more fun to make than to play. Players tend to grok the 'ingredients' very quickly then the endless creation spreads the actual creative content thinner and thinner over more area.

The early Elder Scrolls used loads of procedurals for town and battle creation - but the appeal came from the hard work designing the art and enemies. Later games like Morrowind reserve procedurals for the contents of chests - but even then each item is carefully designed first.

I've made entire procedural continents complete with cities and villages - but then had more fun playing tiny hand crafted caves. I guess it comes down to how much content your game has on top of the map designs Smiley
Logged

Tom Sennett
Level 3
***


Indie Game Legend


View Profile WWW
« Reply #38 on: April 01, 2009, 06:37:57 PM »

Great article Chevy.

I hacked together a procedurally generated terrain system for RunMan's Monster Fracas back in the day without really realizing what I was doing. I just wanted to give the game some variety.

For anyone interested in this stuff, definitely give it a shot. It's surprisingly simple if you start basic and work in more and more detail. It's also really rewarding when you can get the computer to design levels for you!
Logged

Epitaph64
Level 1
*



View Profile WWW
« Reply #39 on: May 27, 2009, 01:18:04 AM »

Ah yeah, I also have wrote a VERY simple terrain generator in Java using basic recursion.

Still might get back to fooling around with it one of these days.

Alright I did add a little more to it for fun: http://validopinion.wordpress.com/2009/05/27/terrain-generator-part-2/ :D
« Last Edit: May 27, 2009, 03:37:14 PM by Epitaph64 » Logged

Pages: 1 [2] 3 4 ... 23
Print
Jump to:  

Theme orange-lt created by panic