Home Game Development Thousents of bullets logic/efficiency logic – cocos2d-x

Thousents of bullets logic/efficiency logic – cocos2d-x

0
Thousents of bullets logic/efficiency logic – cocos2d-x

[ad_1]

Hello,
I used to be taking part in some previous retro video games and began questioning how did they do it again then. There the place shootemups video games the place you actually had a whole bunch of bullets flying across the display. And any of them may kill you.
I’ve been studying some cocos books (previous however nonetheless legitimate I assume), and plainly the logic is to retailer all of the bulllets on display in a ccArray and within the replace methodology you do a CCARRAY_FOREACH (which i assume in cocos3dx 4.0 is now CCARRAYDATA_FOREACH).
So when you’ve got say, 200 bullets, and the sport is 60 fps, it signifies that the replace methodology is checking 12000 intersections per second!! + every thing else in your sport logic.

I come from a CGI background the place you progress meshes with thousents of vertices per second ar 24 fps, which is form of regular. So I ponder, being new into sport growth, if 12000 intersection checks per seconds is loopy or is doable.

thanks,
R

okay, I’ve been studying abit on the subject and plainly the easiest way to do it’s to make use of a pool and sphere colliders (apparently sooner than field colliders). So insteand of instanciating and destroying all of the bullets,
they’re created all of sudden off display, after which simply transfer round and reposition out of display when not wanted.

1 Like

Hi there, I believe they might of simply test the gap from and object to object,
not all of the factors of a physics object in an engine.

Example code.

float diffY = p1.y – p2.y;
float diffX = p1.x – p2.x;
return sqrt((diffY * diffY) + (diffX * diffX));
then if the gap is much less then say 2 then collide, however again within the day it might of additionally been Assembly language.

That’s is attention-grabbing(You can avoid wasting efficiency although with out making use of the sq. root)
My concern was extra about creating the sprites cases than the collisions. Instead of making and destroying the sprites cases, they will all be created directly off display at loading time, after which simply transfer then round. For occasion, when colliding, as an alternative of destroying the sprite and creating a brand new one once more, simply transfer it again off display till you want it.
I do one thing comparable with some background clouds. Create as soon as, and as soon as they depart the display, set the place out once more and restart.

Yes thats the enjoyable half about video games programming, you make it up as you go alongside optimisation is vital, however bear in mind it’s all pretend so when your swimming in water your not likely it’s simply graphics, however just like the matrix “Your mind makes it real”, I discover it enjoyable programming and animation, it’s like a superb previous cartoon it’s left to your creativeness.
We use many tips like hiding issues off display or as a result of cocos makes use of nodes you’ll be able to simply present or disguise node that tells the engine if its is to be drawn, utilizing one participant and altering the colure so it appears to be like like many alternative gamers to avoid wasting reminiscence or tile maps reuse the identical tiles to create an infinite scrolling map that was the arcades favour trick should you performed MAME earlier than you’ll be able to see they rotate pallets and use tiles and every kind of trick’s to create the phantasm. Cocos2x can pull off all these tips and them some, “On steroids”, the extra you get into it the extra enjoyable cocos is. I don’t know should you program in any respect or should you do or begin studying it is a actual enjoyable engine to play with a number of assistance on right here the admins on listed here are implausible at serving to out too they actually helped me with my ip & pictures this was one thing I ignored and so they picked up on good. anyway get pleasure from and have enjoyable.

sure, I’ve been a software program dev for the final 15 years. I exploit to work within the movie CGI trade the place I wrote rigging software program in python and C++ plugins when heavy realtime computation the place required.
I lately change to the sport trade (received a bit burned from working in large movies studios).
This the sport I presently creating

shootem up sport dev WIP

It is small sport that I’m utilizing as a “workshop” for future extra critical and lengthy video games.

Hay thats superior is there an finish boss? jogs my memory of – R TYPE liked that sport. is it operating on Android or IOS appears to be like like its on home windows?
Make me wish to write one now ought to solely take about 20 minutes with this engine

Cheers.
Yeah, love rtype, final resort, bomber trip… So many implausible video games.
The sport is one stage with rising problem with completely different sections that correspond to new enemies and on the finish it will likely be a remaining boss sure.
I do put up wips on Instagram if you wish to take a look, seek for rudi_hammad.
The platform is PC. I’m not concentrating on Mobil, at the very least with this one.

is it utilizing cocos2dx or a unique engine

oh cool so you’ll be able to recompile for something then, good one. I mite have to interrupt out the compiler and have a go at one thing like that forgot how a lot I like all them shoot em ups, I’m so old fashioned I’m a scrambler , defender, sinister all them 8 bit arcade sport was fortunate once I was younger I lived on the price of Bournemouth in uk we needed to 2 pier’s and so they the place choked stuffed with all of the 80 video games after they was new, So had a misspent childhood taking part in all them arcade video games lol:).
however you’ve gotten sparked me into trying a shoot em up sport now thanks.

Cool.
Plenty of previous video games maintain very effectively as we speak. And it’s not all about 3d, raytracing and the final tech… Look on the final ninja turtles video games, it offered very well.
Anyway, getting off subject right here. Good luck together with your initiatives.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here