Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

877292 Posts in 32856 Topics- by 24294 Members - Latest Member: RopeDrink

May 19, 2013, 04:32:05 AM
TIGSource ForumsCommunityCompetitionsVersus (Moderator: Melly)Networking Solutions or: How Do I Play Over The Tubes?
Pages: 1 ... 3 4 [5] 6 7
Print
Author Topic: Networking Solutions or: How Do I Play Over The Tubes?  (Read 14072 times)
mewse
Level 5
*****



View Profile WWW
« Reply #60 on: January 19, 2011, 03:19:05 AM »

I like the bold section

I should have put it up at the top of my post, instead of buried in the middle!  XD
Logged
John Sandoval
Level 10
*****


white mage


View Profile WWW
« Reply #61 on: January 19, 2011, 03:25:03 AM »

There's always the Edit button.  Wink

And thanks a bunch for the tips, by the way.
Logged

brog
Level 7
**



View Profile WWW
« Reply #62 on: January 19, 2011, 07:17:59 AM »

An idea: allow a game to notify Twitter when a new game is hosted.  Then people can follow it and know when someone wants to play, to try to fix the usual emptiness of servers for indie multiplayer games.
I don't know if this idea is good or not because I haven't used Twitter.  Would people use something like this?
Logged
Pirate Hearts
Level 5
*****


PostCount++;


View Profile WWW Email
« Reply #63 on: January 19, 2011, 07:48:30 AM »

An idea: allow a game to notify Twitter when a new game is hosted.  Then people can follow it and know when someone wants to play, to try to fix the usual emptiness of servers for indie multiplayer games.
I don't know if this idea is good or not because I haven't used Twitter.  Would people use something like this?

I like that idea. The other option would be to let the game access a player's own Twitter feed, but that could get spammy and annoying for followers who aren't interested in the game. Keeping all that spam on a single Twitter feed for the users who do care would be a lot cleaner.

It used to be fairly easy to access the Twitter API back when they allowed basic authentication. They switched over to OAuth last year, though, and it's somewhat more complicated now. Details here: http://dev.twitter.com/pages/basic_to_oauth
Logged

Riley Adams
Level 5
*****


I don't actually use Ubuntu much...


View Profile
« Reply #64 on: January 19, 2011, 09:09:43 AM »

<snip for quote size...>

In C, here's how I'd do it:

float myValue = 2.0f;
uint32_t myPretendIntegerValue = *(uint32_t*)&myValue;
uint32_t myByteSwappedValueForSending = htonl(*myPretendIntegerValue);


Then to convert back on the other side:

uint32_t *myPretendIntegerValue;
uint32_t myReceivedByteSwappedValue = <whatever I received>;
myPretendIntegerValue = ntohl(myReceivedByteSwappedValue);
float myValue = *(float*)&myPretendIntegerValue;


At this point, 'myValue' now contains the transmitted floating point value.  At all times when the float was byte-swapped, its bytes were being stored inside a 32-bit integer, which kept it from ever being loaded into a float register and thereby becoming invalidated.  Yay, complicated!  But you'll find that there are no standard network functions for manipulating floats, so this is pretty much the best I've been able to come up with..

Thanks! Beer! that really helps.
Logged

Sos
Level 8
***


[cluck]


View Profile WWW Email
« Reply #65 on: January 19, 2011, 10:31:03 AM »

Typeless define for endian conversion GO!
Code:
#define SWAP_HL(v) \
  __asm { \
    mov eax,v; \
    bswap eax; \
    mov v,eax; \
  }

This should work for any 32bit value.  Wizard
Logged

Will Vale
Level 4
****


will@secondintention.com
View Profile WWW Email
« Reply #66 on: January 19, 2011, 03:18:17 PM »

Big-endian is the defined network format (and has been for decades).

Code:
uint32_t myPretendIntegerValue = *(uint32_t*)&myValue;

Great advice on byte order, but watch out for that cast if you compile with strict aliasing turned on.

A so-called union cast is safer and should work on all current compilers, or for complete peace of mind read/write through a char pointer, which is allowed to alias (and makes sense when doing Endian swaps anyway...)

http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html

Cheers,

Will
Logged
Sos
Level 8
***


[cluck]


View Profile WWW Email
« Reply #67 on: January 19, 2011, 03:28:04 PM »

Typecasting is bullshit, use the asm! No types, no worries!
Logged

xhunterko
Level 1
*



View Profile WWW
« Reply #68 on: January 21, 2011, 02:08:58 PM »

Hi all!

While I'm obviously not participating in this contest, I have been interested in multiplayer gamers recently. Through out my tedious searches on finding not much, I stumbled up this a while back. This is:

http://flixel.org/forums/index.php?topic=2636.0

Note I have yet to test it out myself and see if it can work for me. But you all are smart people and I know that one or some of you will get it working. Source to game and server/client stuff are in a thread link.

Have fun!
Logged

Woodwolf
Level 1
*



View Profile WWW
« Reply #69 on: January 22, 2011, 05:01:46 AM »

Has anyone considered Google App Engine's Channel API? http://code.google.com/intl/es-ES/appengine/docs/python/channel/overview.html

Apparently it's only a matter of configuring sockets and then sending a message to the server, which channels it to other clients. Wouldn't that satisfy the needs of a basic 1vs1 networked game?
Logged

Sanojian
Level 1
*



View Profile
« Reply #70 on: January 22, 2011, 11:05:36 AM »

Has anyone considered Google App Engine's Channel API? http://code.google.com/intl/es-ES/appengine/docs/python/channel/overview.html

Yes I am using it for Uncivil and I plan to support 6 players per game with multiple simultaneous games.  So far so good.  If anyone has any questions about it, ask away.
Logged
xhunterko
Level 1
*



View Profile WWW
« Reply #71 on: January 22, 2011, 12:19:46 PM »

Well, I would ask if you would show how to use it with a flixel game but that wouldn't be fair since I'm not participating. Though it might be useful for other people using flixel (if any) in the compo.
Logged

Sanojian
Level 1
*



View Profile
« Reply #72 on: January 22, 2011, 12:48:02 PM »

Well, I would ask if you would show how to use it with a flixel game but that wouldn't be fair since I'm not participating. Though it might be useful for other people using flixel (if any) in the compo.

Hmm, I am not a Flash developer so I can't answer definitively but you should be able to use a Javascript-Flash connection API (like this) to pass the messages on.  Channel API is a javascript API.  It is an implementation of Comet (Ajax in reverse).
Logged
Woodwolf
Level 1
*



View Profile WWW
« Reply #73 on: January 22, 2011, 03:12:40 PM »

Yes I am using it for Uncivil and I plan to support 6 players per game with multiple simultaneous games.  So far so good.  If anyone has any questions about it, ask away.

Isn't the connection synchronous? Or does it depend on your local socket implementation? I would like to dig a little bit more in that API. Do you know any good example, something more complex than the Tic-Tac-Toe tutorial? Something more 'real-time' : )
Logged

Sanojian
Level 1
*



View Profile
« Reply #74 on: January 22, 2011, 04:55:33 PM »

Isn't the connection synchronous?  I would like to dig a little bit more in that API. Do you know any good example, something more complex than the Tic-Tac-Toe tutorial? Something more 'real-time' : )

Synchronous meaning that the script needs to halt to wait for an answer?  No.  It is event-driven. 

Or does it depend on your local socket implementation?

It does not require HTML5 websockets or any special browser add-ons either.  I believe that under the hood it is a regular HTTP connection that remains open.  Google's magic API then uses XMPP to pass the data.  It is one-way, so you need to pass data from the client via Ajax POSTs.

Do you know any good example, something more complex than the Tic-Tac-Toe tutorial? Something more 'real-time' : )

I am afraid it is a pretty new API.  Not many examples out there.  I used the Tic-Tac-Toe example to get started.
Logged
Pages: 1 ... 3 4 [5] 6 7
Print
Jump to:  

Theme orange-lt created by panic