/beanstalk

Minetest mod beanstalk

Primary LanguageLuaOtherNOASSERTION

beanstalk

version 0.2

This mod creates giant beanstalks stretching up into the sky for thousands of nodes.

Beanstalk 01

License

This code uses The MIT License, please see license.txt for details.


Story

---Click here to collapse the story of "Illinois Smith and the Giant Beanstalk"---

Early on Illinois Smith had felt restricted by the tamed lands of the east. He had staked out a small territory of his own, mined useful minerals, built nice equipment, and even constructed a beautiful palace for himself. But, after a while, it got boring. There were no new challenges. And everything just seemed to... safe. And so, he had packed up all his most useful stuff, and crossed the gulf of the world fracture to venture into the dangerous wilds of the west.

There he fought terrible monsters, even confronting a black dragon in it's hidden mountain lair. And, perhaps most dangerous of all, struggled against other adventurers who coveted his equipment and wealth. BUT, he also found incredible things. Treasure, items of immense power, and tidbits of useful knowledge. This fulfilled his need for excitement for a long time. But then, once again, the old feeling of ennui began to set in again. He began to feel that he had achieved most of what this world had to offer him. Even in the wild west, he had met it's challenges, and conquered them.

Well, most of them anyway. There was one challenge in particular that still eluded Illinois' grasp. He wanted to build a shield belt that would protect him from heat so that he could go exploring in the great lava lakes underground. But one of the key ingredients required was the living ruby gemstone heart from a red dragon. And despite much searching, Smith still had yet to find a single red dragon, even in the absolute furthest west wildlands he had gone to. He had begun to believe that they did not actually exist.

Then one day he heard a rumor that there was a wise sage who lived at the very top of a distant mountain who would answer the questions of anyone who could overcome all of the obstacles that barred the way and find his hidden hideaway. And so, Illinois Smith set off on a new quest. It took him a long time to find the right mountain. And then he had to battle the Abominable Snow Men who guarded the mountains roots, and the Ice Lizards that haunted it's high cliffs. He had to explore a dangerous dungeon to find a key, and build a bridge across a vast chasm. But, finally, after many close battles, and risky climbs up sheer cliffs, he reached the top of the mountain, and found the monk in his hidden temple.

"I need to find a red dragon!" Illinois asked.

"Well my child," the old man responded. "You cannot find one in this world." Illinois sighed in frustration, but the old man held up his hand in a calming gesture and said, "Patience my child, patience! You cannot find one in this world, but there are more worlds than your simple mind is aware of. The universe is built in layers, and there are," here he pointed upwards, "more worlds, worlds wonderful, and dangerous, beyond your imagining, hidden above the sky."

Beanstalk 02

Illinois rubbed his chin thoughtfully and said, "I have heard rumors, but they all come to nothing. I built a jet pack, but it only makes short hops, and will not take me above the sky. Also, I have friends in the land of Babylon who pursued this rumor. With a great expenditure of time and materials, they built a tower to the sky. They built it high, MUCH higher than my jet pack can fly. But eventually they ran into an invisible and impenetrable barrier. Even the most powerful explosive hammer could not make so much as a crack in that barrier. If there are further worlds above us, they are impossible to reach."

"Impossible?" the old man said with a laugh. "Impossible is a state of mind young man. Many say it is impossible to reach my hidden sanctuary, and yet, here you are. The pathway to the sky is not impossible, but it is difficult." Then the old monk closed his eyes and began chanting in a sing song voice:

"Explore the waste where the eagle cries Til a shadow ascends before your eyes Approach and see the green path rise A living stairway to the skies"

Then the old man spoke normally again. "Difficult, oh yes. Very difficult. Are you up to the challenge?"

Illinois Smith scratched his head and said, "The waste, a shadow, living stairway? It doesn't make any sense. I need more information wise one."

The monk made a disgusted face and a dismissing gesture with his hand. "Nothing worth having is easy," the old man said. "You have your clue youngling. If you are worthy, go! Go and discover the whole new world that awaits you. Go pursue the clue, and find new opportunities, and correspondingly greater challenges. OR, go home. Go to the east and retire in comfort. Go to BOREDOM. Either way, it is time for you to go. The choice of where, is yours"

Illinois took a deep breath, and then he set his hat more firmly upon his head and, with a curt nod, said "Thank you." and turned and left. Beanstalk 03

It took some time to resupply. He took little food, for that he could gather along the way. But he needed fuel for his jet pack, lots of it. He had to find a good storm and collect lightning for the electric sword he had built. And he made certain his Dwarven Steel magic armor was in perfect repair. He usually preferred technology over magic. But there was simply no denying that, while it had certainly been insufficient to save the wizard who wore it when foolishly attacking Illinois, the magic armor was the best Illinois had. Once Illinois Smith felt that he had prepared as much as he could, he headed into the wild wastes of west to search for... he really wasn't certain what. What WAS he looking for? A shadow? A mystery? He decided to just call it "Adventure" and to forge forward.

The west was still a wild and dangerous land. Despite his skills and good equipment, Illinois Smith had to stay observant and sharp. There were giant spiders, mobs of goblins, and once he used his jet pack to escape from a gang of hostile fellow adventurers, only to land right smack dab in the middle of a ruined city full of zombies. He had to find a new storm and recharge his electric sword after that.

Illinois survived those, and many other encounters, and continued trudging forward for so long that he had almost forgotten what he was out here for. And then, one day, he saw it.

He had been wandering through the untracked wilderness. Breaking ground in an area that showed no signs that any other adventurer had ever been this way, when he looked up and saw "The Shadow". He didn't know what else to call it. There, in the ever present fog, it loomed. He tried to convince himself that it was just a distant mountain. But no mountain had ever stretched so thin, or stood so tall.

Tall? It seemed such an inadequate word. The shadow wasn't tall, it was towering, soaring, it was... Illinois couldn't find words to describe this shadow any better than he could find the top of it. There didn't seem to BE a top. It went up forever. He realized his heart was racing and his blood was pounding in his ears. This was it! The shadow that ascends before your eyes!

What was next in the old man's poem? "Approach!" And so Illinois Smith did. With almost as much reverence as caution. And gradually, the dark blacks and greys of the shadow merged into a mottled green. Illinois felt himself trembling, but he kept moving forward, until huge twisted and tangled towers of green emerged from the fog.

Beanstalk 04

It.. It was a beanstalk.

Not a large beanstalk that reached as tall as a man's head. Not a huge beanstalk that reached as tall as a house. Not even a Giant beanstalk that reached as tall as a castle wall. No, this was an ENORMOUS, GARGANTUAN beanstalk that reached up into the sky forever. Illinois had seen houses that had a smaller footprint than this beanstalk. Much smaller. There were few trees in the world that had trunks as broad as a single stalk of this beanstalk. And NONE that reached up into the heavens like this. And the beanstalk had three, yes THREE of these enormous stems twisting and twining around each other as it climbed into the clouds. "A living stairway to the skies"

Illinois just stood a the base of the plant for a long time, soaking in the awe and wonder that were sweeping over him. Then he actually fell backwards onto the ground and spent some more time just lying there, gazing up along the beanstalk to infinity. The thrill that was coursing through all of his veins right now had been there the first time he crossed over the fracture. And it had been there the first time he confronted a black dragon in it's mountain lair. But, it had been present only in diminishing quantities since then. Once you had mined the rarest minerals, built the best equipment, and defeated the most dangerous monsters, what was left to make that chilling tingle of co-mingled fear and joy run up your spine? What challenge was big enough to set your adrenaline flooding until your own heartbeat pounded in your ears? Well, THIS was! This magnificent monstrosity was a challenge beyond even his wildest dreams. He stood again and gazed up the beanstalk and knew that he might die trying to climb it. But even if he did, this was a death he would have chosen. To not attempt it was unthinkable. To try and die almost as glorious as trying and succeeding.

Illinois Smith checked his jetpack, it was only about half fueled, his electric sword was down to about two thirds charge, and his rations were getting thin. But it would have to do. He knew in his mind that he ought to take time to properly resupply and attack this path at peak performance. But his heart would not stand for the delay. He grabbed on to one of the enormous stalks and lifted his feet off of the ground for what he knew might be the very last time, and began climbing into the sky.

Beanstalk 05

Climbing the beanstalk was not a simple task. There were places where the stalk made a gentle slope that he could actually walk along like he was walking up a hill. But then it would suddenly go straight up into a sheer vertical green cliff and he would have to climb up like an ant. And every so often, the stem would actually twist backwards on itself into an absolutely unclimbable negative slope. Then he either had to climb around the side (risky), or find a way to jump to another stalk and proceed from there (also risky). Luckily, there were plenty of spots where he could actually sit and rest. At first he had been somewhat frightened of looking over the edge and seeing how far away the ground was. But eventually the ground was so distant that it was just a blurry picture of green and brown splotches. Illinois began to think that he about had the beanstalk figured out, when he saw something unusual.

A little way ahead of him was a place where the beanstalk was a lot thicker than normal. He thought at first that it might just be a place that two stalks were close together, but then he decided it looked more like a strange growth. And then it raised up it's head and looked at him. It was a giant horn worm. Easily as big as the black dragon he had previously battled. Illinois' first instinct was to take a few steps back and find a good defensive position, but his heel found nothing behind him and he would have tripped and fallen if he hadn't caught some of the beanstalk's trailers with his left hand and steadied himself. He glanced over the precipice he had almost plunged over and realized that he couldn't see any ground below, only clouds. And ahead, his view was filled with the giant, hissing, horn worm. Illinois pulled out his electric sword and planted his feet as firmly as he could. There would be no dodging this attack. So he met it head on.

The monster came at him with it's head raised high like a cobra's attack. A cobra that was over 30 foot long and 8 foot around. As it struck down at him, Illinois rushed forward inside the attack and plunged his electric sword into the worm's chest. He felt the worm's teeth clenching on the back of his dwarven steel armor, but the monster released it's grip and jerked back when the crackle of the sword releasing lightning hit it. The worm whipped it's head around in pain, and, in it's throws, knocked Illinois completely off the beanstalk.

Beanstalk 06

Illinois didn't waste time worrying about how far away the ground was. Instead, he slapped the control on his jetpack, wasting his precious fuel, but pushing himself up and back to the beanstalk. He managed to land a little way above the still writhing monster. But any thought of out climbing the beast died when he saw the bleeding, but obviously still healthy creature begin climbing up towards him. There was no question it was climbing faster than Illinois ever could. So instead of going up, he waited until the positioning was just right, and jumped down, landing in the middle of the giant horn worms back. He plunged his sword into the monster's back repeatedly as he held on for dear life. The worm twisted and writhed, trying to bend back far enough that it could bite him. But eventually the creatures motions slowed down to just spasms. And then it started slipping. With a sense of absolute horror, Illinois realized that it was losing it's grip on the beanstalk. He yanked his sword out of the worm's flesh and ran along the rapidly sliding back. He leapt off and caught desperately onto the beanstalk just as the worm went plunging downward. It's body disappeared into the clouds. He never heard it hit bottom. Exhausted, he found a quiet and fairly flat twist in the beanstalk and curled up for some much needed sleep.

It turned out, the horn worm had NOT been alone. There were more of the creatures scattered up the beanstalk. Illinois developed the strategy of using a short burst on his jetpack to take him above the worms so that he could drop down onto their backs. It worked, but every battle was still a close call, and his jetpack was running dangerously low on fuel.

That was when the pterodactyls showed up. They weren't anywhere near as tough as the giant horn worms, but they tended to work in groups of two or three, and they had a nasty habit of making diving flights at their victims intended to knock them off of the beanstalk. He ended up being more afraid of the pterodactyls than the giant horn worms, but he was also grateful, because pterodactyl omelets were an increasingly important addition to his diminishing rations.

Beanstalk 07

Illinois had lost track of how many days he had been climbing the beanstalk, when he came to the castle that appeared to be made out of solid cloud. At first he thought it was a long way away, but once he approached it, he realized he had greatly misunderstood it's scale. It was a giant's castle. He didn't try to break in the front door or climb over the wall, he just peaked in through one window and inside he saw a boot. The boot alone was as tall as Illinois. The Giant was still wearing it. Illinois Smith, killer of the black dragon, victor of the battle of blood castle, the terror of the west..., dropped from the window in terror and hid. There was no question the giant was hostile, the oven full of human bones made that clear. But, Illinois' jetpack was almost empty. His electric sword had run out of charge a long time ago. His armor was still in good shape, thank goodness for those Dwarves and their magic! But Illinois knew that the armor wouldn't stand up to even one blow from the tree sized club that giant carried. One stomp from those giant spiked boots, and Illinois Smith AND his fancy magic armor would be a pancake. He was completely out classed. He could not take on this battle. Yet.

As Illinois crept quietly along the solid cloud, sneaking back to the beanstalk, he realized that terror was not the only thing he felt. His heart was pounding in fear, but also... something else. He explored the feeling inside him, and finally realized it was the same feeling he had when he had first learned there was a black dragon living in Mount Neverest. It was the same feeling he had when the lava men took over his mine and chased him away. It was the feeling that there was something too big for him to handle, YET. But the pure and thrilling knowledge, that he was going to get stronger, and he was going to come back and WHIP that problem in the future! It was the wonderful feeling of realizing you are small. And yes, that could be a fantastic feeling, because it meant there were BIG challenges ahead. Challenges that would take all of his strength, and all of his effort, just to grow big enough to face them. Right now, he couldn't handle that giant. And that was GOOD. Because now he had a goal. He WOULD be back.

The beanstalk kept going up, and so did Illinois Smith. But he was tired. His rations had run out, he was actively looking for pterodactyl nests now, just out of hunger, but he had seen none since he passed the giants castle. But he would not turn back, he just kept climbing. Until he slipped. He wasn't knocked off the beanstalk by the death throws of a giant horn worm, or by a dive bombing pterodactyl, or even a club wielding giant. Nope, the great Illinois Smith just took a bad step and fell off. He hit his jetpack controls, and it gave one sad cough and sputtered out. No fuel. This was going to be a humiliating death. Illinois just barely had enough time to wonder how long it would take him to hit the ground, when his back bumped into something. He kicked against it and knocked himself back into the beanstalk. He took some damage, but he was alive, that was the important thing.

Beanstalk 08

But, what had he hit? Some new deadly monster? Illinois looked, but there was nothing there, just empty sky. He held on to the very edge of the beanstalk and reached out as far as he could and... touched a solid, but invisible wall. The whole beanstalk was boring through an invisible barrier. It was, it HAD to be, the same barrier that his friends on the Babylon project had hit when they built their tower. Impenetrable by any weapons or tools known. BUT, the beanstalk passed right through it.

Illinois heart pounded, he had to be near the top. He kept climbing, and soon, the sky went dark. It wasn't gradually, like night falling or storm clouds building over head, but all at once. One moment there was blue sky above him, he climbed one step higher, and the sky became stone. He kept climbing, and soon he could touch it. Stone, in the sky. Not a little bit of stone, but all stone, the whole sky, stone in every direction as far as he could see. And still the beanstalk drilled through it. Leaving an empty gap all around it so that there was plenty of room for him to climb.

It almost immediately became pitch black dark. Illinois had to turn on his crystal powered head lamp to see. He ascended through layers of different kinds of stone, rare and completely new minerals. Within minutes he forgot he was in the "sky". It looked, and felt, like he was deep underground. He climbed past caves, and even dungeons, with glowing eyes and movement inside. But he did not stop to explore. There would be plenty of time for that later. His goal now was above him. He kept climbing through the darkness until the stone became dirt. And then, he saw the first beam of sunlight coming down from above. With a shout, he climbed even faster, and in just a few minutes, emerged onto the surface. The surface of a whole new world hidden in the sky of his old one.

The beanstalk emerged in an area of rolling hills covered with a dark green grass. In the distance, he could make out mountains through the fog. Nearby there were trees, but of a kind he had never seen before. The beanstalk itself, finally petered out here. The huge individual stalks dwindling down to nothing only a few feet above the surface.

But here was a whole new world to explore. New plants and environments, and, he was absolutely certain, new hostile monsters to defend against and defeat. Illinois' soul THRILLED at the challenges, and possibilities, ahead of him. It would take him a very, VERY, long time to conquer this new world. And he was quite certain that if and when he did, when the challenges here grew tame, when this new world finally, at long last, seemed to have gotten too easy and boring, he would go hunting again for yet ANOTHER beanstalk, one that would take him? Who knew where?, except that there would be more and yet MORE challenges ahead. And THAT made Illinois Smith a VERY happy adventurer!

Beanstalk 09

THE END


About Beanstalk

Ok, sorry about that silliness. But it seemed like a good way to introduce my vison for Beanstalks.

Beanstalks were designed for my too long abandoned minetest game Fractured My original vision for that game involved a world built in multiple layers, with the means of access between the layers being rare giant beanstalks that stretched up thousands of nodes in the sky and actually pierced through to the next layer of the world.

Of course, your first and most obvious question is, how much of the world described in this beanstalk story actually exists? Uhm, sorry, almost none. No mobs, no giant cloud castles. BUT, we do have beanstalks! My son and I have spent a lot of time on the beanstalks, and I think they are looking really great!

Beanstalk 10

Beanstalks were designed with Fractured in mind, but they could work just fine in any world. They are very customizable, and even if your world isn't based on a layered design, you could still use beanstalks and just have one layer of them that reaches all the way to the top of the minetest cube.

Depending on how you set up the beanstalk_values.conf file, there are literally billions of possible beanstalks.

The beanstalk_values.conf file looks like this:

beanstalk_level=1
count      =16
bot        =-10
height     =6070
snode      =beanstalk:beanstalk1
vnode      =beanstalk:vine1
stemtot    =5|3
           =3|2;5
           =1|1;8
stemradius =75|2;6
           =20|3;9
           =05|4;10
rot1radius =3|5;8
           =1|3;10
enforce_min_rot1rad=Y   --Y means rot1rad minimum will be stemradius+1
rot1dir    =1|1
           =1|-1
rot1yper360=3|rot1circumf;80        --you can use variables in these values  
           =1|rot1circumf;100     
rot1crazy  =1|0
           =1|3;8              --very small values for crazy are hard to detect, so I use a minimum of 3
rot2radius =3|3;rot1radius+5   --yes you can use rot1radius as a value here
           =1|0;16
rot2dir    =1|rot1dir       
           =1|rot1dir*-1
rot2yper360=3|rot2circumf;100  
           =1|rot2circumf;500 
rot2crazy  =1|0
           =1|5;17        

beanstalk_level=2
count      =16
bot        =5990
height     =5070
snode      =beanstalk:beanstalk2
vnode      =beanstalk:vine2
--if you dont specify stemtot, stemradius, etc, it will use the same values as for the previous beanstalk level

beanstalk_level=3
count      =16
bot        =10990
height     =5070
snode      =beanstalk:beanstalk3
vnode      =beanstalk:vine3

Now, I realize this looks very confusing at first, but its not as bad as you think. Lets take one entry out and examine it:

stemtot=5|3
       =3|2;5
       =1|1;8

stemtot is the name of the variable, this one controls how many stems (vines) a beanstalk might have. There are three entries for stemtot. The number BEFORE the vertical bar (pipe) is the chance. This is not necessarily a percentage, its just a number. In this example we have 3 lines with chances of 5, 3, and 1. The program will roll a random number between 1 and 9 (5+3+1=9), and if it comes up between 1 and 5, stemtot will be 3 and the beanstalk will have 3 stems. BUT, if the random number is between 6 and 8, the value then is "2;5" this means roll a number between 2 and 5. So the beanstalk will have anywhere between 2 and 5 stems. And if the random number rolled was 9, then the value is "1;8" and that means roll a number between 1 and 8. So overall, the vast majority of beanstalks will have 3 stems. A few will have 2,4, or 5. And very rarely some beanstalks will have 1,6,7 or 8.

There are more details in how to setup the beanstalk_values.conf file in the file itself.

There are a LOT of variables that go into making up a beanstalk, This graphic is an attempt to explain how the different variables control the shape of the beanstalk:

Beanstalk Variables

beanstalk_values.conf sets up how many beanstalks there are on each level, what altitude the beanstalks for that level start at, how high they go, and what the possible range of values for beanstalks are on that level. The beanstalks locations and actual values will all be determined when the world is first created and written to the world folder as beanstalks. This file can be edited after world generation if you wanted to move the beanstalks around or change their values. (this would NOT, of course, affect any already generated chunks)

With the values currently in the example beanstalk_values.conf file, there are many, MANY possible beanstalk configurations. You can expect every beanstalk in your world to look a bit, or a LOT different from every other beanstalk.

The way I have it currently set up, there will be 16 beanstalks randomly distributed in level 1, 2, and 3 (y=0, y=6000, and y=11000). They will be evenly (but randomly) distributed in a 4x4 grid. This means there is one (and only one) beanstalk in a map area 16,000 nodes on a side. Finding a beanstalk will be difficult, and a very important event.

There are two chat commands added that make exploring beanstalks easier:

To see the randomly rolled beanstalks locations/values you can use the chat command /list_beanstalks

To be teleported to a beanstalk, you can use the chat command /go_beanstalk #,# where #,# = Level, beanstalk number (so /go_beanstalk 1,1 will teleport you to level 1, beanstalk 1) Be aware that currently go_beanstalk does NOT search for actual surface, it just makes a guess and plunks you down. I need to fix that.

We will need to restrict both of those commands later, of course.

If you want to explore what the beanstalks look like right now, I recommend you install Fractured And start up a fractured game. (If you specify a seed, that will enable you to recreate the same same world with exactly the same beanstalks whenever you want, which can be very handy for testing) then: /grant singleplayer all /list_beanstalks and then /go_beanstalk lv,b to whichever beanstalk looked interesting on the list.

I welcome help with this project. I do NOT know what I'm doing, and advice and help will be greatly appreciated.

STILL TO DO:

  • beanstalks uses luautils.string_math which I have ATTEMPTED to sandbox. No idea if I did it correctly and not getting any help on this topic in the minetest forums.
  • at one point I tried to add giant, walkable leaves to the beanstalks. (my poor graphics are still in textures) this did NOT look good, but I haven't given up on the idea totally.
  • beanstalk specific mobs are needed, horned worms, pterodactyls, cloud castles and cloud giants.
  • beanstalks are, well, a bit slow to generate. Since they are rare, this isn't a HUGE problem, but any advice/help on speeding them up would be greatly appreciated.

Beanstalk 11