Tags

, , , ,

I think python camp ended up being pretty educational, even if we didn’t meet all of our goals. The curses version of Leo’s MineCraft-In-Python (aka. PythonCraft) actually ended up pretty well, and we did some actual pretty interesting algorithm coding, and even a little computational complexity. Unfortunately, we wasted pretty much a whole day trying to translate the game into pygame, which would have provided way better graphics. But that ended up being beyond Leo’s capabilities, and although I could have done it for him, that would have defeated the purpose, so we just fell back to the curses version.

Previous version (Alpha 1.3) had the basic world and player, and some pretty good terrain generation, and at some point we added survival mode as well. 1.4 introduced water and npcs (mobs, in Minecraft parlance). Each of these actually involved interesting new algorithm design. In the case of water, the blocks had to “flow”, so that would fill space “gravitationally”. How to do this is actually non-trivial, but after lots of experimenting we more-or-less got it to work. Here’s an image of how water ends up  sort of filling a valley. The waters are = signs, and the player is the *. All the water blocks in the valley were originally dropped in the same column, but moved to fill the valley. Notice that there’s room for improvement in the algorithm as it made a sort of pyramid:

Screen Shot 2019-08-16 at 2.06.18 PM

Mobs were also very interesting. Leo invented a nice mob placement algorithm so that the would end up mostly in caves (although sometimes on the surface as well), and then we did a nice mob movement algorithm that would make them move toward the player. Of course, there were failures along the way to this as well. Some shots of the results of various “approximations” (aka. major bugs! :-):

 

But the thing did work out in the end (here the player is being chased through the air by 2 zombies and a creeper — yeah, they can fly … minor bug!):

Screen Shot 2019-08-18 at 3.56.22 PM

As before, all the code is in the github repo.