Skip to content

IppClub/dora-wa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dora SSR Wa Package

A language binding project that enables Wa-lang integration with the Dora SSR game engine.

About

This project bridges two innovative open-source projects:

  • Dora SSR: A versatile game engine designed for rapid game development across various devices. It features a built-in Web IDE that enables direct game development on mobile phones, open-source handhelds, and other devices.

  • Wa-lang: A general-purpose programming language specifically designed for WebAssembly. Wa-lang aims to provide a simple, reliable, and statically typed language for high-performance web applications.

This repo provides language bindings and a testing project to demonstrate Wa-lang's capabilities when running on the Dora SSR engine.

What's in this repo

  • Wa-lang bindings for Dora SSR engine APIs
  • Testing and Example projects demonstrating Dora-Wa integration and usage

Installation

Usage

  1. Step 1: Create a new Dora SSR game project

    • Make sure Dora SSR engine and Wa-lang compiler are installed.

    • Launch Dora SSR software and open the Web IDE in the browser.

    • In the game resource tree on the left side, open the right-click menu of the Workspace.

    • Click on the menu item New and choose to create a new folder named Hello.

  2. Step 2: Write Wa game code

    • Create a new Wa project in command line.

      wa init -n hello_dora --wasi
      cd hello_dora
    • Change the name field in hello_dora/wa.mod to init.

    • Copy the whole module from this_repo/vendor/dora to hello_dora/vendor/dora.

    • Write code in src/main.wa.

      import "dora"
      
      func init() {
          // create a sprite
          sprite := dora.NewSpriteWithFile("Image/logo.png")
      
          // create a root node of the game scene tree
          root := dora.NewNode()
      
          // mount the sprite to the root node of the game scene tree
          root.AddChild(sprite.Node)
      
          // receive and process tap event to move the sprite
          root.OnTapBegan(func(touch: dora.Touch) {
              sprite.PerformDef(dora.ActionDefMoveTo(
                  1.0,                  // duration, unit is second
                  sprite.GetPosition(), // start position
                  touch.GetLocation(),  // end position
                  dora.EaseOutBack,     // easing function
              ), false)
          })
      }
      
    • Build it into WASM file.

      wa build -optimize
    • Upload it to engine to run. From Dora SSR Web IDE, Open the right-click menu of the game resource tree on the created folder Hello. Click on the menu item Upload and choose the compiled WASM file named output/init.wasm to upload.

    • Or use the helper script upload.py with commad python3 upload.py 192.168.3.1 Hello inside your Wa project folder to upload WASM file. The IP address is the Dora SSR Web IDE address.

  3. Step 3: Run the game

    Click the 🎮 icon in the lower right corner of the editor, then click the menu item Run. Or press the key combination Ctrl + r.

  4. Step 4: Publish the game

    • Open the right-click menu of the project folder just created through the game resource tree on the left side of the editor and click the Download option.

    • Wait for the browser to pop up a download prompt for the packaged project file.

Documentation

Development Status

This project is currently in development as both Wa-lang and Dora SSR are evolving. Wa-lang is in its engineering trial stage, and we're actively working on expanding the integration capabilities.

Contributing

Contributions are welcome! Whether you're interested in:

  • Improving language bindings
  • Adding new features
  • Creating examples
  • Fixing bugs
  • Improving documentation

Please feel free to submit Pull Requests or open Issues.

License

MIT

Contact

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages