Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6733983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:50:06+00:00 2026-05-26T10:50:06+00:00

I coded a bomberman application that uses a gamekit peer to peer connection. The

  • 0

I coded a bomberman application that uses a gamekit peer to peer connection. The problem is that after a while the game isn’t in sync anymore.

I looked at the sample code for GKTanks and used their model. There is no client/server relation between peers so I didn’t use one in my game. Both peers maintain a gamestate which they update based on received data.

I have a NSTimer that’s used for running the gameloop at each frame. The NSTimers aren’t in sync so sometimes the gamestates become different ex: players pick up a powerup at approximately the same time and they both get the powerup because it takes a while to send data.

I would appreciate any idea on making the app work. I’m thinking of rewriting the code to use client-server but I’m not sure if it’s a good idea… yet

Thank you!

EDIT: I changed the code such that a random player is picked to be the host.
Every time a player places a bomb he asks the server where to place it. The server returns the players position(as seen on the server) and then tells the player where to place the bomb.

For powerups the server checks if a player picked up a powerup and if he did it sends a packet informing him.

Another problem has appeared now. The latency between devices is high(I’m using a bluetooth connection). It takes around 0.2 seconds to place a bomb after the client tapped the button to place it.

I’m sending all data reliably. Am I doing this right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:50:06+00:00Added an answer on May 26, 2026 at 10:50 am

    Well preferbly you want a host-client relationship where only the host can manipulate the game state, so in your case it would be:

    Both players rush to the powerup.
    Host picks it up first.
    It gets registered and the host recieves the power-up.
    Meanwhile player#2 also picks up the power-up, sends the action to the host.
    The host informs player#2 that the power-up is already disappeared.

    The thing with your situation you are bound to get desynchs from packet loss.
    With host-client relationship that cannot happen, the only problem is the host always has an advantage that becomes greater when the latency increases between devices especially on smartphones.

    In a game like bomberman it’s perfectly plausible to send the entire gamestate each time something changes instead of the action that was performed, this is to ensure both devices are in sync.

    To sum it up: both users have their gamestate but only the host can manipulate both.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have coded he application that automatically submits the data on other 200 sites.
I coded for doubly linked list implementation in C. In that, after making insertion
I coded up 4 .java files. The thing is that I can only execute
I coded a php page that displays information from a mysql database neatly into
I've coded a function that works but that is ugly. I'm pretty sure there's
I've coded an node.js app that when get executed need to return CWD from
I have quickly coded up a sort of product display thing that gets half
The Coded UI Test Builder application in Visual Studio is very useful when hand-writing
I have coded some JavaScript to perform an ajax call in an asp.net application.
I coded a Dialog that shows up with 2 textviews and 2 buttons. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.