Go 3D Game Engine

Overview

G3N Banner

Godoc Go Report Card

G3N - Go 3D Game Engine

G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that show rich and dynamic 3D representations - not just games. A basic integrated GUI framework is provided, and 3D spatial audio is supported through OpenAL.

To see G3N in action try the G3N demo or the Gokoban award winning game.

G3ND In Action

Highlighted Projects Using G3N

Dependencies

Go 1.8+ is required. The engine also requires the system to have an OpenGL driver and a GCC-compatible C compiler.

On Unix-based systems the engine depends on some C libraries that can be installed using the appropriate distribution package manager. See below for OS specific requirements.

Ubuntu/Debian-like

$ sudo apt-get install xorg-dev libgl1-mesa-dev libopenal1 libopenal-dev libvorbis0a libvorbis-dev libvorbisfile3

Fedora

$ sudo dnf -y install xorg-x11-proto-devel mesa-libGL mesa-libGL-devel openal-soft openal-soft-devel libvorbis libvorbis-devel glfw-devel libXi-devel

CentOS 7

Enable the EPEL repository:

$ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Then install the same packages as for Fedora - remember to use yum instead of dnf for the package installation command.

Windows

We tested the Windows build using the mingw-w64 toolchain (you can download this file in particular).

The necessary audio DLLs are supplied and need to be added to your PATH. If you would like to build the DLLs yourself you can find the libraries' source code and build instructions here.

macOS

Install the development files of OpenAL and Vorbis using Homebrew:

brew install libvorbis openal-soft

Installation

The following set of commands will download and install the engine along with all its Go dependencies:

git clone https://github.com/g3n/engine g3n-engine
cd g3n-engine
go install ./...

Features

  • Cross-platform: Windows, Linux, and macOS. (WebAssembly is 90% complete!)
  • Integrated GUI (graphical user interface) with many widgets
  • Hierarchical scene graph - nodes can contain other nodes
  • 3D spatial audio via OpenAL (.wav, .ogg)
  • Real-time lighting: ambient, directional, point, and spot lights
  • Physically-based rendering: fresnel reflectance, geometric occlusion, microfacet distribution
  • Model loaders: glTF (.gltf, .glb), Wavefront OBJ (.obj), and COLLADA (.dae)
  • Geometry generators: box, sphere, cylinder, torus, etc...
  • Geometries support morph targets and multimaterials
  • Support for animated sprites based on sprite sheets
  • Perspective and orthographic cameras
  • Text image generation and support for TrueType fonts
  • Image textures can be loaded from GIF, PNG or JPEG files
  • Animation framework for position, rotation, and scale of objects
  • Support for user-created GLSL shaders: vertex, fragment, and geometry shaders
  • Integrated basic physics engine (experimental/incomplete)
  • Support for HiDPI displays

G3N Banner

Hello G3N

The code below is a basic "hello world" application (hellog3n) that shows a blue torus and a button that when clicked makes the torus red:

package main

import (
	"github.com/g3n/engine/app"
	"github.com/g3n/engine/camera"
	"github.com/g3n/engine/core"
	"github.com/g3n/engine/geometry"
	"github.com/g3n/engine/gls"
	"github.com/g3n/engine/graphic"
	"github.com/g3n/engine/gui"
	"github.com/g3n/engine/light"
	"github.com/g3n/engine/material"
	"github.com/g3n/engine/math32"
	"github.com/g3n/engine/renderer"
	"github.com/g3n/engine/util/helper"
	"github.com/g3n/engine/window"
	"time"
)

func main() {

	// Create application and scene
	a := app.App()
	scene := core.NewNode()

	// Set the scene to be managed by the gui manager
	gui.Manager().Set(scene)

	// Create perspective camera
	cam := camera.New(1)
	cam.SetPosition(0, 0, 3)
	scene.Add(cam)

	// Set up orbit control for the camera
	camera.NewOrbitControl(cam)

	// Set up callback to update viewport and camera aspect ratio when the window is resized
	onResize := func(evname string, ev interface{}) {
		// Get framebuffer size and update viewport accordingly
		width, height := a.GetSize()
		a.Gls().Viewport(0, 0, int32(width), int32(height))
		// Update the camera's aspect ratio
		cam.SetAspect(float32(width) / float32(height))
	}
	a.Subscribe(window.OnWindowSize, onResize)
	onResize("", nil)

	// Create a blue torus and add it to the scene
	geom := geometry.NewTorus(1, .4, 12, 32, math32.Pi*2)
	mat := material.NewStandard(math32.NewColor("DarkBlue"))
	mesh := graphic.NewMesh(geom, mat)
	scene.Add(mesh)

	// Create and add a button to the scene
	btn := gui.NewButton("Make Red")
	btn.SetPosition(100, 40)
	btn.SetSize(40, 40)
	btn.Subscribe(gui.OnClick, func(name string, ev interface{}) {
		mat.SetColor(math32.NewColor("DarkRed"))
	})
	scene.Add(btn)

	// Create and add lights to the scene
	scene.Add(light.NewAmbient(&math32.Color{1.0, 1.0, 1.0}, 0.8))
	pointLight := light.NewPoint(&math32.Color{1, 1, 1}, 5.0)
	pointLight.SetPosition(1, 0, 2)
	scene.Add(pointLight)

	// Create and add an axis helper to the scene
	scene.Add(helper.NewAxes(0.5))

	// Set background color to gray
	a.Gls().ClearColor(0.5, 0.5, 0.5, 1.0)

	// Run the application
	a.Run(func(renderer *renderer.Renderer, deltaTime time.Duration) {
		a.Gls().Clear(gls.DEPTH_BUFFER_BIT | gls.STENCIL_BUFFER_BIT | gls.COLOR_BUFFER_BIT)
		renderer.Render(scene, cam)
	})
}

hellog3n Screenshot

You can download and install hellog3n via:

go get -u github.com/g3n/demos/hellog3n

For more complex demos please see the G3N demo program.

Documentation

The complete engine API reference can be found here: GoDoc.

There is also the beginning of a Getting Started Guide, and a newly created list of Guides and Tutorials:

Along with those, a good way to learn how to use the engine is to see the source code of G3ND - the G3N demo.

Contributing

If you find a bug or create a new feature you are encouraged to send pull requests!

Community

Join our channel on Gophers Slack (Click here to register for Gophers Slack). It's a great way to have your questions answered quickly by the G3N community.

Stargazers over time

Stargazers over time

Issues
  • Should loader.Decode() support .obj files without a corresponding material?

    Should loader.Decode() support .obj files without a corresponding material?

    Asking because although the example files (eg gopher.obj, gopher.mtl) work fine, I have several .obj files without materials (generated by CAD programs).

    Was kind of thinking to import the obj files using loader.Decode(), then manually create + apply a material to each imported one.

    At the moment, loader.Decode() treats a missing material file as an error. Am kind of thinking it might be useful to allow it to proceed instead, and pass (say) nil to loader.DecodeReader() which would skip attempting to parse the missing material too.

    Can make a PR, which shouldn't suck too hard code wise. :wink:

    Thoughts? :smile:

    opened by justinclift 15
  • GLSL 3.30 does not allow indexing texture sampler with non constant values – crash

    GLSL 3.30 does not allow indexing texture sampler with non constant values – crash

    Related to #2, I'm not sure where that comes from:

    https://github.com/g3n/engine/blame/master/renderer/shaders/sources.go#L137 or renderer/shaders/include/material.glsl:35: vec4 texColor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i));

    ./g3nd 04:34:03.453577:I:G3ND:G3N Demo v0.6 starting 04:34:03.453624:I:G3ND:OpenGL version: 4.5 (Core Profile) Mesa 19.2.0-devel - padoka PPA 04:34:03.458111:I:G3ND:Using data directory:g3nd/data

    panic: error compiling Vertex Shader: 0:58(26): error: sampler arrays indexed with non-constant expressions are forbidden in GLSL 1.30 and later
    001:#version 330 core
    ...
    051:// GLSL 3.30 does not allow indexing texture sampler with non constant values.
    052:// This function is used to mix the texture with the specified index with the material color.
    053:// It should be called for each texture index. It uses two externally defined variables:
    054:// vec4 texColor
    055:// vec4 texMixed
    056:vec4 MIX_TEXTURE(vec4 texMixed, vec2 FragTexcoord, int i) {
    057:    if (MatTexVisible(i)) {
    058:        vec4 texColor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i));
    059:        if (i == 0) {
    060:            texMixed = texColor;
    061:        } else {
    062:            texMixed = mix(texMixed, texColor, texColor.a);
    063:        }
    064:    }
    065:    return texMixed;
    066:}
    ...
    
    goroutine 1 [running, locked to thread]:
    github.com/g3n/g3nd/app.(*App).Update(0xc0000a6460, 0xc000226580, 0xa9cb781)
    	g3nd/app/app.go:633 +0x2c8
    github.com/g3n/engine/app.(*Application).Run(0xc0000922a0, 0xc0000dbf28)
    	pkg/mod/github.com/g3n/[email protected]/app/app-desktop.go:87 +0x15b
    github.com/g3n/g3nd/app.(*App).Run(0xc0000a6460)
    	g3nd/app/app.go:614 +0x9f
    main.main()
    	g3nd/main.go:24 +0x27
    
    opened by capnm 13
  • Can't play Ogg Vorbis file

    Can't play Ogg Vorbis file

    Hi,

    I have an Ogg Vorbis audio file:

    % file test.ogg
    test.ogg: Ogg data, Vorbis audio, stereo, 48000 Hz, ~160000 bps, created by: Xiph.Org libVorbis I
    

    It plays fine with mpv:

    % mpv test.ogg 
    Playing: test.ogg
     (+) Audio --aid=1 (vorbis 2ch 48000Hz)
    File tags:
     Artist: Vårsol
    AO: [pulse] 48000Hz stereo 2ch float
    A: 00:00:01 / 00:05:24 (0%)
    [...]
    Exiting... (Quit)
    ^C
    

    However, when playing the file with these lines of code, I get a panic:

    	// Load Ogg Vorbis library
    	err = vorbis.Load()
    	if err != nil {
    		panic(err)
    	}
    	fmt.Println(vorbis.VersionString())
    
    	// Load audio
    	player, err := audio.NewPlayer("test.ogg")
    	if err != nil {
    		panic(err)
    	}
    
    	// Play audio
    	err = player.Play()
    	if err != nil {
    		panic(err)
    	}
    

    This is the output

    Xiph.Org libVorbis 1.3.5
    panic: Unsuported file type
    

    This is on 64-bit Arch Linux with Go 1.8 and libvorbis 1.3.5 (comes with libvorbisfile: /usr/lib/libvorbisfile.so.3.3.7).

    opened by xyproto 12
  • The program does not render examples

    The program does not render examples

    I use windows 64. Downloaded the engine from the gitnab and try to run the examples, such as "HelloG3n" or "gopher3d". But only new window appears and shows nothing. Nothing exept the background color. After I close the window programm ends with exit-code:0.

    I do not understand what's the matter! Please,I need your help!

    additionaly, the first time it got error, that it don't may use type int as argument of glfw.CreateStandartCursor in "glfw.go". This fragment introduced below: // Preallocate standard cursors w.arrowCursor = glfw.CreateStandardCursor(int(glfw.ArrowCursor)) w.ibeamCursor = glfw.CreateStandardCursor(int(glfw.IBeamCursor)) w.crosshairCursor = glfw.CreateStandardCursor(int(glfw.CrosshairCursor)) w.handCursor = glfw.CreateStandardCursor(int(glfw.HandCursor)) w.hresizeCursor = glfw.CreateStandardCursor(int(glfw.HResizeCursor)) w.vresizeCursor = glfw.CreateStandardCursor(int(glfw.VResizeCursor)) After this I remove all int from showed strings. But I don't think that it's reason...

    opened by SavostinVladimir 11
  • q: simple box

    q: simple box

    sorry for a really simple, basic question: I want to draw a box on a canvas, and color it red. Could you share an example of using g3n/engine for this? thanks!

    opened by glycerine 11
  • node.SetVisible() state ignored

    node.SetVisible() state ignored

    Just noticed something that seems weird.

    If a scene has several nodes (eg 3 boxes), then the node.SetVisible() call doesn't work as expected when all of the nodes have their visibility turned off.

    If only some of the nodes in the scene have their visibility turned off, then things work as expected. Those nodes disappear visually, and only the remaining nodes can be seen.

    However, when all nodes have their visibility turned off... none of them disappear. eg it's as if the several calls to node.SetVisible() are being ignored.

    Is this expected behaviour?

    Only asking because I'm noticing this while mucking around with engine/gui and buttons. The action of one is set to toggle visibility of various elements, and I noticed this seeming-edge-case. If this is behaviour as intended, then no worries. It's just a test button anyway. :smile:

    opened by justinclift 9
  • Audio dependency names for CentOS 7

    Audio dependency names for CentOS 7

    Just read the audio dependencies for CentOS in the README.md, so decided to investigate quickly:

    For CentOS/Fedora-like Linux distributions, install libopenal1 and libvorbisfile3 (to be verified)

    On my CentOS 7 x64 desktop, the needed package for OpenAL seems to be called "openal-soft" (available in the standard EPEL repo) instead of "libopenal1". There is a matching "openal-soft-devel" package too, but it doesn't seem to be needed when testing just now.

    For testing, I compiled g3nplay and ran it with the demo .ogg and .wav files.

    • Without openal-soft installed, an error message Error trying to load OpenAL library is displayed.
    • With just openal-soft installed (without the -devel package too) the .wav files (only) play back fine.
    • Adding the openal-soft-devel didn't seem to change anything. The .wav files played back fine again.

    For the .ogg demo files though, nothing seemed to work. Both the libvorbis and libogg packages were already installed on my desktop, but the .ogg files refused to play. As in, the g3nplay application proceeded as if there were... but no sound of any sort. Add the libogg-devel and libvorbis-devel packages then recompiling g3nplay didn't change anything.

    So... for at least the OpenAL stuff the package name is pretty clear. Not real sure about the libvorbis bits though. :wink:

    opened by justinclift 9
  • [bug] incorrect preprocessor directive

    [bug] incorrect preprocessor directive

    g3n/engine commit: 1947ea87d4dc4603f0ecb3e14aadbcdee649c839

    Hello, I have a glsl compilation error whenever I try the latest version of g3n/g3nd or the sample application g3n/demos/hellog3n. I've not yet tested previous version of the engine but it seems related to the recent modifications of the glsl bone directives.

    OS: 64bit Mac OS X 10.13.6 17G65
    Kernel: x86_64 Darwin 17.7.0
    GPU: Intel Iris Pro / NVIDIA GeForce GT 750M
    

    I'm currently looking into it and but it might take me some time to make a working PR. I'm using a modified version of the g3n/demos/hello3gn where I added an error check to app.Run()

    $ go run main.go 
    13:39:14.317947:I::OpenGL version: 4.1 NVIDIA-10.32.0 355.11.10.10.40.102
    panic: error compiling Vertex Shader: ERROR: 0:84: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:84: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    ERROR: 0:128: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:128: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    ERROR: 0:131: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:131: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    ERROR: 0:133: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:133: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    ERROR: 0:135: '' : syntax error: incorrect preprocessor directive
    ERROR: 0:135: '' : syntax error: unexpected tokens following #if preprocessor directive - expected a newline
    001:#version 330 core
    002:#define AMB_LIGHTS 1
    003:#define DIR_LIGHTS 0
    004:#define POINT_LIGHTS 1
    005:#define SPOT_LIGHTS 0
    006:#define MAT_TEXTURES 0
    007://
    008:// Vertex Shader
    009://
    010:
    011://
    012:// Vertex attributes
    013://
    014:layout(location = 0) in  vec3  VertexPosition;
    015:layout(location = 1) in  vec3  VertexNormal;
    016:layout(location = 2) in  vec3  VertexColor;
    017:layout(location = 3) in  vec2  VertexTexcoord;
    018:layout(location = 4) in  float VertexDistance;
    019:layout(location = 5) in  vec4  VertexTexoffsets;
    020:
    021:
    022:// Model uniforms
    023:uniform mat4 ModelViewMatrix;
    024:uniform mat3 NormalMatrix;
    025:uniform mat4 MVP;
    026:
    027:
    028://
    029:// Material properties uniform
    030://
    031:
    032:// Material parameters uniform array
    033:uniform vec3 Material[6];
    034:// Macros to access elements inside the Material array
    035:#define MatAmbientColor             Material[0]
    036:#define MatDiffuseColor     Material[1]
    037:#define MatSpecularColor    Material[2]
    038:#define MatEmissiveColor    Material[3]
    039:#define MatShininess        Material[4].x
    040:#define MatOpacity          Material[4].y
    041:#define MatPointSize        Material[4].z
    042:#define MatPointRotationZ   Material[5].x
    043:
    044:#if MAT_TEXTURES > 0
    045:    // Texture unit sampler array
    046:    uniform sampler2D MatTexture[MAT_TEXTURES];
    047:    // Texture parameters (3*vec2 per texture)
    048:    uniform vec2 MatTexinfo[3*MAT_TEXTURES];
    049:    // Macros to access elements inside the MatTexinfo array
    050:    #define MatTexOffset(a)         MatTexinfo[(3*a)]
    051:    #define MatTexRepeat(a)         MatTexinfo[(3*a)+1]
    052:    #define MatTexFlipY(a)          bool(MatTexinfo[(3*a)+2].x)
    053:    #define MatTexVisible(a)        bool(MatTexinfo[(3*a)+2].y)
    054:#endif
    055:
    056:// GLSL 3.30 does not allow indexing texture sampler with non constant values.
    057:// This macro is used to mix the texture with the specified index with the material color.
    058:// It should be called for each texture index. It uses two externally defined variables:
    059:// vec4 texColor
    060:// vec4 texMixed
    061:#define MIX_TEXTURE(i)                                                                       \
    062:    if (MatTexVisible(i)) {                                                                  \
    063:        texColor = texture(MatTexture[i], FragTexcoord * MatTexRepeat(i) + MatTexOffset(i)); \
    064:        if (i == 0) {                                                                        \
    065:            texMixed = texColor;                                                             \
    066:        } else {                                                                             \
    067:            texMixed = mix(texMixed, texColor, texColor.a);                                  \
    068:        }                                                                                    \
    069:    }
    070:
    071:// TODO for alpha blending dont use mix use implementation below (similar to one in panel shader)
    072:            //vec4 prevTexPre = texMixed;                                                      \
    073:            //prevTexPre.rgb *= prevTexPre.a;                                                  \
    074:            //vec4 currTexPre = texColor;                                                      \
    075:            //currTexPre.rgb *= currTexPre.a;                                                  \
    076:            //texMixed = currTexPre + prevTexPre * (1 - currTexPre.a);                         \
    077:            //texMixed.rgb /= texMixed.a;
    078:
    079:#ifdef MORPHTARGETS
    080:    uniform float morphTargetInfluences[MORPHTARGETS];
    081:    
    082:#endif
    083:
    084:#if BONE_INFLUENCERS > 0
    085:    uniform mat4 mBones[TOTAL_BONES];
    086:    in vec4 matricesIndices;
    087:    in vec4 matricesWeights;
    088://    #if BONE_INFLUENCERS > 4
    089://        in vec4 matricesIndicesExtra;
    090://        in vec4 matricesWeightsExtra;
    091://    #endif
    092:#endif
    093:// Output variables for Fragment shader
    094:out vec4 Position;
    095:out vec3 Normal;
    096:out vec3 CamDir;
    097:out vec2 FragTexcoord;
    098:
    099:void main() {
    100:
    101:    // Transform this vertex position to camera coordinates.
    102:    Position = ModelViewMatrix * vec4(VertexPosition, 1.0);
    103:
    104:    // Transform this vertex normal to camera coordinates.
    105:    Normal = normalize(NormalMatrix * VertexNormal);
    106:
    107:    // Calculate the direction vector from the vertex to the camera
    108:    // The camera is at 0,0,0
    109:    CamDir = normalize(-Position.xyz);
    110:
    111:    // Flips texture coordinate Y if requested.
    112:    vec2 texcoord = VertexTexcoord;
    113:#if MAT_TEXTURES>0
    114:    if (MatTexFlipY(0)) {
    115:        texcoord.y = 1 - texcoord.y;
    116:    }
    117:#endif
    118:    FragTexcoord = texcoord;
    119:    vec3 vPosition = VertexPosition;
    120:    mat4 finalWorld = mat4(1.0);
    121:    
    122:#ifdef MORPHTARGETS
    123:
    124:    
    125:
    126:#endif
    127:
    128:#if BONE_INFLUENCERS > 0
    129:
    130:    mat4 influence = mBones[int(matricesIndices[0])] * matricesWeights[0];
    131:    #if BONE_INFLUENCERS > 1
    132:        influence += mBones[int(matricesIndices[1])] * matricesWeights[1];
    133:        #if BONE_INFLUENCERS > 2
    134:            influence += mBones[int(matricesIndices[2])] * matricesWeights[2];
    135:            #if BONE_INFLUENCERS > 3
    136:                influence += mBones[int(matricesIndices[3])] * matricesWeights[3];
    137://                #if BONE_INFLUENCERS > 4
    138://                    influence += mBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
    139://                    #if BONE_INFLUENCERS > 5
    140://                        influence += mBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
    141://                        #if BONE_INFLUENCERS > 6
    142://                            influence += mBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
    143://                            #if BONE_INFLUENCERS > 7
    144://                                influence += mBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
    145://                            #endif
    146://                        #endif
    147://                    #endif
    148://                #endif
    149:            #endif
    150:        #endif
    151:    #endif
    152:
    153:    finalWorld = finalWorld * influence;
    154:
    155:#endif
    156:gl_Position = MVP * finalWorld * vec4(vPosition, 1.0);
    157:}
    158:
    159:
    
    
    goroutine 1 [running, locked to thread]:
    main.check(0x4229520, 0xc420010aa0)
            /Users/rdantzer/GO/src/github.com/raphy42/playground/main.go:14 +0x4a
    main.main()
            /Users/rdantzer/GO/src/github.com/raphy42/playground/main.go:45 +0x2c6
    exit status 2
    
    opened by Raphy42 8
  • Can't install the engine

    Can't install the engine

    Hi after running "go get -u github.com/g3n/engine/...", it throws error like this:

    # github.com/go-gl/glfw/v3.2/glfw
    In file included from go/src/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:24:0:
    go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c: In function ‘_glfwInitJoysticksLinux’:
    go/src/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/go-gl/glfw/v3.2/glfw/glfw/src/x11_platform.h:39,
                     from go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/internal.h:169,
                     from go/src/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_init.c:28,
                     from go/src/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:19:
    /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 ());
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

    I did install all the necessary packages, I am running Ubuntu 18.04 LTS, Go 1.10.1 in VirtualBox.

    opened by Nickan 8
  • Create button_destructive.go

    Create button_destructive.go

    I don't know how to modify two files in a single PR so I'm having to submit this in parts so that g3n will continue to build successfully after each merge. It will be a series of 5 pull requests that you can merge in order and it should compile after each PR. This is the first in the series.

    This series of PRs introduces a new type, ButtonDestructive, which is extremely similar to Button (and uses it internally), but requires two clicks to activate. After the first click, the style and optionally the label text change to indicate that another click is necessary. If the mouse cursor leaves the widget then it is reset. If a second click happens then the associated (usually destructive, hence the name) subscribed action is called.

    opened by amyadzuki 8
  • Join the G3N Discord! :rocket:

    Join the G3N Discord! :rocket:

    Join us on Discord! :rocket:

    https://discord.gg/NfaeVr8zDg

    opened by danaugrs 0
  • Question: making a HUD with bitmap

    Question: making a HUD with bitmap

    Hello, I was playing with the G3n, and looking for a way to implement HUD, or bitmap overlay of some sort - like in almost any first-person shooter game (Doom-like).

    I could use gui.NewImage() and add it to scene at specified position, but apparently scaling/stretching is not possible.

    Any better ideas?

    opened by tomekc 0
  • App scene does not appear properly in MacOs

    App scene does not appear properly in MacOs

    The app scene window in comes into the task bar (dock), but not shown as window in mac. it happens randomly. Do you have any Idea why the app scene behaves like this? and any fix?

    opened by signalsaeed 14
  • How to properly invert sprite (set negative scale)

    How to properly invert sprite (set negative scale)

    I'm trying to invert a sprite by setting its scale to negative (x axis) and then simply removing and adding it to the scene again, but the sprite never gets flipped. Is there any recommended way of doing that? This is what I'm currently trying:

    sprite.SetScale(-1, 1, 0)
    
    opened by drgomesp 1
  • Build error :

    Build error : "syscall/js: build constraints exclude all Go files"

    Hi, I could not build the project from latest sources:

    go version go1.15.6 linux/amd64
    
    $ go install -v ./...
    package github.com/g3n/engine/util/wasm
    	imports syscall/js: build constraints exclude all Go files in /usr/lib/go/src/syscall/js
    

    Any idea how to solve that ?

    Thx Olivier

    opened by ofauchon 5
  • Add gls framebuffer methods from #190

    Add gls framebuffer methods from #190

    I decided to revert the changes to material/texture in #190 since I'll need the framebuffers part of that commit at some point.

    The method to access material textures discussed in #190 is implemented in #224, which was the purpose of the partial revert in this set.

    opened by maugre 0
  • Implement Blinn-Phong model and material

    Implement Blinn-Phong model and material

    It's very similar to the Phong model so we only need to pass a parameter to the phong_model shader.

    Blinn-Phong is quite well described here. I'll leave it up to you whether you want this upstream. Let me know if you want any changes.

    I also have an example application with two materials to show the difference but it'll need tidying for merge, and of course won't work without this commit.

    opened by maugre 1
  • Enable access to material's textures as discussed in PR #190

    Enable access to material's textures as discussed in PR #190

    In #190 it was requested to make a public method to access the material texture property instead of making the property public. This PR adds the TexName() method from #190 and a Texture() method on materials.

    opened by maugre 0
  • Unclear how to properly dispose of nodes

    Unclear how to properly dispose of nodes

    Not really an issue, but rather a question.

    I'm disposing of nodes with scene.remove and then nulling the slice that contained references to the nodes, like so:

    func (a *animator) clearNodeGroup(nodes []*core.Node) []*core.Node {
    
    	for _, node := range nodes {
    		a.scene.Remove(node)
    	}
    	nodes = nil
    
    	return nodes
    }
    
    
    a.clearNodeGroup(a.allLines)
    

    However, I seem to be running into memory issues over time, so I'm not sure if I need to do something else to dispose of the nodes. Haven't been able to figure out anything else that would cause the slowdowns and memory problems. If the scene is on pause, not insterting / removing any nodes, it can run for ages.

    opened by ekuusi 1
Releases(v0.2.0)
Owner
G3N - Go 3D Game Engine Repositories
G3N - Go 3D Game Engine Repositories
Web-based Cloud Gaming service for Retro Game

CloudRetro provides an open-source cloud gaming platform for retro games. It started as an experiment for testing cloud gaming performance with WebRTC and libretro, and now it aims to deliver the most modern and convenient gaming experience through the technology.

giongto35 1.6k Sep 15, 2021
Go 3D Game Engine

G3N - Go 3D Game Engine G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that

G3N - Go 3D Game Engine Repositories 1.6k Sep 14, 2021
This is a "simple" game server. Main functionalities are matching and establishing a connection between players

Game Server This is a "simple" game server. Main functionalities are matching and establishing a connection between players How to Run? run the server

eco 6 Sep 23, 2021
♛♔ Play chess against UCI engines in your terminal.

uchess ♛♔ Play chess in your terminal. Introduction uchess is an interactive terminal chess client designed to allow gameplay and move analysis in con

Travis Whitton 36 Sep 17, 2021
Snake game implemented in golang

little_pineapple(Snake game implemented in golang) 贪吃蛇golang实现 Snake game implemented in golang 数据结构:链表&数组 Data structures used: linked list&array 使用方

null 7 Aug 17, 2020
Snake game made in Go! 🐍

Snake This is a Terminal based snake game made by tristangoossens. Please star this repository to help my first big project grow! Documentation can be

Tristan Goossens 297 Sep 19, 2021
Scalable Distributed Game Server Engine with Hot Swapping in Golang

GoWorld Scalable Distributed Game Server Engine with Hot Reload in Golang Features Architecture Introduction Get GoWorld Manage GoWorld Servers Demos

Nan Lin 1.9k Sep 14, 2021
Terminal-based game engine for Go, built on top of Termbox

Termloop Termloop is a pure Go game engine for the terminal, built on top of the excellent Termbox. It provides a simple render loop for building game

Joel Auterson 1.2k Sep 23, 2021
An open source re-implementation of Diablo 2

OpenDiablo2 Join us on Discord! Development Live stream Support us on Patreon We are also working on a toolset: https://github.com/OpenDiablo2/HellSpa

OpenDiablo2 9.8k Sep 25, 2021
🕹️ A basic gameboy emulator with terminal "Cloud Gaming" support

Gameboy.Live ??️ Gameboy.Live is a Gameboy emulator written in go for learning purposes. You can simply play Gameboy games on your desktop: Or, "Cloud

AaronLiu 4.2k Sep 20, 2021
Engo is an open-source 2D game engine written in Go.

Engo A cross-platform game engine written in Go following an interpretation of the Entity Component System paradigm. Engo is currently compilable for

Engo 1.4k Sep 17, 2021
A 2D ARPG game engine.

Abyss Engine is an ARPG game engine in the same vein of the 2000's games, and supports playing games similar to Diablo 2. The engine is written in golang and is cross platform. This engine does not ship with game specific files, and will require a game's assets in order to run.

OpenDiablo2 33 Aug 24, 2021
A pure Go game engine

Oak A pure Go game engine Table of Contents Installation Motivation Features Support Quick Start Implementation and Examples Finished Games Installati

Oakmound Studio 936 Sep 18, 2021
Dedicated Game Server Hosting and Scaling for Multiplayer Games on Kubernetes

Agones is a library for hosting, running and scaling dedicated game servers on Kubernetes. Agones, is derived from the Greek word agōn which roughly t

GoogleForGames 4.1k Sep 22, 2021
spx - A 2D Game Engine for learning Go+

spx - A 2D Game Engine for learning Go+ Tutorials How to run spx tutorials? Download Go+ and build it. See https://github.com/goplus/gop#how-to-build.

GoPlus 12 Sep 25, 2021
Bampf is a simple 3D arcade style game. Collect Energy Cores in order to finish a level. Teleport (bampf) to safety or use cloaking abilities to avoid Sentinels.

Bampf Bampf is a simple 3D arcade style game. Collect energy cores in order to finish a level. Teleport (bampf) to safety or use cloaking abilities to

null 39 Apr 7, 2021
A dead simple 2D game library for Go

Ebiten (v2) A dead simple 2D game library for Go Ebiten is an open source game library for the Go programming language. Ebiten's simple API allows you

Hajime Hoshi 5.1k Sep 24, 2021
An implementation of the popular game Codenames created with Go and React.

OpenCodenames A real-time implementation of Codenames created with React/TypeScript and Golang. You can play the game here! Installation Stack: React

null 29 Aug 7, 2021
Mk48.io Ship Combat Game

Mk48.io Game Mk48.io is an online multiplayer naval combat game, in which you take command of a ship and sail your way to victory. Watch out for torpe

Softbear Studios 64 Sep 20, 2021