These are chat archives for Deskshell-Core/PhoenixEngine

19th
Mar 2015
Ingwie Phoenix
@IngwiePhoenix
Mar 19 2015 12:31
It appears that I am finally through all my illnesses!
And I learned an important word today: simultaneously. A word that goes through and through of the Phoenix Engine, since you can do many things in parallel due to being able to run worker processes of either PHP or NodeJS. Because the worker processes are actually true NodeJS processes. That stuff is gonna be fun
Ingwie Phoenix
@IngwiePhoenix
Mar 19 2015 12:38
<script>
var worker = new PhoenixEngine.PHPWorker();
worker.on("map.new", function(e){
    // e could be info about the new map being loaded
});

// Tell the worker to update a server that the player entered a room
// with coordinates x=20 and y=18.
worker.emit("room.enter", {x:20,y:18});
</script>
<?php
use PhoenixEngine;
// Otherwise this would be: PhoenixEngine\Worker.
// PhoenixEngine reserves its own namespace everywhere.
$parent = Worker::getParent();

$server = new SomeServerConnection(...);

$parent->on("room.enter", function($e){
    // The parent could also set some values and offer them to the worker.
    // In this case, update the user's position on the server.
    $server->updateRoom($e->x, $e->y, $parent->user->id);
});
just an example of what i plan
this way you can „multithread“ in the browser context.
and i plan on making the workers into shared instances. so even if your app loads a new page, they can still access the same worker by some ID
i.e.:
var worker = PhoenixEngine.PHPWorker("somefile.php", {id: "game_engine"});

// Later at some other page
var worker = PhoenixEngine.getWorker("game_engine“);
the PhoenixEngine is the main namespace for all the APIs that it offers
there is also the Chromium namespace that holds some of the ported Chromium API
Then there is the FLTK namespace and some others too
each namespace represents a library’s functions.

in C++ with FLTK, you usually would do

Fl_Window* win = new Fl_Window(100,100,"Hello World“);

But in AngelScript:

FLTK::Window win(height:100, width:100, title:"Hello World“);
and yes, angelscript has named parameters. So cool!
I was the one to make the dev add these, actually
sihorton
@sihorton
Mar 19 2015 21:36
looks brilliant! glad to hear you are feeling better.
Ingwie Phoenix
@IngwiePhoenix
Mar 19 2015 22:17
Thank you! :)
its time to get back to work and do some amazing things.