Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

http://fuuka.warosu.org/jp/thread/S11065580

Name: Anonymous 2013-06-22 5:30


I don't know exactly how ZUN coded the bullets, but I managed to create an equivalent algorithm with XNA.

Here is what I used:
>A class hierarchy for different types of shots. Each type of shot defines the AMOUNT (not the types) of data needed to achieve a certain behavior. This trims down unnecessary memory usages and enforces consistent behaviors
>Flyweight Pattern.
>Instanced Mesh Rendering. Yes, I know that XNA has SpriteBatch, but I wanted to make the bullets be models rather than sprites so I can do some 3D camera tricks.
>A kind of Visitor Pattern that works around the need of using virtual methods on the bullet Flyweight classes. Virtual methods aren't as bad in C# as they are in C++, but the optimization is noticeable
>CPU Budget. If the application is running at 60 fps, the Update methods of the bullets only actually update half of the bullet instances per frame and the other half on the other frame.
>Loop unrolling and avoid using LINQ (since I'm using C#) or foreach loops. Unrolled for loops can go a long way!
>Sweep and Prune broadphase for the collision detection. Per-Pixel collision in the narrowphase for odd-shaped bullets.
>Pre-allocations galore. Pre-allocating all you can is specially mandatory in C# applications, but it can help a bit on C++
>Use C#, because using pre-allocated Reference Types is absolute master race over dealing with all this pointer bullshit

On my machine, this algorithm can deal with over 100 bullets on the screen at around 660 fps.

As for the bullet patterns, they are implemented in a hard-coded fashion. But I can just use IronPython to get a Python script, compile it and run it on C# levels of performance.

Name: Anonymous 2013-06-22 14:53

how many of you retards are actually posting on the /jp/ thread? Stop shitting it.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List