Wonkey - an open source programming language for the creation of cross-platform video games

Overview

Views windows linux macos emscripten ios android

Wonkey Programming Language

Wonkey is an open source programming language for the creation of cross-platform video games, highly inspired by the “Blitz” range of languages.

Desktop targets

Windows MacOS Linux Raspbian

Mobile targets

Android iOS

Web targets

Emscripten

More information

Website: https://wonkey-coders.github.io/

Github page: https://github.com/wonkey-coders

Discord channel : https://discord.gg/awfuRtZay7

Join the community and improve this programming language.

Enjoy!

Showcase

Wonkey on Raspbian (Raspberry PI 4)

Click screenshots to run the examples in browser:

Pool

Toy plane

Commanche


How to setup Wonkey

Prerequisites

You need a working C/C++ developement environment for desktop targets, Emscripten for web target. Android NDK for mobile target.

Targets:

If you are reading this on Github, please note there are prebuilt versions of wonkey (with complete source code) available from https://github.com/wonkey-coders/wonkey/releases.

Windows

Using GCC

Unless you are using one of the prebuilt releases, you will need to install the mingw-64 compiler. There are self-extracting archive of mingw-64 that has been tested with wonkey here :

If you install this to the wonkey 'devtools' directory, the following steps should 'just work' (ha!) else you must added mingw64\bin path in your environment variables.

NOTE: Wonkey use x64 by default. See bin\windows\env_windows.txt file for more information.

Using MSVC

Wonkey auto-detected your MSVC installation and use it by default, no need to changes anymore. If you want using GCC, you need to change WX_USE_MSVC variable in bin\windows\env_windows.txt.

Follow the next steps to build :

  1. Open a command prompt and change to the 'wonkey\scripts' directory.
  2. Enter rebuildall.bat and hit return. Wait...
  3. If all went well, you should end up with a 'Wonkey (windows)' exe in the wonkey directory. Run this to launch the WIDE (Wonkey IDE).
  4. You should now be able to build and run wonkey apps. There are some sample apps in the 'wonkey/examples' directory.

MacOS/Linux/Raspberry Pi

  • On MacOS, install the XCode command line tools. You can do this by entering in a shell :

  • On Linux, install the GCC toolchain and libraries. You can do this by entering in a shell :

    •   sudo apt-get install g++-multilib libopenal-dev libpulse-dev libsdl2-dev ncurses-dev
    • You may want to use the following install script as an example:

       #
       # Install Wonkey on Linux Mint (https://linuxmint.com) into %USER%/wonkey
       #
       cd ~/
       sudo apt-get update
       sudo apt-get install git g++-multilib libopenal-dev libpulse-dev libsdl2-dev
       git clone -b develop --single-branch --depth 1 https://github.com/wonkey-coders/wonkey
       cd wonkey/scripts
       ./rebuildall.sh
       cd ..
       ./bin/linux/wide/wide
  • On Raspberry Pi OS, install the GCC toolchain and libraries. You can do this by entering in a shell :

    •   sudo apt-get install git libopenal-dev libpulse-dev libsdl2-dev libncurses5-dev libncursesw5-dev libasound2-dev libudev-dev libxi-dev libxxf86vm-dev mesa-common-dev
    • You may want to use the following install script as an example:

       #
       # Install Wonkey on Raspberry Pi 4 into %USER%/wonkey
       #
       cd ~/
       sudo apt-get update
       sudo apt-get install git libopenal-dev libpulse-dev libsdl2-dev libncurses5-dev libncursesw5-dev libasound2-dev libudev-dev libxi-dev libxxf86vm-dev mesa-common-dev
       git clone -b develop --single-branch --depth 1 https://github.com/wonkey-coders/wonkey
       cd wonkey/scripts
       ./rebuildall.sh

Follow the next steps to build :

  1. Open a shell and change to the 'wonkey/scripts' directory.

  2. Enter ./rebuildall.sh and hit return. Wait...

  3. If all went well, you should end up with a 'Wonkey (...)' app in the wonkey directory. Run this to launch the WIDE (Wonkey IDE).

  4. You should now be able to build and run wonkey apps. There are some sample apps in the 'wonkey/examples' directory.


Emscripten

See installation instructions from Emscripten site.

# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git

# Enter that directory
cd emsdk

# Fetch the latest version of the emsdk (not needed the first time you clone)
git pull

# Download and install the latest SDK tools.
./emsdk install latest

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh

#In the description above we asked the emsdk to install and activate latest, which is the latest tagged release. That is often what you want.

# You can also install a specific version by specifying it, for example,
./emsdk install 1.38.45

NOTE: on macOS, you can use brew install emscripten.

NOTE: on Windows, run emsdk instead of ./emsdk, and emsdk_env.bat instead of source ./emsdk_env.sh.

Before setup, you need to build modules for web target from wake command:

wake mods -target=emscripten

iOS

You must setup MacOS environment first and you need build modules for iOS target from wake command:

wake mods -target=ios

Android

TODO

wake mods -target=android

Introduction to Wonkey

ℹ️ More complete help and samples are available online at https://wonkey-coders.github.io/.

"Hello, Wonkey!'

Function Main()
	Print "Hello, Wonkey!"
End

While staying true to the 'basic' style of the original Blitz languages, Wonkey offers some very powerful new features including:

Generic classes and methods

Classes, interfaces, structs, methods and functions can have 'type' parameters.

Struct Rect<T>
	Field x0:T, y0:T
	Field x1:T, y1:T
End

'Main entry
Function Main()
	Local r:=New Rect<Float>
End

'First class' functions

Functions (and methods) can be stored in variables and passed to/from other functions.

Function Test1()
	Print "Test1"
End

Function Test2()
	Print "Test2"
End

Function Tester( test:Void() )
	test()
End

'Main entry
Function Main()
	Tester( Test1 )
	Tester( Test2 )
End

Lambda functions

Lambda functions allow you to create closures.

Function Test( func:Void() )
	func()
End

'Main entry
Function Main()
	For Local i:=0 Until 10
		Test( Lambda()
			Print i
		End)
	Next
End

New 'Struct' type that provides value semantics

Structs are similar to classes in that they encapsulate member data, but differ in that they are passed around 'by value' instead of 'by reference'.

This allows structs to be efficiently create on the stack without any garbage collection overhead.

Struct S
	Field data:Int=10
End

Function Test( s:S )
	s.data = 100
End

'Main entry
Function Main()
	Local s:=New S 'Create a new S on the stack (very fast!)
	Test( s )      'Test gets a copy of 's'
	Print s.data   'Print '10'
End

Fibers for easy asynchronous programming

Fibers provide support for 'cooperative' multi-threading.

Function Server( host:String, service:String )
	Local server:=Socket.Listen( host, service )
	
	Repeat
		Local client:=server.Accept()
		New Fiber( Lambda()
			Local data:=client.Receive(...)
		End )
	Forever
End

Operator overloading

Operator overloading allows you to override the meaning of the built-in language operators, making for more expressive code.

Struct Vec2
	Field x:Float
	Field y:Float

	Method New( x:float,y:Float )
		Self.x=x
		Self.y=y
	End

	Operator+:Vec2( v:Vec2 )
		Return New Vec2( x+v.x,y+v.y )
	End

	Operator To:String()
		Return "Vec2("+x+","+y+")"
	End
End

'Main entry
Function Main()
	Local v0:=New Vec2( 10,20 )
	Local v1:=New Vec2( 30,40 )
   
	Print v0+v1
End

Class extensions

Class extensions allow you to add extra methods, functions and properties to existing classes.

Struct Foo
	Field i:Int=0
End 
Struct Foo Extension
	Method Increment()
		i+=1
	End
End

Fully garbage collected

Wonkey provides a 'mostly' incremental garbage collector that efficiently collects garbage as it runs without any of those annoying 'sweep' spikes found in typical garbage collectors.

Optional reflection features

Wonkey includes an optional reflection system that allows you to inspect and modify variables and values at runtime:

" Class C Method Update( msg:String ) Print "C.Update : msg=" + msg End End 'Main entry Function Main() Local c:=New C Local type:=Typeof( c ) Print type Local decl:=type.GetDecl( "Update" ) decl.Invoke( c, "Hello World!" ) End ">
#Import "
    
     "
    

Class C
	Method Update( msg:String )
		Print "C.Update : msg=" + msg
	End
End

'Main entry
Function Main()
	Local c:=New C
	
	Local type:=Typeof( c )
	Print type
	
	Local decl:=type.GetDecl( "Update" )
	decl.Invoke( c, "Hello World!" )
End

Credits

Wonkey is an community project and an fork of Monkey2 programming language designed by Mark Sibly, creator of the 'Blitz' range of languages.

You might also like...
 Extracting frames from video and create video using frames
Extracting frames from video and create video using frames

Extracting frames from video and create video using frames This program uses opencv library to extract the frames from video and create video from ext

Telegram Video Chat Video Streaming bot 🇱🇰
Telegram Video Chat Video Streaming bot 🇱🇰

🧪 Get SESSION_NAME from below: Pyrogram 🎭 Preview ✨ Features Music & Video stream support MultiChat support Playlist & Queue support Skip, Pause, Re

Play Video & Music on Telegram Group Video Chat
Play Video & Music on Telegram Group Video Chat

🖤 DEMONGIRL 🖤 ʜᴇʟʟᴏ ❤️ 🇱🇰 Join us ᴠɪᴅᴇᴏ sᴛʀᴇᴀᴍ ɪs ᴀɴ ᴀᴅᴠᴀɴᴄᴇᴅ ᴛᴇʟᴇʀᴀᴍ ʙᴏᴛ ᴛʜᴀᴛ's ᴀʟʟᴏᴡ ʏᴏᴜ ᴛᴏ ᴘʟᴀʏ ᴠɪᴅᴇᴏ & ᴍᴜsɪᴄ ᴏɴ ᴛᴇʟᴇɢʀᴀᴍ ɢʀᴏᴜᴘ ᴠɪᴅᴇᴏ ᴄʜᴀᴛ 🧪 ɢ

Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Shorts-Tik-Tok-Creator Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Turn any live video stream or locally stored video into a dataset of interesting samples for ML training, or any other type of analysis.
Turn any live video stream or locally stored video into a dataset of interesting samples for ML training, or any other type of analysis.

Sieve Video Data Collection Example Find samples that are interesting within hours of raw video, for free and completely automatically using Sieve API

Video-to-GIF-Converter - A small code snippet that can be used to convert any video to a gif

Video to GIF Converter Project Description: This is a small code snippet that ca

Video-stream - A telegram video stream bot repo
Video-stream - A telegram video stream bot repo

This is a Telegram Video stream Bot. Binary Tech 💫 Features stream videos downl

Terminal-Video-Player - A program that can display video in the terminal using ascii characters

Terminal-Video-Player - A program that can display video in the terminal using ascii characters

camKapture is an open source application that allows users to access their webcam device and take pictures or create videos.
camKapture is an open source application that allows users to access their webcam device and take pictures or create videos.

camKapture is an open source application that allows users to access their webcam device and take pictures or create videos.

Comments
  • Function to scale value between ranges.

    Function to scale value between ranges.

    #rem wonkeydoc Scale a value from an initial range to a target range.
    @param `start1` The initial start value.
    @param `stop1` The initial stop value.
    @param `start2` The target start value.
    @param `stop2` The target stop value.
    @return The input `value` scaled from (`start1`-`stop1`) to (`start2`-`stop2`).
    #end
    Function Scale:Float(value:Float, start1:Float, stop1:Float, start2:Float, stop2:Float)
    	Return Scale<Float>(value, start1, stop1, start2, stop2)
    End
    
    #rem wonkeydoc Scale a value from an initial range to a target range (generic version).
    Remarks: `Scale:Int()` won't work, use `Float` instead and then cast to integer.
    @param `start1` The initial start value.
    @param `stop1` The initial stop value.
    @param `start2` The target start value.
    @param `stop2` The target stop value.
    @return The input `value` scaled from (`start1`-`stop1`) to (`start2`-`stop2`).
    #end
    Function Scale<T>:T(value:T, start1:T, stop1:T, start2:T, stop2:T)
    	Return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1))
    End
    
    Function TestScale()
    	Print(Scale(128, 0, 255, 0.0, 1.0)) ' about 0.50
    	For Local i := 0 To 10
    		Print(Scale<Float>(i, 0, 10, 0, 1280))
    	Next
    End
    
    opened by cos1110 6
  • gitignore - ability to ignore any new module

    gitignore - ability to ignore any new module

    This patch alows work on any new/wip modules inside the wonkey git dir. Because I want to work with an up-to-date wonkey without the need to play around with submodules.

    opened by abakobo 1
Releases(v2022.04)
  • v2022.04(Apr 5, 2022)

    Wonkey 2022-04 release

    New official Wonkey release with Wake (1.1.0) and Wide (1.0.1) built for Windows (x86/x64), Linux (x64), MacOS (x64/arm64) and Raspbian (arm32) targets.

    ⚠️ Important: After installation, we recommanded to rebuild all modules. See instructions in README.md.

    What's new

    Wonkey (language)

    • Added ascii character names enumeration (00479235f657139cd8ad76129ecddf788379ad71)
    • Added string interpolation function Fmt()(f6d7ee28c744d19a1d1e12eef2ea581b166d89cd)
    • Added each end block keywords: EndClass, EndStruct, EndInterface, EndEnum, EndProperty, EndFunction, EndMethod, EndOperator, EndLambda, EndWhile, EndFor, EndSelect, EndTry (87223e6c69b7ba7ff367b61a1979ef424efcee59, d336974d5d51a0416ec0f7ae3dca843637ca16e6)
    • Added new escape sequence for double-quote inside strings: "" (ef601719f8d3ead220bbdf1de03719c9bb82727b)
    • Added new __APPTYPE__ preprocessor variable (dd355c5a67cf788caa4a0d13385459b15bf08d6e)
    • Added keyword Do to While and For statement for writing one-liners (8b437d3c7037d5baa2f25dd31b868691b43e7b9d)
    • Added line continuation after ., ?. and -> inside identifier expressions (dc6bcd38f911c00ac8513cedf84622273d7f1228)

    Wake (transpiler)

    • Used wake 32 bits executable binary to default on Windows, 64 bits executable binary still available in bin\windows\wake64 (8ec01e4ccdb69a00fab96ed44422d9aa81745bfc)
    • Added -icon=<file> option to wake to set executable icon (b81c4d9ad9dfa9404a0f3294302ae3a4be9c6485, b0b8bb22205e68df474e9692775453e607762a73)
    • Improved missing modules check (8866bf671912025b7f6adf51b07606485848f494)
    • Added default *.products output directory
    • Upgraded Android SDK to 30 (43df90a96bd0479ff32244b668aba681b64abc9b)
    • Added wonkeydoc @image tag (d10c195714cbb5ebd912efc4fce7f1a102e13494)
    • Misc: added wake classes diagram preview and generator (b6931840b2367aefa1315d6a1d8ad84d138da029)

    Wide (code editor)

    • Fixed DebugView view (c798662f67c00162d0b70e9048cf475add129167)

    Tools

    • Added c2wx tool - experimental C header to Wonkey 'extern' convertor that uses the libclang library (see bin\windows\c2wx.txt, on Windows only) (9b42e162ea79826128ec7c26d0ee977bda92a686, a9525d32b01c100dc05ced35510c210d04106057)

    Modules

    • Added pyro game framework module - (thanks to http://www.playniax.com) (d49dec0cfa5c4f5cd7d65d5b1f784bb532a36032)
    • Added timelinefx module - particle effects (thanks to @peterigz) (92b0205e7e46fcf2af16e7d2311b0bbce7d19ea5, 97a7357f325fad51f18213fb7a55b2109caeb102)
    • Added ncurses module - (thanks to @HezKore) (47fb8fd7b70a7868f56dec3e4473873eb1e3efa4)
    • Added raylib module - simple and easy-to-use library to enjoy 2d/3d videogames programming (https://www.raylib.com) (8bf5477ad2fd863adf47324eeb26b1bcfc3996ff)
    • Added miniaudio module (experimental) - single file audio playback and capture library (https://github.com/mackron/miniaudio) (67eecb79d3f10b87f609707f15989b842391268e)

    Examples

    • Added Pakz001 2d/3d tutorials (thanks to @Pakz001)
    • Added peterigz tutorials (thanks to @peterigz)

    ...and many others fixes and stuff :)

    Thanks to @D-a-n-i-l-o, @StrangeIsMyName for these many contributions. We can all contribute to preserve and improve this wonderful programming language :).

    We still need support and help to maintain this project overtime.

    Source code(tar.gz)
    Source code(zip)
    wonkey_2022.04_linux_x64.tgz(183.58 MB)
    wonkey_2022.04_macos_arm64.pkg(178.02 MB)
    wonkey_2022.04_macos_x64.pkg(187.85 MB)
    wonkey_2022.04_raspbian_arm32.tgz(171.27 MB)
    wonkey_2022.04_windows-msvc_x64.exe(155.65 MB)
    wonkey_2022.04_windows-msvc_x86.exe(139.52 MB)
    wonkey_2022.04_windows_x64.exe(130.71 MB)
    wonkey_2022.04_windows_x64_mingw64.exe(172.83 MB)
    wonkey_2022.04_windows_x86.exe(130.15 MB)
    wonkey_2022.04_windows_x86_mingw32.exe(167.30 MB)
  • v2021.04(Apr 8, 2021)

    Wonkey 2021-04 release

    First official Wonkey release with Wake and Wide built for Windows, Linux, MacOS ans Raspbian targets.

    ⚠️ Important: After installation, we recommanded to rebuild modules

    Update 29/04/2021: Fixed msvc installer

    What's new:

    • many fixes due to rebrand
    • use default 'x64' config
    • updated 'sdl2' module to 2.0.14 official release
    • updated 'sokol' module
    • added new modules: glfw, glad, raspberry, simplevideo
    • added some @StrangeIsMyName additions
    • upgraded iOS XCode project
    • upgraded Android product template
    • upgraded Emscripten toolchain (v2.x)
    • optimize C/C++/Linker flags for stripping dead code (reduced size of executable)
    • improved auto-detection of MSVC installation
    • added new String methods : PadLeft(), PadRight()
    • and many others stuff :)
    Source code(tar.gz)
    Source code(zip)
    wonkey_linux_2021.04.tgz(115.05 MB)
    wonkey_macos_2021.04.pkg(111.99 MB)
    wonkey_raspbian_2021.04.tgz(106.67 MB)
    wonkey_windows-msvc_2021.04.exe(112.97 MB)
    wonkey_windows_2021.04.exe(95.04 MB)
Owner
Wonkey Coders
Community projects around the Wonkey programming language
Wonkey Coders
GStreamer Inspector GUI

gst-explorer GStreamer GUI Interface Tool GUI interface for inspecting GStreamer Plugins, Elements and Type Finders. Expects Python3 Qt, PyQt5 and GSt

Jetsonhacks 31 Nov 29, 2022
Telegram Video Stream

Video Stream An Advanced VC Video Player created for playing video in the voice chats of Telegram Groups And Channel Configs TOKEN - Get bot token fro

mr_lokaman 46 Dec 25, 2022
A Telegram bot to convert videos into x265/x264 format via ffmpeg.

Video Encoder Bot A Telegram bot to convert videos into x265/x264 format via ffmpeg. Configuration Add values in environment variables or add them in

1 Mar 08, 2022
High-performance cross-platform Video Processing Python framework powerpacked with unique trailblazing features :fire:

Releases | Gears | Documentation | Installation | License VidGear is a High-Performance Video Processing Python Library that provides an easy-to-use,

Abhishek Thakur 2.6k Dec 28, 2022
Splat a video into a mosaic by sampling a frame at regular intervals

Splat a video into a mosaic by sampling a frame at regular intervals. Useful for seeing the changes over time of an entire video or movie.

Ryan Fox 4 Oct 16, 2022
This plugin generates json files used by deovr allowing you to play 2d and 3d video's using the player

deovr-plugin This plugin generates json files used by deovr allowing you to play 2d and 3d video's using the player. Deovr looks for an index file /de

10 Sep 29, 2022
Python script for extracting audio from video files and creating Mel spectrograms

video2spectrogram About This package is meant to automate the process of extracting audio files from videos and saving the plots computed from these a

Alexandros Stergiou 1 Oct 28, 2021
VIT - VideoInTerminal. A quick piece of code to play videos in your terminal using python

VIT VIT - VideoInTerminal. A quick piece of code to play videos in your terminal using python.

ShellTear 3 Mar 03, 2022
Filtering user-generated video content(SberZvukTechDays)Filtering user-generated video content(SberZvukTechDays)

Filtering user-generated video content(SberZvukTechDays) Table of contents General info Team members Technologies Setup Result General info This is a

Roman 6 Apr 06, 2022
Python bindings for FFmpeg - with complex filtering support

ffmpeg-python: Python bindings for FFmpeg Overview There are tons of Python FFmpeg wrappers out there but they seem to lack complex filter support. ff

Karl Kroening 7.7k Jan 03, 2023
Techie Sneh 17 Nov 23, 2021
Automatically segment in-video YouTube sponsorships.

SponsorBlock Auto Segment [Model Download] Automatically segment in-video YouTube sponsorships. Trained on a large dataset of YouTube sponsor transcri

Akmal 7 Aug 22, 2022
Tautulli - A Python based monitoring and tracking tool for Plex Media Server.

Tautulli A python based web application for monitoring, analytics and notifications for Plex Media Server. This project is based on code from Headphon

Tautulli 4.7k Jan 07, 2023
A Telegram bot to convert videos into x265/x264 format via ffmpeg.

Video Encoder Bot A Telegram bot to convert videos into x265/x264 format via ffmpeg. Configuration Add values in environment variables or add them in

Adnan Ahmad 82 Jan 03, 2023
Python Script for Streaming YouTube Videos in VLC Media Player.

Short Description Use this Simple Script to stream YouTube Video to VLC

Sijey 6 May 27, 2021
Cvplayer - A simple video player written in python using ffpyplayer and OpenCV

Video Player cvplayer is a minimal wrapper around the ffpyplayer.MediaPlayer cla

ADI 7 Dec 19, 2022
This is an example of building a video Question-Answer system using Jina.

example-video-search This is an example of building a video Question-Answer system using Jina. The index data is subtitle files of YouTube videos. Aft

Jina AI 9 Oct 18, 2022
Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images to include in the video.

Text2Video Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images

Josh Chen 19 Nov 22, 2022
A python program which converts images and video into excel spreadsheets.

image2excel A program which converts images and video into Excel spreadsheets. Usage examples can be found in examples Videos can take a long time to

Oscar Peace 2 Aug 09, 2021
Examples of usage of GStreamer hlssink3 plugin.

Examples of usage of GStreamer hlssink3 plugin.

Rafael Carício 2 Aug 03, 2022