A Wren based 2D game engine with an emphasis on portability and useful APIs.
Sock is code driven rather than editor driven.
Game.cursor = "hidden"
Game.title = "SockQuest"
var cursor = Sprite.load("cursor.png")
Game.begin {
Game.clear(#fff)
cursor.draw(Input.mouse.x, Input.mouse.y)
}
In development and on hiatus, but in a somewhat usable state.
However you will need to build the project yourself.
Support will not be provided for the time being.
If you are interested in other active Wren game engines please check out:
Online API documentation is provided here (via the sock-docs repo).
- Graphics
- 3D Accelerated graphics (OpenGL or WebGL)
- Fixed or uncapped FPS
- Fixed viewport resolution, or fit to window
- 2D Camera, with optional transform
- Primitive drawing (quads)
- Sprites
- Load from
.png
.jpg
.gif
.bmp
- Draw once or batch
- Transformations and coloring
- Configure scale filtering and wraping
- Load from
- Audio
- Load from
.wav
.mp3
.ogg
- Effects
- Biquad filter: lowpass, highpass, bandpass
- Echo and reverb
- Buses
- Load from
- Input
- Keyboard, Mouse, Touch, Gamepad
- Utilities for rebinding.
- Assets
- JSON
- Text
- Binary data
- Storage - simple
save(key, value)
andload(key)
- Random
- Instantiable and seedable
- Time
- Windows
- Web
- Desktop: Chrome, Firefox, Safari
- Mobile: iOS Safari, Android Chrome
Mac and Linux planned!
Feature | Desktop | Web |
---|---|---|
Written in | C++ | C (Emscripten) & JavaScript |
OS Abstraction (Windowing etc.) |
SDL | JavaScript |
Graphics | OpenGL 3.3 | WebGL 1 |
Image Loading | stb_img.h |
<img> |
Audio | SoLoud w/ SDL backend | WebAudio |
Audio Loading | SoLoud | WebAudio decodeAudioData() stbvorbis.js fallback on Safari |
Input | SDL | JavaScript |
Storage | OS specific app-data folder | localStorage |
Windows builds are distributed as an .exe
with SDL2.dll
.
Assets are loaded from either:
- files in an adjacent directory
assets/
- files contained in an adjacent
assets.zip
file
Web builds are generated as a directory with the following files:
File | Description |
---|---|
index.html |
The page to view the game in. |
sock.js |
JavaScript that runs the game/APIs. |
sock_web.wren |
Wren code for Sock API. |
sock_c.wasm |
Wren intepreter as WebAssembly, and some Sock APIs. |
stbvorbis.js |
.ogg decoder, only loaded on Safari. |
unzipit.js |
.zip decoder worker |
assets/ |
Directory containing project files. |
Game | Web build | Source code |
---|---|---|
Snake | https://luca.games/s/snake/ | https://luca.games/s/snake/src/main.wren |