pspi
Posts: 3
Joined: Fri Dec 22, 2017 5:06 pm

PiWorld - Craft ported to the Pi

Fri Dec 22, 2017 5:48 pm

PiWorld is a simple Minecraft like game - you can add and remove blocks in a randomly generated world of hills and sand. It builds on an existing project called Craft that I've edited to run on the Raspberry Pi.

Source code: https://github.com/pspiworld/piworld

Release built for Raspbian: https://github.com/pspiworld/piworld/re ... 0.1.tar.xz

Image

The original Craft is available at: https://github.com/fogleman/Craft

pspi
Posts: 3
Joined: Fri Dec 22, 2017 5:06 pm

Re: PiWorld - Craft ported to the Pi

Sat Dec 23, 2017 5:42 pm

The 0.0.2 release enables use of either the default or experimental GL driver.

https://github.com/pspiworld/piworld/re ... 0.2.tar.xz

jdonald
Posts: 148
Joined: Fri Nov 03, 2017 4:36 pm

Re: PiWorld - Craft ported to the Pi

Mon Dec 25, 2017 7:52 am

This is awesome. Glad you implemented convenient support for both brcm and Mesa drivers out of the box. With the relatively simple render loop, this makes for a straightforward way to test 3D rendering performance under different scenarios. That had been hard to examine properly with Minecraft Pi Edition (closed source) or Minetest (built on top of Irrlicht and its complexities).

Some initial feedback:

  • I typically build with CC=clang CXX=clang++. PiWorld builds under clang, but with a handful of warnings:

    Code: Select all

    /home/pi/piworld/src/config.c:74:26: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare]
                if (opt_name == "port") {
     
    Probably works because gcc and clang aggregate identical strings into one address, but the warning is correct that this is relying on unspecified behavior.
  • When passed incorrect command-line arguments it says:

    Code: Select all

    unused ARGV-elements:
    I'm guessing it was intended to put some text after that colon.
  • There's a VSYNC macro in the code that doesn't seem to do anything. To disable vsync on Mesa I used the environment variable

    Code: Select all

    export vblank_mode=0
  • Rendering performance: With --verbose, the Broadcom driver reports 60 fps and feels as such, while with the Mesa driver it's noticeably more choppy. When the Mesa config reports 52 fps, to the eye it feels more like <30 fps. It's not clear whether this is an effect of judder, latency, many unreported dropped frames, or even my own imagination. When I disable vsync I can get 70 fps yet it still feels less smooth than the Broadcom driver. I could think of some more scientific ways to measure the true fps, but perhaps you're already aware and know the reasons behind the actual fps seeming lower than the reported one?

pspi
Posts: 3
Joined: Fri Dec 22, 2017 5:06 pm

Re: PiWorld - Craft ported to the Pi

Wed Dec 27, 2017 12:29 pm

Hello and thank you for your feedback.

I've pushed fixes for the command line and vsync issues plus some new command line options to give more control over what is rendered.

For me the Mesa build, to be judder free, needs a reduction in view radius to a maximum of 4 and plants to be hidden (using the newly added command line options: --view=4 --show-plants=0). Does this remove the judder you're experiencing?

I'm not sure about the inaccuracy of the FPS counter under Mesa, it's something I'll continue to investigate (maybe unreported GL errors?).

jdonald
Posts: 148
Joined: Fri Nov 03, 2017 4:36 pm

Re: PiWorld - Craft ported to the Pi

Thu Dec 28, 2017 6:24 am

Great, --view=4 --show-plants=0 feels significantly smoother. Glad to have all the other new command line options as well.

On the latest master I get a warning about pg_get_gpu_mem_size() being used before it's declared. It appears config.c should #include pg.h
Last edited by jdonald on Sat Dec 30, 2017 4:56 am, edited 1 time in total.

WillBoxGaming1
Posts: 43
Joined: Tue Dec 26, 2017 1:54 am

Re: PiWorld - Craft ported to the Pi

Fri Dec 29, 2017 11:57 pm

Impressive! Render distance, textures and overall feel is way better than in minecraft Pi. Great work!

Return to “Gaming”