Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-15-2010, 09:41 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 1
shtra is on a distinguished road
Question Collisions with multiple objects

Hey all, new on the site

I'm writing a game where multiple objetcts act on the screen at the same time (bullets and enemies). Both objects are created from a class, which is looped in the main class. Hence there is no predeterminated ammount of spawning objects. To manage collisions between these has proven to be a matter of great difficulty.
The game is using cocos2d framework. I've tried the chipmunk physics engine, to no avail. What ever I do the same obstacle appears: the code can't tell which objects collide or not; there's no induviduality in the objects one may say. How do I detect collision between multiple objects, while they still spawn at an infinitely ammount?

The chipmunk physics engine did succesfully detect these multiple collisions, but proved to be a nightmare to the framerate. The problem occured when over 40 objects acted on the screen at once. When I couldn't figure out how to delete the objects, instead I only transported them to an array ouside the visible screen. There they waited untill the loop called them back. This "recycling" of objects was really hard on the memory.

Consequently there's two solutions to my problem, I'm interested in both
Greatful for answers // shtra
shtra is offline   Reply With Quote
Old 02-16-2010, 04:56 AM   #2 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 6
ClarityGames is on a distinguished road
Default

Hi shtra.

When you say there's no 'individuality' do you mean that the code can't tell the difference between your bullets and enemy bullets, your player object and enemy objects, etc etc? It sounds like you're performing way too many collision detection checks.

And what kind of game are you writing, that you're considering using a physics engine? Physics engines are always a big hit on CPU cycles and are usually ran on faster devices than an iPhone (they first became popular on the PS2, for example). If you're writing a 2D game or even a 3D game played on a flat plane you should consider writing your own CD routines, with a healthy 'culling' routine at the start to automatically rule out certain combinations of collision. That'll get the fps up there again!
ClarityGames is offline   Reply With Quote
Reply

Bookmarks

Tags
collision, delete objects, multiple objects

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 400
7 members and 393 guests
13dario13, iOS.Lover, jeroenkeij, Leslie80, Wikiboo, Yosh_K
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,670
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Yosh_K
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:44 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0