GithubHelp home page GithubHelp logo

gocraft's Introduction

GoCraft

A Minecraft like game written in go, just for fun!

ScreenShot

Features

  • Basic terrain generation
  • Add and Remove blocks.
  • Move and fly.
  • Multiplayer support

Dependencies

For go

  • go 1.10+

For glfw

  • On macOS, you need Xcode or Command Line Tools for Xcode (xcode-select --install) for required headers and libraries.
  • On Ubuntu/Debian-like Linux distributions, you need libgl1-mesa-dev and xorg-dev packages.
  • On CentOS/Fedora-like Linux distributions, you need libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel mesa-libGL-devel libXi-devel packages.

Install

go get github.com/icexin/gocraft

Run

Suppose $GOPATH/bin is in your PATH env, use command below to run.

cd $GOPATH/src/github.com/icexin/gocraft && gocraft

How to play

  • W, S, A, D to move around.
  • TAB to toggle flying mode.
  • SPACE to jump.
  • Left and right click to add/remove block.
  • E,R to cycle through the blocks.

Multiplayer

Multiplayer is supported now!

The server code is at https://github.com/icexin/gocraft-server .

You can use gocraft -s gocraft.icexin.com to connect the public server.

Since the player on public server is anonymous, be carefull for your work!

If any network error occurs, the game will end with a panic, may changed in the future.

Local cache is saved as cache_$server.db, you can use gocraft -db xxx.db to offline use.

Roadmap

  • Persistent changed blocks
  • Multiplayer support
  • Ambient Occlusion support

Implementation Details

Many implementations is inspired by https://github.com/fogleman/Craft, thanks for Fogleman's good work!

Multiplayer is implementated used a duplex rpc call, client can call server to update blocks or fetch chunks, server can also push changes to clients.

gocraft's People

Contributors

icexin avatar johnstoncode avatar dolanor avatar

Stargazers

arekkusu avatar  avatar  avatar MetaSky avatar baize avatar  avatar iWorld Jiang avatar ekis avatar Yuriy A Taranov avatar  avatar Divansh avatar  avatar  avatar kuanbase avatar  avatar Redginald Godeau avatar popy32 avatar Wildlife avatar Antonio Dumit avatar  avatar Restart avatar Nicholas Kovacs avatar Hasuki avatar  avatar DEVp avatar iVampireSP.com avatar  avatar golua_series avatar  avatar  avatar zeo avatar  avatar UallenQbit avatar とうかいけい avatar Matúš Ollah avatar Max Clavel avatar Uzay Toprak avatar soham avatar Jean Leao avatar Will Faught avatar Christoph Jasinski avatar sweet avatar vistor avatar  avatar  avatar  avatar yehun avatar Label avatar Isaque Veras avatar Justin Tieri avatar Oleg Stotsky avatar Daniel Ribeiro avatar ekis avatar Ibrahim Kettaneh avatar Edwin Kofler avatar Halo Master avatar WirrorYin avatar Christian Korneck avatar 5541502D504C543A584F524F58 avatar  avatar xiangxudong avatar H3XÐΛΞMѲИ avatar Adrian avatar  avatar João Vitor Martins Neto avatar Olivier Mengué avatar Kevin Miller avatar  avatar  avatar  avatar github avatar  avatar 江珉 avatar Fedor Korolev avatar ComputerGuy avatar Guox avatar jk avatar  avatar  avatar  avatar 玩世无名 avatar  avatar Yusuf Malikul Mulki avatar SurKaa avatar  avatar xincc avatar  avatar a39 avatar liu avatar lieks avatar  songjiayang avatar tqcenglish avatar  avatar Illya Marchenko avatar AlienCode avatar Steffen Wold avatar Aldiyar Y. avatar  avatar zztkm avatar  avatar

Watchers

Alexey Sudachen avatar Vladimir Merzliakov avatar  avatar zikes avatar Whit Fackler avatar Matthew Clark avatar Aleksey Suleymanov avatar Cesar Gimenes avatar James Cloos avatar Bogdan Radacina avatar Maxim Tkach avatar MacTORG avatar Edward Xie avatar Tim Jurcka avatar  avatar Bruno Albuquerque avatar Joseph Alai avatar  avatar  avatar Luis Ramos avatar Carl avatar Alexander Wagner avatar Tony Gu avatar Muck Colbus avatar Maxim Mironov avatar kms9 avatar gaoxiang avatar  avatar  avatar  avatar Ian avatar Lee avatar  avatar bonetoy avatar Hallucino avatar Allen avatar  avatar Chris Birster avatar Z Ray avatar  avatar YouMin avatar aimof avatar  avatar  avatar  avatar Mark avatar  avatar  avatar GAO avatar HexgazeP avatar  avatar

gocraft's Issues

Doesn't build on Windows 10

I know that Windows isn't supported, but could you help me with this build error, please:

λ go build
package github.com/icexin/gocraft
        imports github.com/go-gl/gl/v3.3-core/gl: build constraints exclude all Go files in C:\Users\Robert\go\pkg\mod\github.com\go-gl\[email protected]\v3.3-core\gl
package github.com/icexin/gocraft
        imports github.com/go-gl/glfw/v3.2/glfw: build constraints exclude all Go files in C:\Users\Robert\go\pkg\mod\github.com\go-gl\[email protected]\v3.2\glfw

what are your suggestions for starting study this project?

Thank you very much for your development. I am a novice in go language. I have just finished learning the basic OpenGL and go-sdl2. If you want to learn how to develop this project, what are your suggestions for starting study? Thank you.

Warning on github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c:224:42

Warning on github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c:224:42

lab@ubu1:~$ go get github.com/icexin/gocraft
# github.com/icexin/gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw
In file included from go/src/github.com/icexin/gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:22:0:
go/src/github.com/icexin/gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c: In function ‘_glfwInitJoysticksLinux’:
go/src/github.com/icexin/gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c:224:42: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 9 [-Wformat-truncation=]
             snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
                                          ^~~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from /usr/include/X11/Xcursor/Xcursor.h:26,
                 from go/src/github.com/icexin/gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_platform.h:39,
                 from go/src/github.com/icexin/gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/internal.h:169,
                 from go/src/github.com/icexin/gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_init.c:28,
                 from go/src/github.com/icexin/gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:17:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 12 and 267 bytes into a destination of size 20
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lab@ubu1:~$

Performance

Good morning, sir,
I don't know what it is, but when I put down blocks, I get a micro freeze...

is it due to Go or to your implementation?

What did you get from the development of this game? What do you think of Go for video games?

Built the package but cannot see anything!

macOS 10.14 Mojave beta 10
Go 1.11
GO111MODULE=on

Hello, I've managed to build the package and produced the gocraft executable, but when I run it I cannot see anything, just a black window. The terminal window behind shows that the app is responding to the A, W, S + D commands. When I built the package, all the dependencies appeared to be downloaded without any errors. Maybe it's a Mojave problem.

Any ideas? Thanks!

Build failed on FreeBSD

Hello i would like compile engine but i have problem with dependencies

go mod init
go build

go: extracting golang.org/x/image v0.0.0-20171214225156-12117c17ca67
go: downloading github.com/hashicorp/yamux v0.0.0-20171219165022-683f49123a33
go: extracting github.com/hashicorp/yamux v0.0.0-20171219165022-683f49123a33
# github.com/go-gl/glfw/v3.2/glfw
In file included from ../../go/pkg/mod/github.com/go-gl/[email protected]/v3.2/glfw/c_glfw.go:4:
In file included from ./glfw/src/context.c:28:
In file included from ./glfw/src/internal.h:169:
./glfw/src/x11_platform.h:36:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
         ^~~~~~~~~~~~
1 error generated.
# github.com/go-gl/gl/v3.3-core/gl
../../go/pkg/mod/github.com/go-gl/[email protected]/v3.3-core/gl/procaddr.go:52:11: fatal error: 'GL/glx.h' file not found
        #include <GL/glx.h>
                 ^~~~~~~~~~

open texture.png: no such file or directory

Steps to reproduce

  • $> go get github.com/icexin/gocraft
  • $> gocraft

This error will occur

2021/08/09 13:11:54.654137 PlatformError: Cocoa: Failed to retrieve display name
2021/08/09 13:11:54.775420 open texture.png: no such file or directory
panic: open texture.png: no such file or directory

goroutine 21 [running]:
log.Panic(0x1400015df68, 0x1, 0x1)
	/usr/local/go/src/log/log.go:354 +0x98
main.run()
	/Users/sudosu/golang/pkg/mod/github.com/icexin/[email protected]/main.go:332 +0x1cc
github.com/faiface/mainthread.Run.func1(0x1054bf1f0, 0x140000b0000)
	/Users/sudosu/golang/pkg/mod/github.com/faiface/[email protected]/mainthread.go:37 +0x28
created by github.com/faiface/mainthread.Run
	/Users/sudosu/golang/pkg/mod/github.com/faiface/[email protected]/mainthread.go:36 +0x9c

my go env background:
In my zsh config, I have $GOPATH defined only, because $GOROOT is optional(https://dave.cheney.net/2013/06/14/you-dont-need-to-set-goroot-really) - maybe this is the problem, I'm not a golang programmer, but those go env variables are pain..

vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw.go:4:10: fatal error: 'glfw/src/context.c' file not found

gocraft/vendor/github.com/go-gl/glfw/v3.2/glfw

vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw.go:4:10: fatal error: 'glfw/src/context.c' file not found
#include "glfw/src/context.c"
^~~~~~~~~~~~~~~~~~~~
1 error generated.

Compilation finished with exit code 2

---- go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hipnusleo/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hipnusleo/Workspace/packages/golang"
GORACE=""
GOROOT="/opt/local/lib/go"
GOTMPDIR=""
GOTOOLDIR="/opt/local/lib/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="/usr/bin/clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/s_/db9sxfb91xd7k59f1l9cfwl00000gn/T/go-build426875879=/tmp/go-build -gno-record-gcc-switches -fno-common"


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.