PlayerIO (On Hold) (Flash)

rob1221

  • *
  • Posts: 9419
Note: this extension is on hold (and potentially cancelled) due to the existence of the Nuggeta extension.

I started an extension for PlayerIO, for now just using the database service but PlayerIO does support Flash multiplayer.  Here is an explanation of the blocks so far:

Connect to PlayerIO (GameID: %0 ConnectionID: %1 UserID: %2 AuthText: %3 PartnerID: %4 ErrorCode: %6)
The first 5 parameters are all text.  GameID is the ID that you get from PlayerIO when you create a game page there.  Connection ID should be "public" unless you set up something different in the settings.  UserID identifies the player.  AuthText is probably a user password but I'm not sure; you can leave it blank.  I don't know what PartnerID is and you can leave that blank too.  ErrorCode is the code you execute when an error happens.  Codewise, it acts like a wrapper, but of course you can't put action blocks there.  I suggest either putting trace(error); in there or calling your own function or custom block.  The missing %5 in the above block entry is the wrapper itself, and that is the code you want to execute when the PlayerIO connection is successful.

Create Object (Table: %0 Key: %1 Data: %2 ObjectID: %3 ErrorCode: %5)
Table and Key are text parameters, and the values are based on what you set up in PlayerIO's BigDB service.  Data is an object that contains key-value pairs inside curly braces (like JSON I believe).  The ObjectID is an optional parameter that just changes the variable name of the object passed through to the wrapper (the default is obj).  ErrorCode is the same as before.  The code you put in the wrapper is executed when the object creation succeeds.

Load Object (Table: %0 Key: %1 ObjectID: %2 ErrorCode: %4)
This block is like the Create Object block except you're downloading an object rather than uploading.  The parameters work the same.

Load Range (Table: %0 Index: %1 Path: %2 Start: %3 Stop: %4 Limit: %5 ObjectID: %6 ErrorCode: %8)
The last block is used for loading a single object, but this one is used for loading multiple objects returned as an Array.  You can't use this block until you set up an index in your table, which is basically a way of sorting your objects based on their properties.  Index is the name of your index.  Path is an Array of objects that determine where to start the range search.  Set to null if you have only one property in your index.  Start and Stop are objects that limit the minimum and maximum range of the values loaded.  Limit is the maximum amount of objects to return.

I know I didn't explain these as well as I should, but that's because I've just started and only know some basic things.  Check the PlayerIO reference for more information: http://playerio.com/documentation/reference/actionscript3/

« Last Edit: May 26, 2014, 03:42:02 pm by rob1221 »

GeorgeN

  • Posts: 859
The future is looking good.

Thanks Rob!

havana24

  • *
  • Posts: 501
Oh, I had not see this post, great work!  :)
So with this we can for example make our own leaderboard, right?
My Website: www.havana24.net

rob1221

  • *
  • Posts: 9419
Yes, you could do that.

rob1221

  • *
  • Posts: 9419
Update: I started looking into the multiplayer service, but the problem is that server-side code is required, unlike the BigDB service.  Since I don't know C# and am not currently interested in making a multiplayer game, I'm not going to work on the multiplayer service.  Even if I did learn some C#, it wouldn't be useful because any user of the extension would have to learn C# anyway.

jcjunglebob

  • Posts: 20
It would be useful to us who know C# but not flash =P

But on a serious note, maybe put it out there so someone can continue it, as people are always interested in multiplayer games, and very few of these kinds of engines even attempt it.  I know it is not simple, but even having a lead-in to having your users learn to write server code is better than nothing at all.

PlayerIO server code was pretty simple too if I recall.  Just switch statements and string args.

gamegirlxl

  • Posts: 716
Hmmmmmmmm........This seems very promising, and reminds me of Firebase, except Firebase hates Flash.

Would it be possible to have a server "game", written in Stencyl, that moderates what is written on the database?

rob1221

  • *
  • Posts: 9419
I don't think that would work.

gamegirlxl

  • Posts: 716
I don't think that would work.

Why?  Am I misunderstanding the purpose of PlayerIO, or is it just something generally improbable?

rob1221

  • *
  • Posts: 9419
Stencyl isn't for server-side code.

gamegirlxl

  • Posts: 716
Stencyl isn't for server-side code.

So I couldn't run a game that sorts numbers it downloaded from the server and posts them back to the server?  I would call it the Leader board game.

SadiQ

  • Posts: 1778
So I couldn't run a game that sorts numbers it downloaded from the server and posts them back to the server?  I would call it the Leader board game.

So where's the SERVER SIDE code in that? You only mentioned things that Stencyl can do, and that has nothing to do with the server.

The server side of things in such a game would involve generating the numbers and letting Stencyl access those numbers.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

gamegirlxl

  • Posts: 716
The server side of things in such a game would involve generating the numbers and letting Stencyl access those numbers.

Surprise Twist: Those numbers just happened to be submitted scores from a REAL (hypothetical) game, which allows you to submit your score... :o :o :o  You CAN do some "server side" stuff with Stencyl, except only when time is not a factor!

rob1221

  • *
  • Posts: 9419
What are you talking about?  Server side means run on a server.  Stencyl isn't intended for that purpose, and I don't even know if that's possible (maybe for the desktop export but I don't know).

Jon

  • *
  • Posts: 17523
I think this is a difference of semantics. Server code is meant to be code literally run remotely on a server. Making HTTP requests to a remote server isn't considered to be "server code" even though it is networking in a really broad sense.