Firebase

gurigraphics

  • Posts: 688
Extension completed. Topic updated.

havana24

  • *
  • Posts: 504
Amazing!
This extension could be used to create real time multiplayer videogames?
There is no chance to get this extension ported to iOS and Android?

Great work! :)
My Website: www.havana24.net

havana24

  • *
  • Posts: 504
I've tried to load the .zip file of the extension into Stencyl but I don't see it into the extension tab...  ???
I'm using build 8742.
My Website: www.havana24.net

gurigraphics

  • Posts: 688
Quote
This extension could be used to create real time multiplayer videogames?

Yes. Firebase is a sophisticated and proprietary implementation Websockets NoSQL.There was no queue of requests. They are all simultaneous. A single professional would not be able to do something with similar performance.

In my tests the requests takes only 200ms.

Now, warning for adventurers, to create a multiplayer game, even simple, it takes at least a 3-year experience in the creation all kinds of games. Because it is "tremendously complex" handle so much data without a project very well organized.


Quote
I've tried to load the .zip file of the extension into Stencyl but I don't see it into the extension tab...  ?? I'm using build 8742.

Here also occurs this error. Perhaps by file date. I not checked.

What I did to solve was copying the code to "test extension".


Quote
There is no chance to get this extension ported to iOS and Android?

Certainly. But i just understand the basics of haxe. So i used just to Flash.

Now to use in HTML5 I do Haxe ignore the javascript code in compile:
Code: [Select]
untyped __js__('

javascript code...

');

So if you use Intel XDK you can carry html5/js to iOS, Android and Windows Universal Apps.

However, the performance will be about 10x lower than that of native code. What would be bad for a No-Turn-based Multiplayer Game or any other very heavy game. It is as bad as games made with Construct. ^ ^

So I do not recommend it. This generates just headache, negative marketing, negative reputation, expenses and lost time with support in their games. Best wait for a professional solution.

havana24

  • *
  • Posts: 504
200ms? Seems Amazing! :)
I want to test this with a simple game to see how well it work!

What I did to solve was copying the code to "test extension".

Umh, this is a bug of Stencyl? Where I cn get the test extension file?

Thakns again! :)
Alessandro
My Website: www.havana24.net

gurigraphics

  • Posts: 688
Quote
Umh, this is a bug of Stencyl?

No. It must have been a problem with BOM encoding .

Quote
Where I cn get the test extension file?
Debug-> View-> View Workspace Folder -> Stencylworks -> engine-extensions -> test

But, I already solve the problem.
I will update there.

Edit: I forgot to change the class name. Now OK.

« Last Edit: November 03, 2015, 08:52:28 am by gurigraphics »

havana24

  • *
  • Posts: 504
Thanks!

Could you explain a little more about the extension?

For example, I have this tree in Firebase:


How could I edit this 4 fields? How to edit only one of them? And how to get data from all or a single stored in an attribute?
Basically I didn't understand what are supposed to be the "memory slots" you have created...

I'm coming from web development and I'm used to refer to MySQL database with the name of the table and the name of the columns...
There is something here that I don't get. :(

Thanks in advance,
Alessandro
My Website: www.havana24.net

gurigraphics

  • Posts: 688
The blocks appeared but are not working. When I have time try to fix it.

I will try to eliminate the update blocks. And make only blocks Get and Post as php.

Memory slot is an variable de memory rom in database.

If you do post with block: POST_INT_01 = 100;
The block UPDATE_INT_01 makes the global variable INT_01 = 100.
And INT_01 can be used to score, points, life, etc.

Very simple.

Nosql you do not need to create tables. The post itself creates the table.
You only need the Firebase address. No need to configure anything.

I have not used "update" in this extension. The data are always replaced and are saved in:
Code: [Select]
https://link.firebaseio.com/str_01
https://link.firebaseio.com/str_02
and so on.

There are 24 variables. If you use JSON and JSON parse, a single of these variable is sufficient.



About firebase...

FIREBASICS

FIREBASE ADDRESS
Code: [Select]
var url = new Firebase("https://link.firebaseio.com/");
var usersRef = url.child("users");
var x = 0;
var y = 0;
var speed = 0;
POST
Code: [Select]
usersRef.set({
 
    player01: {       
    x: x,
    y: y ,
    speed: speed,
    },
    player02: {       
    x: x,       
    y: y,
    speed: speed,
    }

});
UPDATE
Code: [Select]
usersRef.update({
  "player01/x": x,
  "player01/y": y,
  "player01/speed": speed,
  "player02/x": x,
  "player02/y": y,
  "player02/speed": speed,
});
GET
Code: [Select]
usersRef.child("player01/x").on("value", function(snapshot) {

  x = snapshot.val();

});
TREE



https://www.firebase.com/docs/web/quickstart.html

« Last Edit: November 03, 2015, 07:14:39 pm by gurigraphics »

havana24

  • *
  • Posts: 504
The blocks appeared but are not working. When I have time try to fix it.
So the extension doesn't work right now? I will wait till you'll fix the problem! :)
Thanks for the explanation, it is something different than a normal database!

All the code you wrote works if you put them into the "code block" of Stencyl?

And how about JSON parse? What is the way to encode and decode in stencyl?

Hope to not bother yo too much, thanks again! :)
My Website: www.havana24.net

gurigraphics

  • Posts: 688
The new blocks are ready.



Lack the "fruit salad": Haxe-> Flash-> Javascript

Quote
All the code you wrote works if you put them into the "code block" of Stencyl?

No. Blocks  execute functions and excerpts from a classe.hx

Quote
And how about JSON parse? What is the way to encode and decode in stencyl?

I do not recall of memory. This has in somewhere forum.

Quote
Hope to not bother yo too much, thanks again! : )

We are here to learn. ^^


« Last Edit: November 04, 2015, 03:28:50 am by gurigraphics »

havana24

  • *
  • Posts: 504
Ok thanks! :)
You have updated the attachment on the first post?
My Website: www.havana24.net

gurigraphics

  • Posts: 688
Yes. But it's the same version.

When I upgrade I will use this template.
http://community.stencyl.com/index.php/topic,30433.0.html

havana24

  • *
  • Posts: 504
Ok, so you didn't updated with the new blocks yet, but the extension now works with the "old" blocks?
Just to know if I can start trying it! :)

My Website: www.havana24.net

gurigraphics

  • Posts: 688
I did only the blocks in haxe. Missing the rest of the code. Tomorrow will be ready.

The first page I updated yesterday. But the code does not more works.

havana24

  • *
  • Posts: 504
My Website: www.havana24.net