6 ms·
Pycraft: Minecraft engine in Python
- asimuvPR 11y agoI've always wanted to have an MC clone in Python with GUI event hooks to run scripts. Like pull a lever and an email is sent sort of thing. Will this fork allow for something like that? I'm not against adding it myself if allowed, btw.
- 746F7475 11y agoIsn't this already possible with normal Minecraft? I mean obviously you have to write your mod with Java, but still.
- asimuvPR 11y agoYes, you are correct. But normal MC is not open source. :)
- ekianjo 11y agoEven though Notch was supposed to make it open source at some point. Another broken promise.
- nness 11y agoThat point was when Minecraft was worthless. It's currently somewhere around the $2.5b mark in value. But that's just splitting hairs, it won't likely ever be open-sourced after MS acquired it. That said, they also promised a modding API too...
- VikingCoder 11y agoI dunno... Microsoft has been open sourcing some pretty awesome stuff lately.
- deleted 11y ago[deleted]
- LukeB_UK 11y agoWhat he actually said was "Once sales start dying and a minimum time has passed, I will release the game source code as some kind of open source." [0]. Sales haven't died down and he doesn't own it anymore anyway. [0] http://web.archive.org/web/20100301103851/http://www.minecraft.net/about.jsp http://web.archive.org/web/20100301103851/http://www.minecra...
- Chris2048 11y agoSeems like selling it is the broken promise. If sales die down, and a minimum time passes, he still can't OS it because he sold it. Still, as long as the idea's out there... I heard the codebase isn't actually that great...
- shmageggy 11y agoIt's build on top of pyglet which is built around event-based programming, so it's already got the ability to do low-level callbacks from key/mouse events built in [1]. GUI widgets are a separate matter though and would probably require a separate library to do OpenGL GUI elements on top of this. [1] https://pyglet.readthedocs.org/en/pyglet-1.2-maintenance/programming_guide/mouse.html https://pyglet.readthedocs.org/en/pyglet-1.2-maintenance/pro...
- asimuvPR 11y agoReading the docs, thanks!
- idle_zealot 11y agoCouldn't something like that be done in Minetest?
- voltagex_ 11y agoYou could always give me a hand to get https://github.com/voltagex/minecraft-rebridge https://github.com/voltagex/minecraft-rebridge up and running again, and then use HTTP from Python to talk to Minecraft-proper ;)
- asimuvPR 11y agoSeems interesting! Would this run on a raspberry pi? I'd love to email to see if we can collaborate in some way. My address is in my profile. :)
- NoWhiteHorse 11y agoThere is also ScriptCraft - https://github.com/walterhiggins/ScriptCraft https://github.com/walterhiggins/ScriptCraft Here you can hook JavaScript code into Minecraft events.
- traverseda 11y agoIt will not. We're still very early, and definitely not feature complete with minecraft. We're still working on some very fundamental things. Do do that, you first have to write code for pulling levers, which will first require some digging around with how pycraft handles textures to make it more generic. Check back in a few months.
- asimuvPR 11y agoI will definitely do so! Thank you. :) By the way, accepting contributors? Maybe I can help out in some way...
- traverseda 11y agoWe are very much accepting contributions.
- thomaskcr 11y agoI've been teaching a class (http://apprenticeworks.us http://apprenticeworks.us) based on the same original repo it seems like you found. I made a lot of the same changes as you as well. I ended up abstracting a lot of the "optimization" type code (the sectors for example) and changed the way the state of the player is kept to support multiple players in the future. Not sure if you'd be interested, but I have some content I'd be happy to add for background type information (i.e. degrees of freedom, calculating movement, frames of reference, etc). Might make a good starting point for contributors but not sure if that's the direction you see your documentation taking.
- danso 11y agoIt's not my project but in sure the repo maintainers would be interested!
- traverseda 11y agoJust found this on hackernews now. Pull requests are very welcome. I don't personally have a lot of time to actually code stuff, as I'm busy with contracts, but if you post on our irc someone might be interested in digging into your code base and pulling out the useful bits.
- levemi 11y agoI like that it uses shaders and modern OpenGL and not fixed functions. It looks like very good clean OpenGL!
- Negative1 11y agoI cringe when I see code like this: if len(vals) in range(1, 5): It seems like a harmless enough thing to do but that code is effectively creating a new array with values [1, 2, 3, 4, 5] and testing if the result of len() is in that array by iterating over it. This check is happening multiple times for each draw call every frame. Sadly I see this kind of stuff in Python all the time and it just adds weight to the argument that Python is not a performant language. 1 <= len(vals) <= 5 would have been more pythonic and certainly more efficient (and obvious) but I have to wonder if under the hood it's just doing the same inefficient operation.
- simonw 11y agoWhy do you suspect 1 <= len(vals) <= 5 would do something inefficient under the hood? You can actually get a very good idea for what Python is doing under the hood using the dis module: dis.dis(lambda: 1 <= len(vals) <= 5) 1 0 LOAD_CONST 1 (1) 3 LOAD_GLOBAL 0 (len) 6 LOAD_GLOBAL 1 (vals) 9 CALL_FUNCTION 1 12 DUP_TOP 13 ROT_THREE 14 COMPARE_OP 1 (<=) 17 JUMP_IF_FALSE_OR_POP 27 20 LOAD_CONST 2 (5) 23 COMPARE_OP 1 (<=) 26 RETURN_VALUE >> 27 ROT_TWO 28 POP_TOP 29 RETURN_VALUE Compare to: dis.dis(lambda: len(vals) in range(1, 5)) 1 0 LOAD_GLOBAL 0 (len) 3 LOAD_GLOBAL 1 (vals) 6 CALL_FUNCTION 1 9 LOAD_GLOBAL 2 (range) 12 LOAD_CONST 1 (1) 15 LOAD_CONST 2 (5) 18 CALL_FUNCTION 2 21 COMPARE_OP 6 (in) 24 RETURN_VALUE
- codys 11y agoEh? That dis output doesn't really tell us which is more efficient. To know that, you'd need to know how `COMPARE_OP` works for each of it's arguments, which is what @Negative1 believes will be not-as-efficient (along with range creation). This output doesn't really provide any clarification.
- personjerry 11y agoNow to write a Python interpreter in Minecraft for the infinite translation loop...
- sciurus 11y ago"Permissive policy on pull requests" makes me fearful for the long-term maintainability.
- traverseda 11y agoCompared to the original. We'll revisit that when we have something that offers any genuine advantages. A lot of people have been doing pull requests for unit-tests, documentation, and continuous integration. So I'm not too worried. We're setting up a policy for requests, but that policy is living in code.
- willvarfar 11y agoI love python, but I wish this was a web/webgl app. Is there no way to run this in the browser? :(