5
\$\begingroup\$

What good practice in paralleling of rendering, main game logic and networking on iPhone/iPad? If I program on Windows I use threading and IOCP, but I am new to iOS. So what patterns, io async libraries or something like kernel queues you choose when program complex mobile games? I need your advices on how do not stuck on waiting of server's answer and show animation at the same time? How must be organized main loop of client of the game? My interest first of deals with C++ approach and Marmalade SDK, but I'll be happy to any solutions!

So, for game logic, rendering, networking, user input and audio:

  1. What paralleling mechanisms do you use? Pure threading or some library?
  2. How does your waiting logic for server's answer work? I guess that animation, rendering and game logic still play and not wait server.
  3. Any know how, links, post mortems from client-server iPad/iPhone games?
\$\endgroup\$
1
\$\begingroup\$

1) iOS and most mobile device needs main thread to call OpenGL ES commands. So there is no way you can move them out, So in our case, the main thread will always concentrate only on drawing.

2) While, the main thread is busy drawing, we use another thread for Game Physics and collision logics. If the game uses very complex physics, then we use more threads. We use Bullet Physics which is already good at multithread ready. So we give it one thread per CPU core. This works efficient.

For downloading things from server, we use background process that updates the progress to a variable and the draw thread just uses the variable to draw the progress. To maintain cross-platform, we use posix thread for physics and game logic. For drawing, we use displaylink callback.

\$\endgroup\$
  • \$\begingroup\$ We have been developing games since 2006 for mobile platform. Now one of our games just got released which can be a good example. "Dragon vs Goblins 3D" and another app "Iyan 3d" is another example for the downloading process which happens in separate thread. \$\endgroup\$ – codetiger Sep 25 '13 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.