Jump to content

  • Log In with Google      Sign In   
  • Create Account

Rarosu

Member Since 16 Jun 2010
Offline Last Active Sep 26 2014 03:39 AM

Posts I've Made

In Topic: WebRTC for peer to peer multiplayer?

22 September 2014 - 02:54 PM

Great info and links, Sean! I'll definitely have a read through them, it is more information than I've found previously and it's nice to get something substantial on the subject. I'm considering using WebSockets or something for the connection to the central web server, since it is already suitable for that purpose. WebRTC is the option I'm considering between the browsers when game state data needs to be distributed. I'll read up on the protocol and see what it can offer though, and try out some implementations and see what works and what doesn't.

In Topic: WebRTC for peer to peer multiplayer?

22 September 2014 - 12:16 PM

My plan is to make a co-op platformer/action game for a small group of people, so the cheating aspect is hopefully not too relevant in this case, even though I think it is possible to solve if one of the clients are acting server.

My current idea is to use the server as a broker of kind. Let one of the clients (the host) create the game via a web form. The server will generate a random hash and send it back in the URL of the response. The host can send the URL to any player they wish to invite. A peer that connects with the URL will be matched by the server with the host that is associated with the given hash. The server will respond with the connection details to the host, and the peer can connect to the host.

It /feels/ straightforward and I'm going to experiment with it, but I'm not sure if I'm on the right path here.

I'm mostly looking to alleviate the web server of having to mirror all the game messages and instead only focusing on the whole setting up the connections. The latency of the game itself will be another challenge :D

In Topic: [SFML] random number generator

17 December 2010 - 11:06 PM

You probably do not want to seed the random number generator with GetElapsedTime(). This function will give you the time since the application has started, which should be approximately the same number every time.

Instead, you could use:

#include <iostream>
#include <time>
#include <SFML/System.hpp>

int main(int argc, char**argv)
{
sf::Randomizer::SetSeed(time(NULL));
int _random = sf::Randomizer::Random(0,100);

std::cout << _random << std::endl;

return 0;
}


.. which would give you the number of seconds since 1970, and is always unique.

Hope it helps, cheers!

In Topic: Is there a way to calculate interior angles of a triangle with side lengths?

16 June 2010 - 10:40 PM

Hi,

You should be able to solve this problem using the rule of cosine first and then the rule of sine. The rule of cosine can be used to get one of the angles, by knowing two sides, and then you can use the rule of sine to get the rest of them.

Hope this helps and that you solve your problem. Cheers! - Rarosu

PARTNERS