WOWCube Docs logo
WOWCube Docs
Mission Control
Section Shortcuts
APIExamplesSourceWOWConnectChangelog
Filters
SDK and language defaults persist in cookies.
SDK version
Navigation Tree
Collapsed by default, focused on the active path.
Made byMcKay Seamons
GitHub
  1. Home
  2. Docs
  3. Examples
  4. Working with Emulator
Mission NodeSDK 6.1PawnbasicsProject Included

Working with Emulator

WOWCube device emulation An emulator is software application that enables one computer system (called the host) to act like another computer system (called t...

Examples / SDK 6.1 / Pawn / basics

WOWCube device emulation

An emulator is software application that enables one computer system (called the host) to act like another computer system (called the guest).

Emulation refers to the ability of a computer program to imitate another program or device.

WOWCube emulator is an essential part of WOWCube Development Kit.

Along with WOWCube SDK, this application allows to create and run cubeapps right on your development computer without the need of uploading them each time to a physical WOWCube device.

It also provides a set of useful features for controlling emulated device parameters and seeing how fast your application runs.

But the most useful feature of the emilator is a console.

WOWCube emulator provides eight independent output consoles for each module of the device. The cubeapp that runs on module can print to the output console at practically any moment of its runtime.

The console

Printing to the console is done via logging functions with different verbosity levels:

Function nameVerbosity level
LOG_a(...)Assertion
LOG_e(...)Error
LOG_w(...)Warning
LOG_i(...)Information
LOG_d(...)Debug

The following placeholder codes are supported:

PlaceholderDescription
%cprint a charater
%dprint an integer value (in decimal radix)
%f,rprint a floating-point value in normal (fixed-point) notation
%q,rprint a fixed-point value
%xprint an integer value (in hexadecimal radix)
%sprint a null-terminating string buffer
%print a percent character)

You may optionally put a number between the % and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces.

Current version of WOWCube emulator does not support coloured output to console

The example

To demonstrate how the console may come in handy, we will take the Time and Timers example and change it slightly.

As in the previous example, the cubeapp will be counting ticks and seconds. This time, however, the values will be seen in the console, and not on the screen.

Why would we want to do that?

Well, the answer is simple: not everything that you may have in your cubeapp app can be rendered on screens. Surely, there will be some variable that you may want to make visible on the screen during the whole time of gameplay.

But what about others, tens of others variables that you may have as well?

How do you know what variable gets what value in a given moment of time? (remember there is no debugger)

Of course, you can print them out to a console! Print them as much as you want, with or without any texts, everything that you need to see.

So let's do some printing...

ON_Init() callback is modified the way we can see when it is started and when it is finished.

The SELF_ID built-in variable is used to read the number of a module and print it out too. You will see different module numbers printed by cubeapps that run on different modules.

Working with Emulator
PAWN
1public ON_Init(id, size, const pkt[])
2{
3 LOG_i("\n");
4 LOG_i("*** WOWCube SDK Example \"Working with Emulator\" ***\n\n");
5
6 LOG_i("Cubeapp is initializing...\n");
7 LOG_i("Cubeapp is started on module %d\n",SELF_ID);
8
9 previousTime = getTime();
10
11 timer.delay = 1000;
12 timer.time = previousTime;
13
14 LOG_i("Done.\n");
15}
16
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

Now, as we know, the logic of any cubeapp is processed in ON_Tick() callback. So let's change it too:

Working with Emulator
PAWN
1public ON_Tick()
2{
3 ...
4 LOG_i(" Seconds passed: %d (integer value)\n",seconds);
5
6 LOG_i(" Current FPS: %q (fixed point value)\n",fps);
7
8 strformat(stringBuffer, sizeof(stringBuffer), true, "%d ms", deltaTime);
9 LOG_i(" Delta time: %s (string)\n",stringBuffer);
10
11 LOG_i(" Delta time in HEX: 0x%x (hexadecimal value)\n\n",deltaTime);
12 ...
13}
14
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.

This will make the cubeapp printing a block of text and values on timer. Pay attention each value has different type: we print out an integer value, a fixed point value, a string and a hex.

As a result, you should see the following output to all eight consoles in the WOWCube emulator:

Working with Emulator
PAWN
1*** WOWCube SDK Example "Working with Emulator" ***
2
3Cubeapp is initializing...
4Cubeapp is started on module 0
5Done.
6Seconds passed: 1 (integer value)
7Current FPS: 0.386 (fixed point value)
8Delta time: 2593 ms (string)
9Delta time in HEX: 0xA21 (hexadecimal value)
10
11Seconds passed: 2 (integer value)
12Current FPS: 58.824 (fixed point value)
13Delta time: 17 ms (string)
14Delta time in HEX: 0x11 (hexadecimal value)
15
16Seconds passed: 2 (integer value)
17Current FPS: 58.824 (fixed point value)
18Delta time: 17 ms (string)
19Delta time in HEX: 0x11 (hexadecimal value)
20
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Project files

main.pwn
project/src/main.pwn
wowcubeapp-build.json
project/wowcubeapp-build.json
Jump Grid

On This Page

WOWCube device emulationThe consoleThe example
Context Rail

Related nodes

info.json
Examples / SDK 6.1 / Pawn / basics / Working with Emulator
main.pwn
Examples / SDK 6.1 / Pawn / basics / Working with Emulator / project / src
wowcubeapp-build.json
Examples / SDK 6.1 / Pawn / basics / Working with Emulator / project
Getting Started
Examples / SDK 6.1 / Pawn / basics
Previous Node
wowcubeapp-build.json
Examples / SDK 6.1 / Pawn / basics / Time and Timers / project
Next Node
info.json
Examples / SDK 6.1 / Pawn / basics / Working with Emulator