Forum BigDB Serverside single player?

Discussion and help relating to the PlayerIO database solution, BigDB.

Serverside single player?

Postby Assonero » July 3rd, 2011, 6:41 pm

Hi to all, i have a noob question:

I can use the Serverside code for a single player game (every player plays on his personal world)?

i have to generate random numbers (server side)... but i dont see and example of serverside for a single player game.

I dont want the client side to generate numbers and/or save on the DB, because is not a trusted environment.


I have to use a multiplayer code server side and make the player create a room where he is the ONLY player?


another noob question:

i see that the limit is 500Kb for playerObject in the DB.... but if i save example:

i save 1 variable Integer ... that has value 50054721. has the size of 4 bytes?
if i save same variable integer , that has value 24.. has the same size of 4 bytes?

thanks for both questions
best regards
Assonero
 
Posts: 15
Joined: June 21st, 2011, 10:22 pm

Re: Serverside single player?

Postby Henrik » July 3rd, 2011, 10:37 pm

Of course you can make a single-player game that uses serverside code, just don't pass messages between players and that's it. If you want to you can put each player in a separate room, but you could just as well just use service-rooms and have several players in each room. It doesn't matter.

Yes, an integer is always 4 bytes, but the bytesize of a BigDB object depends on the names and layout of the properties as well.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Serverside single player?

Postby jasonMcIntosh » July 8th, 2011, 5:08 pm

Henrik wrote:the bytesize of a BigDB object depends on the names and layout of the properties as well.

Could you give an example to clarify what you mean, please?
Jason McIntosh
Otherwhere Gameworks
jasonMcIntosh
 
Posts: 81
Joined: February 25th, 2011, 4:51 am

Re: Serverside single player?

Postby Henrik » July 8th, 2011, 5:20 pm

The serialized version of the object

Code: Select all
{
    foo:"bar"
}

Is 24 bytes smaller than the serialized version of the object
Code: Select all
{
    thisisaverylongpropertyname:"bar"
}

...because the property names are of course part of the serialized object.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Serverside single player?

Postby jasonMcIntosh » July 8th, 2011, 6:55 pm

Aha, gotcha. I thought you might have meant the primitive type size would change under some circumstances. Thanks for the clarification.
Jason McIntosh
Otherwhere Gameworks
jasonMcIntosh
 
Posts: 81
Joined: February 25th, 2011, 4:51 am

Re: Serverside single player?

Postby Assonero » July 8th, 2011, 7:15 pm

So, to clarify all:

cip = "bar" has the same size of
cip = "ifjsaidjfoasdnfkjasndfkjandfklnfka" , right?


but


cip= "bar" is littler than
vaiovaiosicoiocaioi = "bar"


is right?
Assonero
 
Posts: 15
Joined: June 21st, 2011, 10:22 pm

Re: Serverside single player?

Postby jasonMcIntosh » July 8th, 2011, 7:32 pm

You got the second part right. :)

But the property names are part of the DB object, so:

Code: Select all
myVar = "abc"
myOtherVar = "abc"


"myVar" is smaller than "myOtherVar" in the DB since one has a longer name. So, the size will be different based on the name as well as the value of the property.
Jason McIntosh
Otherwhere Gameworks
jasonMcIntosh
 
Posts: 81
Joined: February 25th, 2011, 4:51 am

Re: Serverside single player?

Postby Henrik » July 8th, 2011, 7:44 pm

Assonero wrote:cip = "bar" has the same size of
cip = "ifjsaidjfoasdnfkjasndfkjandfklnfka" , right?

Nope.

It's very simple, the only thing that isn't part of a serialized DatabaseObject is the key, everything else goes into it, data, arrays, property names, strings, everything.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Serverside single player?

Postby Assonero » July 8th, 2011, 7:47 pm

ok, understood.

i have a question, that has nothing to do with this....

i can create persistent rooms by server?

example, each day the server observe the Db of PlayerObjects.

for each 200 objects in that Db... the server automatically create a room that will be always there for people that will join later.

each day do this, adding each day a room or more rooms following the playerobjects in the DB.

is possible?
Assonero
 
Posts: 15
Joined: June 21st, 2011, 10:22 pm

Re: Serverside single player?

Postby Henrik » July 8th, 2011, 10:03 pm

No. Rooms can only be created from a client, and they'll only stay around as long as there are clients connected to it. Rooms close when the last player disconnects from it.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Serverside single player?

Postby Assonero » July 8th, 2011, 10:38 pm

....

and how i can do if i want a room always open for people to join? ...

the maximum number of people connected to the same room is 45?
Assonero
 
Posts: 15
Joined: June 21st, 2011, 10:22 pm

Re: Serverside single player?

Postby jasonMcIntosh » July 8th, 2011, 11:58 pm

Sounds like you want to use "service rooms." Look at the docs for details (see the Create and Join Room section).
Jason McIntosh
Otherwhere Gameworks
jasonMcIntosh
 
Posts: 81
Joined: February 25th, 2011, 4:51 am


Return to BigDB