Share your repls and programming experiences

← Back to all posts
Terrain/Land Generation Algorithms with Map

Hey guys! It's been a long time since I've opened up repl.it and done some coding. (I took a break over the summer, my latest post being HyperTyper) So many new things. Teams, and the discord community has grown so much. @Coder100 got 2K cycles and passed me...

This is a project I started before the summer and have finished today. If you can remember, @DynamicSquid developed a simple terrain generation algorithm. I was inspired by this project, and added a few features.

#1) I created an HTML, CSS, JS repl in order to make it easier to read the map.

#2) After creating a random algorithm and recreating Squid's classic one, I decided it wasn't enough. I went through and added a couple more.

ALGORITHMS:

1 (a_random): Iterates over every tile selecting water or land with a 50/50 chance.

2 (a_classic): Iterates over every tile selecting water or land. Then repeats over the map 4 times, checking if a water tile is surrounded by 4+ land tiles. If True, the water tile becomes a land tile.

3 (a_rivers): Iterates over every tile, with a 1/50 chance of a water tile. Repeats over the map 2 times finding the water tiles. Tries to build a water tile above, to the right, left, or below. (In order of attempts).

4 (a_islands):

OKKKKKKKKKKKK... These are starting to get a little complicated. If you are curious look at the source code in the repl. I'm going to skip these.

If you want to toggle an animation, regenerating a new map every 1 second, click the animate button. Regenerating manually press regenerate. Don't get offended at my stylesheet, that's not the point of the page.

If you create another one, I might add it. Make sure it's in JS and follows the same structure as the other functions.

Thanks, and have fun expirementing!

PYer (3571)

yay

hello

potatojs (816)

wow your now are 10times more than me lol
@Coder100

DJWang (1247)

@Coder100 Congrats on almost 5000 upvotes! You deserve it after countless hours of hard work.

codeitfast (47)

@potatojs LOL. I've got, like, 10 chat numbers, so that is basically saying nothing XD

Leroy01010 (397)

yayayaayayayayaayayayayay

hi @PYer

My fave is a_sideview
also this is awesome

PYer (3571)

Hello, and thank you! @Leroy01010

JosephSanthosh (1189)

WHat in the world is this
?

sojs (258)

It is land generator. Made to generate landscapes, the landscapes that @pyer has done are rivers, random - randomly generating every tile - landscape, Islands and a side view You can use this to create maps in games without a canvas. @JosephSanthosh

JosephSanthosh (1189)

@sojs What? Well it's great to know @PYer is back!

CodeLongAndPros (1535)

Idea:
a_game_of_life:
Starts with all water, places a R-pentomino in center (as land) and iterate for 2000 generations

CodeLongAndPros (1535)

@DynamicSquid Yes, though I might have to hang it up soon, I don't know.

DynamicSquid (4532)

@CodeLongAndPros oh. but how'd you become one in the first place?

CodeLongAndPros (1535)

a decent sense of judgement.

DynamicSquid (4532)

@CodeLongAndPros oh cool! well done. but your parents won't let you?

CodeLongAndPros (1535)

@DynamicSquid They don't want me to see NSFW stuff...

They're on the fence on it.

DynamicSquid (4532)

@CodeLongAndPros wait how does repl.it have nsfw stuff lol. but that really does suck... wish you could stay a mod! all my parents know is that their kid does cool stuff and makes games on the computer. they don't know anything about code lol

CodeLongAndPros (1535)

@DynamicSquid I may stay a mod, I still have an appeal, I can point to the bans list... I still have htop hope. (I can't believe I mistyped that.)

DynamicSquid (4532)

@CodeLongAndPros show your parents how you can reverse the polarity of the neutron flow to correct for the positron leak! and maybe they'll let you be a mod

CodeLongAndPros (1535)

@DynamicSquid If TFTS taught me one thing:
CYB (Cover your back). I can point to the entire ban history.

DynamicSquid (4532)

@CodeLongAndPros ah.. okay lol. so what can you do as a mod? what powers do you have and what can you see?

CodeLongAndPros (1535)

CodeLongAndPros (1535)

@DynamicSquid Yeah.
But the report button is where the reply button was...
(Source: Reported HahaYes, don't worry, I undid it, I think)

CodeLongAndPros (1535)

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.

#2) Think before you type.

#3) With great power comes great responsibility.

DynamicSquid (4532)

@CodeLongAndPros so that's a yes? oh okay. well congrats on mod!

CodeLongAndPros (1535)

@DynamicSquid That's a no, and thanks.
Wait, I can't report myself? That's dumb...

DJWang (1247)

@DynamicSquid @amasad doesn't want to be banned and he won't be cause he the CEO of the whole community

firefish (877)

@CodeLongAndPros `sudo replban amasad`

CodeLongAndPros (1535)

@firefish `moderator user ban --user`

CodeLongAndPros (1535)

@firefish `moderator user ban --user`

CodeLongAndPros (1535)

@firefish `moderator user ban --user`

firefish (877)

@CodeLongAndPros

``````> su -
Are you sure? (y/n) y
Deleting [#################] 100%
firefish (877)

@CodeLongAndPros

``````> su -
Are you sure? (y/n) y
Deleting [#################] 100%
firefish (877)

@CodeLongAndPros I guess that outage hit us hard

firefish (877)

@DynamicSquid Well... er you're lucky... because my parents were the ones that taught me coding lol

DynamicSquid (4532)

@firefish oh lol. I had to learn everything myself

firefish (877)

@DynamicSquid pf... well that's what I did after my Dad taught me python, and I went onto learn Visual Basic (myself), Then got so fed up with the awful syntax and switched to another .NET language: C# (myself).

CodeLongAndPros (1535)

@firefish I did C+ first, for an arduino, then Python, then D.

firefish (877)

C+

actually true story: I used to think there was C, C++, and C+ and C#

CodeLongAndPros (1535)

@firefish Well, Arduino has a weird thing going where `String`, `char[]`, and `char*` are all valid.

firefish (877)

@CodeLongAndPros how about `char**`? I wonder...

firefish (877)

@CodeLongAndPros Just a mess. Consistency down the plughole. (That's C++ in a nutshell)

octopyBot (263)

@PYer @DynamicSquid @Coder100 @dabs364 I feel like we should help coder get higher than enigma! I know I don't like cheats! come one lets do this!

PYer (3571)

hmmm... what about getting me above them both? @octopyBot

DynamicSquid (4532)

DynamicSquid (4532)

@octopyBot lol jk. upvoting someone just for the sake of giving them cycles in unfair and against the rules

octopyBot (263)

@dabs364 no diden't you see dysquids thingy?

octopyBot (263)

@dabs364 no his comment!

dabs364 (277)

huh

dabs364 (277)

@octopyBot whats against the rules eh?

EHEHEH

octopyBot (263)

@dabs364 cycle farming for coder!

BobTheTomatoPie (1581)

this is really cringy to read lmao @octopyBot

aguy11 (127)

Really nice! I liked `a_landscape` the most, it makes it's more detailed and more natural.

PYer (3571)

thanks! I like that one and the side view. @aguy11

PYer (3571)

ThanksQ Which one was your favorite? @ZDev1

PYer (3571)

lol ok @ZDev1 fast response btw

ZDev1 (818)

@PYer lul
but it is cool!

octopyBot (263)

YAS! @PYer is back in black!

dabs364 (277)

@octopyBot lets help @PYer beat @Coder100 like he should!

Coder100 (12439)

uggh what's the big deal with all these cycle races

people just gotta admit I am number 1 @dabs364

dabs364 (277)

@enigma_devIS!!!

Coder100 (12439)

he only has 100 or so cycles @dabs364

dabs364 (277)

@Coder100 it might be a

SHE

Coder100 (12439)

he's a high schooler and he is male living in germany. @dabs364

Coder100 (12439)

on discord he has told us these. @dabs364

PYer (3571)

Wdym? @dabs364 @Coder100 has created much better quality posts.

dabs364 (277)

@PYer o
i thought you wanted to take the lead again...

PYer (3571)

I do, but I just want you guys to know that @Coder100 is a great coder as well. Otherwise he wouldn't be ahead of me. Also, cycles are the main point of repl.it. I mean, sure the convey your popularity, and what the community thinks of your work, but they relate to your projects. Projects/coding are the most important part of repl.it. Thanks for your support though :) @dabs364

octopyBot (263)

NO!

dude he has 7K cycles!
https://repl.it/@enigma_dev

Coder100 (12439)

no, he didn't get 6k legit @octopyBot

Coder100 (12439)

he's an employee at repl.it, they were one day playing around with cycles and one day he got a lot the end @octopyBot

octopyBot (263)

@Coder100 wdym he didn't get 7K legit?

octopyBot (263)

@Coder100 OH nvm then you're on top

PYer (3571)

the cycles were just added to his account without him actually gathering the votes. look at the posts or comments, there's no way he got the votes. @octopyBot

octopyBot (263)

@PYer true, I've never seen him on any post!

octopyBot (263)

@PYer also 7K is almost unreal

PYer (3571)

exactly. he used to be a member of the repl.it team and so added a bunch of cycles to his profile. it didn't show up on the leaderboard, since the repl.it team has an unfair advantage over normal users. But now that enigma left, he's top. @octopyBot

octopyBot (263)

@PYer ohhhhhh darn. I hate cheats! albeit, the last repl he made was like 9 months ago!

firefish (877)

@PYer I wouldn't agree with you, you make better things than the grilled cookie ever could

octopyBot (263)

@firefish grilled cookie is coder? oh right, his pfp looks like a burnt cookie

firefish (877)

@octopyBot Yes. He's grilled because we (me and @HahaYes) THOUGHT he destroyed our code, but he didn't, but he's had that name ever since.

firefish (877)

octopyBot (263)

@firefish haha looking forward to it!!

octopyBot (263)

@firefish lol u already leaked it right?

octopyBot (263)

@firefish wow this actually really rad

firefish (877)

@octopyBot there's no game there yet, just some useless text

octopyBot (263)

@firefish lol well the sign-in is awesome

firefish (877)

@octopybot read the footer, it says it been stolen quite clearly

DynamicSquid (4532)

hi

PYer (3571)

THANKS

hello as well

DynamicSquid (4532)

@PYer what'd you do over the summer?

PYer (3571)

I took a road trip, visited a ranch, and went on a backpacking trip. I also had a trip to hawaii and one to florida canceled because of the coronavirus. I haven't coded over the summer the past 3 years I've used repl.it. I also didn't have a lot of internet connection and access to technology. @DynamicSquid

DynamicSquid (4532)

@PYer oh wow cool! sucks that your trip to florida and hawaii were canceled

PYer (3571)

Yeah, but I still had a lot of fun. Did you do anything interesting? @DynamicSquid

DynamicSquid (4532)

@PYer nope lol. just coding a lot

PYer (3571)

Nice. You've made a lot of cycles. @DynamicSquid

DynamicSquid (4532)

@PYer oh yea thx. i released a few good projects

PyCoder01 (79)

@PYer I want to change the discord bot's avatar (Py_Assist)

PyCoder01 (79)

@PYer I need you to debug Py_Assist there is a problem I debugged it

RobertFurr (64)

i was trying to work on something like this a while back with python and it looks like you beat me to it

clawstrike (22)

Dude, if it wasn't amazing, would upvote and comment @PYer? This was sick! I don't even think I could match to that👍👍👍😐😐😮😮😮

PYer (3571)

haha. i'm sure you could if you tried... @clawstrike

BobTheTomatoPie (1581)

this is awesome dude! I have an idea that could be cool, if you don't like it that's fine, but hear me out. There is a button that will pick from a random algorithm each time, so maybe one time it will be a river, and the next a set of islands

PYer (3571)

oooooooohhhh that's actually a good idea! @BobTheTomatoPie

SidS (0)

landscape animation was my favorite

AJDevelopment (119)

just wait until someone implements this in minecraft

firefish (877)

I made one called a.oceanic, I'll invite you now... (it's a 3/10 chance of land basically)

PYer (3571)

ill take a look at it! @firefish

firefish (877)

@PYer I'm adding something to it rn btw

python88 (282)

how many upvotes this has is how many people do this game 24/7

mkhoi (309)

Idea:
Maybe you can recreate my generation algorithm, here is it (also i don't know what to name it):
https://repl.it/@mkhoi/mountainous-terrain-on-space-rocks#main.py

sojs (258)

my fav is landscape, or side view

[deleted]

yay

PYer (3571)

hi @RohilPatel. have you checked out the project?

PYer (3571)

cool what was your favorite algorithm? @RohilPatel

sojs (258)

Very Nice. Clean look too.

PYer (3571)

Why thank you! @sojs It was more of a focus on the algorithms than the styling.