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

  • Home
  • SEARCH
  • 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 3809168
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:15:48+00:00 2026-05-19T15:15:48+00:00

so i have made a box2d game with cocos2d. The user can move the

  • 0

so i have made a box2d game with cocos2d. The user can move the player and in the world there are dynamic objects. Now i thought of implementing a coop mode.

I know there’s gamekit.

My thoughts:

  • make one of the two devices (or more..) to the host.

  • if level loads send all positions from all objects (static+ dynamic + player positions) to the other clients (iphones/ipods/ipads) and now it should be sync

BUT

should i make a dict and then add the positions of all objects to it and then convert it to a nsdata object then send it.

Is that enough?

I want to make this without having any internet connection so P2P.

The only possibility is Bluetooth i think or are there more?

Is that enough?

Would be great if someone could give me some advice and some code on how to do that.

Thanks for reading
Have a nice day.

🙂

  • 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-19T15:15:49+00:00Added an answer on May 19, 2026 at 3:15 pm

    I think the good idea would be making one of the host to be a server. Because, if you create connection each to each, then you’ll have N*(N-1) connections total, and (N-1) connections for each host. If you use the server then you’ll have only N-1 connection for the server and only 1 connection for each client. So you’ll have to perform full simulation on each of the hosts and then synchronize that data with server. The simulation, synchronized at regular intervals, will tend to run identically on all computers. It means that only small and infrequent adjustments will be necessary to keep it the same for all users.

    edit: you should also think about traffic minimization, that’s why sending the NSDictionary would be too much. You can send little structure, like

    typedef struct {
       short obj_id;
       float pos;
       float vel;
       float angle;
    } obj_inf;
    

    edit2:

    obj_info obj1_inf;
    //set the values here ...
    NSData* packet = [NSData dataWithBytes: &obj1_inf length: sizeof(obj_info)];
    
    //if you have an array of obj info (e.g. 20 objects):
    obj_info* oinf_arr = calloc(20, sizeof(obj_info));
    for(int i=0; i<20; ++i) [{
         //fill each oinf_arr[i]
    }
    NSData* packet = [NSData dataWithBytes: oinf_arr length: 20*sizeof(obj_info)];
    

    Probably you want to add some header to the packet and place there the number of objects etc.

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

Sidebar

Related Questions

I have made a custom UserControl i Vb.net (windows application). How can I add
I have made a little app for signing up for an event. User input
I have made a SVG image, or more like mini application, for viewing graphs
I have made some code which exports some details of a journal article to
I have made a program in c and wanted to see, how much memory
I have made a new windows service which works fine using barebone code (just
So I have made a webservice that interfaces with a set of data contained
Background I have made a Web Service in Visual Studio, and I'm trying to
I have a JavaScript class that I have made and put it into its
I have a ASP.net 2.0 app and I have made some changes the the

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.