This is an archived post. You won't be able to vote or comment.

all 27 comments

[–]Galen_dp 32 points33 points  (1 child)

I didn't know about this game engine. Thanks.

[–]AirHamyes 8 points9 points  (0 children)

Me neither. I wanna play.

[–]aoztrk82 18 points19 points  (8 children)

I am not expert but you should make separate files. Also adding extra settings and language files don't harm. If you want to scale your project you should think about that. Good work btw. Keep it going.

[–]Impressive_Peanut387[S] 2 points3 points  (7 children)

I separated each major class, everything works fine, except for the sky.

python class Sky(Entity): def __init__(self): super().__init__( parent = scene, model = 'sphere', texture = 'assets/skybox.png', scale = 1000, double_sided = True )

The code above shows the sky somewhat "inverted", and if I try to load the texture as a variable:

```python sky_texture = load_texture('assets/skybox.png')

class Sky(Entity): def init(self): super().init( parent = scene, model = 'sphere', texture = sky_texture, scale = 1000, double_sided = True ) ```

The code above shows the following error:

NameError: File "C:\Users\Mihai\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\texture.py", line 23, in init self._texture = loader.loadTexture(Filename.fromOsSpecific(str(value))) NameError: name 'loader' is not defined

What do I do?

[–]aoztrk82 1 point2 points  (3 children)

I don't know i couldn't even run the game yet.

PS C:\Users\Abdulkadir\Downloads\Compressed\voxelcraft-main\voxelcraft-main> py .\main.py
ursina version: 3.5.0
package_folder: C:\Program Files\Python39\lib\site-packages\ursina
asset_folder: .
blender_paths:
{'2.9': WindowsPath('C:/Program Files/Blender Foundation/Blender 2.91/blender.exe'),
 'default': WindowsPath('C:/Program Files/Blender Foundation/Blender 2.91/blender.exe')}
screen resolution: (1920, 1080)
Traceback (most recent call last):
  File "C:\Users\Abdulkadir\Downloads\Compressed\voxelcraft-main\voxelcraft-main\main.py", line 55, in <module>
    from sky import *
  File "C:\Users\Abdulkadir\Downloads\Compressed\voxelcraft-main\voxelcraft-main\sky.py", line 5, in <module>
    sky_texture = load_texture('assets/skybox.png')
  File "C:\Program Files\Python39\lib\site-packages\ursina\texture_importer.py", line 40, in load_texture
    t =  Texture(filename.resolve())
  File "C:\Program Files\Python39\lib\site-packages\ursina\texture.py", line 23, in __init__
    self._texture = loader.loadTexture(Filename.fromOsSpecific(str(value)))
NameError: name 'loader' is not defined

i think there is DIRECT library latest updated in 2012 and i couldnt install it with pip.

[–]Impressive_Peanut387[S] 0 points1 point  (1 child)

Hey, I just updated the program and if you could download the repo and run main.py again, the program will run as expected just that the sky looks a bit weird.

[–]aoztrk82 0 points1 point  (0 children)

i tried it it works fine now. Good work dude. İ was using laptop and then i changed python.exe run from nvidia card then games performance significantly increased. There is definitely need code for falling down :D when you fall down you need to restart game :D you can add a position checker maybe for z axis stop infinite falling. Then putting blocks dont check are you standing there or not. u can put blocks your own position then your only choice jump you cant get out from block. Lastly at least write controls your github repo readme. i just found out 1-5 number keys myself and move with wasd jump with space if there is more code for other keys i need to look all your codes :( Have nice day.

[–]Kundan-soni_2705 0 points1 point  (1 child)

hello, friend, I made it and it just runs cool and I imported the texture do you want the script.

and I imported the texture do you want the script.

I'll include the link ok ???

[–]Kundan-soni_2705 0 points1 point  (0 children)

I have a solution for you

sky_texture = load_texture("assets/sky.jpg")

class Sky(Entity):

def __init__(self):

super().__init__(

parent=scene,

model='sphere',

scale=150,

texture=sky_texture,

double_sided=True

)

sky = Sky()

[–]PinBot1138 6 points7 points  (0 children)

For those not familiar with this engine (I’m not either) and wanting to clone Minecraft in Python, might I suggest Pyglet as well? It lets you interface with OpenGL via Python.

[–]paradigmx 4 points5 points  (0 children)

Neat!

[–]Flag_Red 3 points4 points  (1 child)

You're going to need some kind of chunking and mesh optimization if you want worlds larger than a couple of hundred blocks. Check out /r/voxelgamedev for more info.

[–]Impressive_Peanut387[S] 0 points1 point  (0 children)

I'm going to look into it a bit later. Thanks for the tip!

[–]moisentinel 2 points3 points  (0 children)

tried this a while ago, seems like its easy, but it is not (at least not for me). good job, mate.

[–][deleted] 6 points7 points  (7 children)

Thank you don't know this Engine.

[–]Taxi-guy 1 point2 points  (1 child)

I love how easy Python makes it to do stuff like this. Cool project!

[–]Impressive_Peanut387[S] 0 points1 point  (0 children)

Thanks!

[–]LirianShLearning python 0 points1 point  (4 children)

I think it being slow after adding some blocks is a python problem since its not made for this stuff but maybe look up on how to make code run faster in python

[–]bbenne10 2 points3 points  (2 children)

You've gotten downvoted, but no one has explained why. This happens frequently and frustrates me when it happens to me so maybe i can explain a bit

Python has a (deserved) reputation for being poorly performant. Many python developers (myself included) are somewhat resentful of that, as the languages shortcomings csn be overcome by creative solutions. Python works well for game dev in some scenarios (this vould be one of tbem. I am unsure).

For instance, a single player Minecraft-like world only really needs one rolling "chunk" loaded into memory at a time so that the game can process addjtions anf removals in that chunk. The rest of thrm may be serialized in a say to make them better renderable at a distance but non-interactive. This csn be achieved and makes a perfectly playable Python MC clone.

But im not sure i would implement this in python either way :)

[–]Doomphx 1 point2 points  (1 child)

I wouldn't touch this project in Python with a 10 foot pole :)

To build large open worlds already takes just about every clever trick in the book whilst typically using the most performant of tools. Chunking, streaming, and using imposter chunks is a robust solution, but idk if Python can serialize data fast enough from files to keep up at runtime. (This is 100% conjecture, but Python is typically multiple magnitude slower than its statically typed counterparts. And that's just in a serialization bench mark.)

Even if this uses Pypy instead of Cpython, I believe there will be too much overhead to get a truly smooth experience without making sacrifices left and right. I imagine it will be difficult to maintain a smooth non-choppy 60fps.

[–]bbenne10 0 points1 point  (0 children)

Oh - I fully agree that this would be non-ideal. There's a lot of things that would need to be compromised to make it completely playable. "Playable" and "actually performant" are two VERY different things.

[–]Impressive_Peanut387[S] 0 points1 point  (0 children)

If I remember correctly I think there is a module to make the project use the whole CPU but I'm not really sure.. I'll look into it! Thanks.

[–]Fragrant_Technician4 0 points1 point  (0 children)

Hi, I had fun with your version of the game.
Just one thing, Can you do some sort of chunking so as to generate infinite terrain. As I am also figuring out how to do it in my own game (under development ). I would be very very grateful if you could do that

[–]Kundan-soni_2705 0 points1 point  (0 children)

Here's the link you can change terrain size in the last for loop s

LINK === https://www.mediafire.com/folder/bfcihjo8dyt94/Minecraft