Developing games using golang
remains niche. A standard game development
path starts with picking an engine, which then kind of makes the choice
of programming language and some tooling for you. For example:
Unreal Engine
which tends towards C++ code.Unity
which tends towards C# coding.Xcode
on macosVisual Studio
on windowsSince I enjoy programming in go
and learning about 3D programming, I find myself coding
games from scratch while I wait for a golang
production level 3D game engine.1
While I don’t recommend this path if you just want to make games, I find it rewarding
as I get to learn some game programming basics.
This still leaves a large amount of development tool choices, which can be narrowed down based on preferences. My ideal is a small tool chain where the tools are open source and supported on multiple platforms. The difficult choice I find I have to make when evaluating tools is “value add” vs “complexity”. Does the tool add enough value to justify learning how to use it? How much do I have to fight with the tool to get it to produce what I want?
My feeling is that each developer will find different tools work better for them, and it is may be part of the reason why there are so many tool choices. Here are the tools that work for me without any justification as to why, or any rationalization that they are better than the multitude of other options.
Code: mainly golang
https://golang.org/dl/ using a text based editor.
Access to native platform libraries may require some C
code wrapped in
go
bindings, ie:
macos
, win
, …) for windowing systems and user input.vulkan
) https://vulkan.lunarg.com/sdk/homeOpenAL
) http://openal-soft.org/openal-binaries/Source Control: git
https://gitforwindows.org.
github
can provide value as it has built in bug tracking and support for a project wiki.
2D images: krita
for both pixel and vector layers https://krita.org/en/download/
3D models: blender
https://www.blender.org/download
Audio Editing: audacity
https://www.audacityteam.org/download/
Video Editing: shotcut
which is a paid app. I occassionaly look around for an open source alternative.
GPU Debugging: renderdoc
https://renderdoc.org/builds
Documentation: go doc
, markdown, and plain text README files.
Build and Packaging: is done using go generate
to call the command line
packaging utilities provided in the platform specific developer kits, eg:
For me “go generate” works nicely with builds that are designed as a small sequence of command line calls.2
Terminal: windows terminal from the microsoft store using the git bash shell https://apps.microsoft.com/detail/9n0dx20hk701
Editor: vim
comes as part of the git for windows bash shell.
Vim itself can become a source of complexity through the use of plugins,
particularly when the plugins don’t work on windows.3
Fast File Search: rg
https://github.com/BurntSushi/ripgrep
Code Counter: tokei
https://github.com/XAMPPRocky/tokei
Font: hack
https://sourcefoundry.org/hack
Color Pallete: solarized
https://ethanschoonover.com/solarized
I use my own 3D “hobby” engine https:github.com/gazed/vu,
While it is written in go
, I do not recommend for others, as it has a very
small user base (only one that I know of). It can produce working games though
as shown by my latest game https:floworlds.com.
A go generate
snippet that builds the win64 packages for Steam and the Windows Store.
// -----------------------------------------------------------------------------
// generate the windows syso file.
// requires https://github.com/akavel/rsrc in PATH
//
//go:generate rsrc -arch amd64 -ico win_icon.ico -manifest win_manifest.xml
//go:generate mv rsrc_windows_amd64.syso ../win_amd64.syso
//
// -----------------------------------------------------------------------------
// build shippable exe
// NOTE: https://github.com/golang/go/issues/71242 discusses asyncpreemptoff and freezes w. steam.
//
//go:generate go build -C .. -ldflags "-H=windowsgui -X runtime.godebugDefault=asyncpreemptoff=1 -X main.Version=v1.6.4"
// =============================================================================
// Create the steam zip file.
// Upload this to steam as a new build from the steamworks app webpage.
//
//go:generate cp ../flow.exe ./floworlds.exe
//go:generate env "PATH=/c/WINDOWS/system32:$PATH" tar.exe -a -cf steam/floworlds.zip floworlds.exe OpenAL32.dll
// =============================================================================
// Create the windows store package.
// Validate using "Windows App Cert Kit" before uploading.
//
//go:generate cp ../flow.exe ./win/floworlds/floworlds.exe
//go:generate makeappx.exe pack -d win/floworlds -p win/floworlds.msix
example .vimrc
that avoids plugins while adding go fmt
and go build
to vim
" set tabs to 4 spaces.
set tabstop=4 shiftwidth=4
" override some syntax highlights
colorscheme default
highlight Comment term=bold ctermfg=240
highlight Todo term=bold ctermfg=9 ctermbg=NONE
" override vim file tab bar colors
hi TabLineFill ctermfg=8 ctermbg=8
hi TabLine ctermfg=White ctermbg=8
hi TabLineSel ctermfg=White ctermbg=Yellow
" needed to disable bell when using windows terminal.
set noerrorbells visualbell t_vb=
" edit file tabs
set tabpagemax=50
nnoremap <S-l> :tabnext<CR>
nnoremap <S-h> :tabprevious<CR>
nnoremap tt :tabnew<Space>
nnoremap tn :tabm<Space>
" save with Control-X
nnoremap <C-x> :update<cr>
" clear trailing spaces with \s
nnoremap \s ::%s/\s\+$//e<CR>
" glsl syntax highlighting
" from https://www.vim.org/scripts/script.php?script_id=1002
augroup glsl_syntax
autocmd!
autocmd BufNewFile,BufRead *.frag,*.vert,*.glsl setf glsl
augroup END
" gofmt
function! GoFmt()
let saved_view = winsaveview()
silent %!gofmt
if v:shell_error > 0
cexpr getline(1, '$')->map({ idx, val -> val->substitute('<standard input>', expand('%'), '') })
silent undo
cwindow
else
cclose
endif
call winrestview(saved_view)
endfunction
command! GoFmt call GoFmt()
augroup go_autocmd
autocmd BufWritePre *.go GoFmt
augroup END
" go compile
autocmd Filetype go set makeprg=go\ build
autocmd QuickFixCmdPost [^l]* cwindow
nnoremap <F5> :silent make<CR><C-L><CR>
" use existing tabs or switch to a new tab
set switchbuf+=usetab,newtab
" remove trailing whitespace
nnoremap <F8> :%s/\s\+$//e<CR>