GithubHelp home page GithubHelp logo

shade's Introduction

Shade SDK

NOTE: All work in master has currently stopped. There is a 'engine-rewrite' branch which is where all current work is happening.

A simple and easy to use 2.5D game SDK for the Go programming language.

A short video: https://www.youtube.com/watch?v=GlaKt9xPGCQ

NOTE: This SDK should be considered very experimental as it is still under development. It is currently being modeled after some aspects of the PyGame SDK, but this will probably change some as it matures. The project will not have its "experimental" status removed until it is easy to install, easy to use, and supports dynamic lighting.

While the above should work without needing to work with the OpenGL SDK, the packages of this SDK should be extendable such that more advanced uses are possible.

Installing

Linux (Debian based) Specific Instructions

# Install Go 1.6
$ sudo apt-get install git-core libgl1-mesa-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev

Windows Specific Instructions (work in progress)

https://git-scm.com/download/win
https://golang.org/doc/install
https://cygwin.com/install.html
http://www.glfw.org/

To install:

Dependencies

$ go get -u github.com/jteeuwen/go-bindata/...
$ go get github.com/go-gl/gl/v{3.2,3.3,4.1,4.4,4.5}-{core,compatibility}/gl
$ go get github.com/go-gl/gl/v3.3-core/gl

NOTE: the first "go get" will produce an error because generated files are not generated yet.

$ go get github.com/hurricanerix/shade/...
package github.com/hurricanerix/shade/gen: cannot find package "github.com/hurricanerix/shade/gen" in any of:
	/usr/local/go/src/github.com/hurricanerix/shade/gen (from $GOROOT)
	/Users/hurricanerix/bin/usr/gocode/src/github.com/hurricanerix/shade/gen (from $GOPATH)
$ go generate github.com/hurricanerix/shade/...
$ go get github.com/hurricanerix/shade/...

To test your install:

cd $GOPATH/src/github.com/hurricanerix/examples/ex2-platform
go run main.go

Attribution

This project was inspired by the article "Normal Mapping with Javascript and Canvas".

Some aspects of the SDK are inspired by the PyGame SDK.

assets/gopher* adapted from creations by Renee French under a Creative Commons Attributions 3.0 license.

Helpful Tools

Pyxel Edit - Very nice pixel art editor.

Sprite DLight - Instant normal maps for 2D graphics

Tiled - Your free, easy to use and flexible tile map editor.

sfxr/cfxr - Simple means of getting basic sound effects.

Troubleshooing

cannot find package "github.com/hurricanerix/shade/gen"

Some variables/assets are packaged into a generated code file, if you get this error run the bindata.sh script to generate that file.

Slow saves in VIM

Sometimes, go-imports inserts the the wrong things. VIM was hanging for me for about 10~20 seconds after saving. I'm not sure why, but switching from v2.1 to v4.1-core fixed the issue.

-       "github.com/go-gl/gl/v2.1/gl"
+       "github.com/go-gl/gl/v4.1-core/gl"

Error: "could not decode file player.png: image: unknown format"

The following line will not be auto-imported since our code does not call anything in the png, library directly. In order to ensure that the library loads (so image.decode("somefile.png") works), we must have the following import to load the PNG package.

+	_ "image/png" // register PNG decode

... has no field or method ...

And it just does not make sense why it is not found, check that go-imports imported the correct thing.

shade's People

Contributors

aerwin3 avatar creiht avatar hurricanerix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shade's Issues

core: Window Interface

Currently the window package returns (*glfw.Window, error). This proposal is to create a window interface to be returned. This will allow a built in Window implementation to be available. This default implementation should be suitable for most games. If there is a case where it is not idea, a replacement implementation can be created to replace the provided one.

Proposed interface:

// Window to be rendered too.
type Window interface {
    SetMode(w, h, display int) error // SetMode for the window.  display should
    // be a positive value indicating the display to use fullscreen on.  A value
    // of -1 indicates to run in windowed mode.  If display is set to a value
    // out of range, an appropriate error should be returned.
    SwapBuffers()         // Swap buffers.
    Capture() *image.RGBA // Capture and return the image currently being rendered in the buffer.
    Destroy()             // Destroy and cleanup resources for the window.
    ShouldClose() bool    // ShouldClose due to a receiving an event.
}

ex2-platform: cpu power affects jump height

raspberry pi 2 (jumps way too high) (900 MHz qc ARM Cortex-A7, VideoCore IV)
macbook (jumps a reasonable hight) (2.9 GHz Intel Core i5, Intel Iris Graphics 6100)
desktop (does not jump high enough) (3.5 GHz Intel Core i7-4770K, NVIDIA GeForce GTX 970)

ex2-platform: create title screen

After the game plays the intro animation, the title screen should be displayed. The title screen should provide the player with options such as "1 player", "2 player", "options", ...

core: install is still a little odd

Currently when installing with "go get github.com/hurricanerix/shade/..." an error is produced because the gen package does not exist yet.

It would be nice to figure out a way to have "go get" run "go generate" before looking for packages to install.

$ go get github.com/hurricanerix/shade/...
package github.com/hurricanerix/shade/gen: cannot find package "github.com/hurricanerix/shade/gen" in any of:
    /usr/local/go/src/github.com/hurricanerix/shade/gen (from $GOROOT)
    /Users/hurricanerix/bin/usr/gocode/src/github.com/hurricanerix/shade/gen (from $GOPATH)

Missing packages

When following the installation instructions from README.md, I got errors about missing packages from go get github.com/aeonurutu/shade/...:

package github.com/aeonurutu/shade/entity: cannot find package "github.com/aeonurutu/shade/entity" in any of:
/usr/lib/go/src/github.com/aeonurutu/shade/entity (from $GOROOT)
/home/anonymous/my-projects/shade-engine/src/github.com/aeonurutu/shade/entity (from $GOPATH)
package github.com/aeonurutu/shade/fonts: cannot find package "github.com/aeonurutu/shade/fonts" in any of:
/usr/lib/go/src/github.com/aeonurutu/shade/fonts (from $GOROOT)
/home/anonymous/my-projects/redpanda/shade-engine/src/github.com/aeonurutu/shade/fonts (from $GOPATH)
package github.com/aeonurutu/shade/shapes: cannot find package "github.com/aeonurutu/shade/shapes" in any of:
/usr/lib/go/src/github.com/aeonurutu/shade/shapes (from $GOROOT)
/home/anonymous/my-projects/shade-engine/src/github.com/aeonurutu/shade/shapes (from $GOPATH)
package github.com/aeonurutu/shade/sprite: cannot find package "github.com/aeonurutu/shade/sprite" in any of:
/usr/lib/go/src/github.com/aeonurutu/shade/sprite (from $GOROOT)
/home/anonymous/my-projects/shade-engine/src/github.com/aeonurutu/shade/sprite (from $GOPATH)

I'm not sure how to fix the issue since apparently go generate github.com/aeonurutu/shade/... does nothing. Neither scripts/gen.sh generates those missing files.

ex1-platform: fix input

doesn't work very well, sometimes jumps are ignored. also seems to run faster to the right than left.

core: code should be idiomatic Go

A lot of code was not written with the proper Go mindset, everything should be examined to see if it can be re-written in a way that makes sense to Go developers and takes advantages of the Go language.

core: add depth based drawing

currently layering sprites by drawing over things. it would be better to set a depth, and and not draw if something in front of it was already drawn.

Must be in directory with resources to execute

$ ./examples/platformer/platformer
Traceback (most recent call last):
File "./examples/platformer/platformer", line 136, in
Game().main(640, 480)
File "./examples/platformer/platformer", line 95, in main
background = sprites.build('background.png')
File "/home/rhawkins/workspace/transylvania/transylvania/sprites.py", line 135, in build
raise Exception('file {0} does not exist.'.format(filename))
Exception: file background.png does not exist.

core: text alignment

When drawing fonts, the fonts are drawn slightly to the left and down from where they should be drawn.

core: extended sprite modification

Currently you can tweak sprite colors with addColor and subColor. It would be nice to be able to also do things like hue, lightness and saturation.

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.