Is it possible to use some sort of GPS in Construct 2 games?

Get help using Construct 2

Post » Mon Feb 02, 2015 10:59 pm

Sorry, another weird question here. This should be the last one though. It's been an interest of mine for a while to create a social game. When you play online games, typically you battle other players who are in other states or possibly even other countries. While this is all fine and dandy, often times you don't really establish relationships with these people or have memorable experiences. Of course there are stories of people meeting in WoW and becoming best friends or getting married, but those stories are few and far between. The majority of people playing those games don't really end up being best friends. They log in, play one or two hours, and log back off.

However, I'm sort of searching to solve that issue by creating a multi-player RPG where the only way to level up and progress through the game is through local PvP. Meaning, you can battle other players, but only if the player is nearby. Is there a way to, for example, create a system that simply gathers the location of the players and causes them to appear on the game screen as a little dot ( or any sprite )? That way, for example, a player could walk into a McDonald's. His phone vibrates, and it's an alert from my game telling him another player is in the vicinity. Then he can tap on that player's sprite on the map and challenge him to a battle, and an alert is also sent to that other player.

I noticed this: https://www.scirra.com/manual/164/geolocation but didn't really see a way for the game to detect other people's location ( just your own ) or maybe I'm just reading it wrong.
B
4
Posts: 22
Reputation: 246

Post » Mon Feb 02, 2015 11:29 pm

I can think of two ways this would be implemented in general, not necessarily with Construct 2.

1. Use bluetooth to discover and communicate with nearby devices. Construct 2 can't do this as far as I'm aware, and I'm unsure of the feasibility of writing a plugin for it.

2. Setup a remote server to exchange data. Every X units of time(5 seconds, perhaps) the player's device polls the service, including their own location with the request. The server takes that location and responds with a list of nearby players and their info. At this point there are a couple things you could do:

2(a). Open a direct connection to nearby players using websockets and bypass the server once contact is initiated.

2(b). Have the two clients communicate through the server, sending actions to the server as they happen and frequently polling the server for the latest actions of the other player. This would preclude the possibility of fast paced games.

Construct 2 should have everything you need to allow for either of the methods(a and b) outlined in option 2. Just know that this opens a can of worms concerning privacy, as user data -- likely non identifying, of course -- has to be shared with and persisted on a server somewhere, even if only briefly. The fact that we're talking location data here makes the issue especially touchy.

Actual implementation details would be complicated and depend a lot on what you ultimately want to do, so I'm just going to leave you with the general overview above. Hopefully that pushes you in the right direction, though.
Moderator
B
104
S
39
G
19
Posts: 1,584
Reputation: 18,167

Post » Mon Feb 02, 2015 11:49 pm

Totally forgot about bluetooth. That'd make things super easy I'd imagine. Pretty interesting, I'll do some more research. Thanks.
B
4
Posts: 22
Reputation: 246


Return to How do I....?

Who is online

Users browsing this forum: makkancs, olympo, Rudi55 and 6 guests