Better Random Terrain via Midpoint Displacement

Show us your completed creations made in Construct 2

Post » Tue Sep 04, 2012 2:13 am

Holy crap ! I love your map generations. Unfortunately, I keep looking at the code and command, and I feel I don't know array enough to understand the process.

All the loops and the array.... anywhere to point me to, to understand it properly ?

Thanks guys
B
12
S
1
Posts: 22
Reputation: 1,109

Post » Tue Sep 04, 2012 9:27 am

I really like it ^^
Ever played King Arthur's Gold? -->http://kag2d.com/en/

Would be cool to re-create it with something like this.. I didn't know my browser could handle 5000 objects^^
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sat Dec 29, 2012 5:31 am

This is so cool, though I look at the events and try to find out what's happening, and I don't really understand what's going on. So, um what's going on? I'm trying to make a random cave generator.
B
29
S
7
G
3
Posts: 361
Reputation: 6,187

Post » Sun Jan 27, 2013 1:53 pm

Combining this with the level editor in the FAQs would make this game perfect :*
B
11
S
2
G
4
Posts: 78
Reputation: 3,292

Post » Tue Mar 26, 2013 3:45 am


Thanks very much for this. I used it to learn how to use arrays in Construct2 (they made my head hurt initially), and i've now turned it into a decent terraria lite demo.

I've got multiple block types (gold etc), placeable ladders, placeable blocks, grass that regrows over time based on certain rules, realtime lighting, etc. I got very inspired lol. Learned so much from your code. Wasn't aware of the bit technique for tile selection, thanks again. :)
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Tue Mar 26, 2013 9:17 pm

[QUOTE=Venivididormi]
Thanks very much for this. I used it to learn how to use arrays in Construct2 (they made my head hurt initially), and i've now turned it into a decent terraria lite demo.

I've got multiple block types (gold etc), placeable ladders, placeable blocks, grass that regrows over time based on certain rules, realtime lighting, etc. I got very inspired lol. Learned so much from your code. Wasn't aware of the bit technique for tile selection, thanks again. :)[/QUOTE]

That's awesome! I"m glad you and everyone else find this helpful.
I hope you show us your project soon!
B
12
S
2
G
4
Posts: 44
Reputation: 2,389

Post » Fri Apr 05, 2013 2:03 am


Just posted in another thread regarding ladder usage in my game. Has a screenshot. Doesn't show too much though, just the ladder stuff.    

I'll post more in this thread later as my project continues.

Ladder FAQ Thread Link :
http://www.scirra.com/forum/topic45310_post404704.htmlVenivididormi2013-04-05 02:24:18
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Fri Apr 05, 2013 7:02 am

One other thing, I found a very simple method for making tunnels and/or resource spawns during world generation. Instead of using complex math, I just made a few sprites in the shape of clumps of minerals, and a few more in the shape of tunnels (you can make a few variations and/or use rotation or scaling to make it more randomized). Then:

1) Generate world as usual using method in this thread
2) Place X number of each mineral/tunnel sprites in randomized positions in the world
3) Do a hit check against all of the already spawned ground blocks
4) Any ground blocks overlapping mineral sprites get converted to mineral blocks of appropriate type, then update block arrays accordingly
5) Any ground blocks overlapping tunnel sprites get deleted, update array
6) Delete all mineral and tunnel sprites
7) Explore your world full of gold and silver deposits, and caves

I also plan to use this method for creating pre-fab rooms and caves with spawned objects/props inside. Since you can add multiple registration points to sprites, you can use them to specify the spawn points for props before deleting the world creation sprites.Venivididormi2013-04-05 18:48:52
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Fri Apr 26, 2013 4:48 am

[QUOTE=Wicstar]All the loops and the array.... anywhere to point me to, to understand it properly ?[/QUOTE]

If you're still interested I can try to explain it.

If you specifically want to understand the bitwise tile selection method, this does a really good job of explaining it.

http://www.saltgames.com/2010/a-bitwise-method-for-applying-tilemaps/
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Fri Apr 26, 2013 11:47 pm

Lol I was writing a post explaining it, then realized the original capx had been updated since I grabbed it last. Complete rewrite, now i'm confused.    

In particular the bitsolver used when destroying blocks after generation has changed a fair bit. The "repeat 4 times" X+cos(a)*16, Y+cos(a)*16 method has been replaced with a bunch of if/then loops.

Can you explain the main changes in the project and reasons for them?

In particular, can you explain this comment "You WILL have to change how it create tiles, as right now it will create every tile stored in the array to your specified X point."
Venivididormi2013-04-26 23:52:29
B
8
S
2
Posts: 63
Reputation: 1,223

PreviousNext

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 0 guests