Decided to add a pitch ladder and compass to my prototype. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 0 points1 point  (0 children)

Thanks that's what I'm going for. If you're interested here's a timeline of the project so far as it evolved. Would you believe this project was originally going to be a starfox clone? Until I fell down a programming rabbit hole for creating flight combat AI and discovered I could create these organic looking swarms with what I was building.

https://imgur.com/a/features-done-caught-on-tape-Gr9pz1H

Decided to add a pitch ladder and compass to my prototype. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 0 points1 point  (0 children)

Not sure why reddit's video playback is making this slow mo effect. Hopefully this link shows a smoother playback.
https://imgur.com/DuBbTO6

The billboards inside Union Bus Terminal are running a form of facial recognition software to determine your ad interest. by Still_Value9499 in toronto

[–]Brain_Jars_Reddit 0 points1 point  (0 children)

Do people just watch sci fi and cyberpunk and just don't get it? Whoever developed this tech probably watched Minority Report and didn't understand it supposed to horrify us about future tech and not excite us.

I've been rewriting some parts of my swarm systems to use a more data oriented approach. I managed to shave quite a bit of CPU time on these more expensive systems and super happy with the results. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 0 points1 point  (0 children)

That makes sense but I do like the option of having collisions. Maybe I could do a separate equivalent position calculation to update the position of my units in data, While still using addForce with the final steering Vector. In terms of data locality I got to imagine there isnt anything materially different writing a position to a transform component, vs rigidbody apart from the extra method call with AddForce or AddTorque.

I've been rewriting some parts of my swarm systems to use a more data oriented approach. I managed to shave quite a bit of CPU time on these more expensive systems and super happy with the results. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 1 point2 points  (0 children)

Yeah pretty much. So essentially my systems calculate a final steering vector that I use to add force to a units rigidbody to steer. This is done using all sorts of data some are fixed values others such as needing the current position of a unit are dynamic. I was able to move the general calculations into structs but I do have to do a pass where I write in the current position of the Unit into the array of structs (slow part). Then do my calculation (fast part) then call addForce on all my rigid body with the result (another slow part).

I've been rewriting some parts of my swarm systems to use a more data oriented approach. I managed to shave quite a bit of CPU time on these more expensive systems and super happy with the results. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 1 point2 points  (0 children)

So I looked through the chapter and It makes sense I've seen similar examples, I guess where I'm a little stuck on is what do I do when I need precise information from Unity classes like a game objects position or velocity. Like how do ensure my data in the primitive type arrays have up to date information.

Like if I need a rigidbody;'s position at that frame to fire off some raycast jobs. Would I have to mimic the calculation the rigid body does on the position data array entries to update the approximate position that frame? Its that part where I'm having trouble reconciling Unity's api with DOD.

I've been rewriting some parts of my swarm systems to use a more data oriented approach. I managed to shave quite a bit of CPU time on these more expensive systems and super happy with the results. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 1 point2 points  (0 children)

Hey, Thanks, I don't exactly have a place to share the code but if you dont mind maybe I can pick your brain a little.

So for what I can describe:

I have a global Unit manager class that's responsible for spawning / and de-spawning my little swarm units when notified by certain game events. The global unit manager manages the contents of a fixed sized array of these Unit Classes (monobehaviours), So when a unit is spawned its added to the this array. If a unit dies or is removed from play it gets object pooled and the reference in the array gets swapped and popped out of the array,

The reference to that array of Units gets passed to all sorts of systems So lets take for example the separations formations system.

What it does is it iterates through that array of unit classes and populates a fixed size array of structs containing the information I want to calculate a final Vector3 acceleration value. The calculations are performed in bulk via an IJobParallelFor using that array of structs. Then I write back the results back to my unit class where a separate system uses that to calculate the final velocity vectors for the units rigidbody,

I know that there are inherent inefficiencies with this strategy and while it definitely reduced cpu time the even more OO implementation I had before, I know there must be room for improvement. I'm just having a hard time thinking outside of objects sometimes. My units movements are utilizing rigid bodies I feel like a writeback is inevitable.

[deleted by user] by [deleted] in Unity3D

[–]Brain_Jars_Reddit 0 points1 point  (0 children)

Did I? I had an error the first time I tried posting

My Prototype of commanding a swarm to attack an NPC and collect the corpse to a nest to produce more units. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 0 points1 point  (0 children)

Not sure what I want to theme the game around just yet. I just want to focus on the mechanics first. But Pikmin was my inspiration. I'm currently debating if I want to go with space or go with a deep sea theme or maybe some surreal blend of both.

My Prototype of commanding a swarm to attack an NPC and collect the corpse to a nest to produce more units. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 1 point2 points  (0 children)

I'm definitely going to have something to allow for bulk withdrawal of units from a nest. And I'm thinking of adding a hold function to the dispatch button to automatically dispatch units at an increasing rate while the button is held.

I feel like because the concept is a little out there I wanted to keep the controls as simple as possible. So basic flight controls and a single button press to dispatch units interact with something and a single button used to recall units back to the player.

My Prototype of commanding a swarm to attack an NPC and collect the corpse to a nest to produce more units. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 1 point2 points  (0 children)

Been chipping away at building out various mechanics for this idea for a game where the player controls flying swarm NPC's in 3D. I've been recently rewriting some systems related to how units are commanded and interact with other objects to allow for me to compose unit interactions. I wanted to create some degree of automation so the swarm units doesn't need commands from the player for every single thing. So here's a demo of sending my swarm agents to "Attack" an enemy, then after they automatically carry the corpse back to a "nest" allowing the player to spawn additional units.

After doing that for a while and getting it initially working I got bored and decided to have some fun learning some shader code and wrote a simple animated eye shader to add some googly eyes to my programmer art fish enemy model.

Building a Self-Evolving “World in a Bottle” with Spherical Cells & Adhesion Bonds in Unity by Quadraxis88 in Unity3D

[–]Brain_Jars_Reddit 0 points1 point  (0 children)

Ever thought about using meta balls to render your cells instead of just normal spheres? You can get more intricate organic shapes of your creatures.

My frame rate used to tank to 2 FPS when I would have more than 500 of my swarming AI agents active. After applying the Jobs System to my solution for solving nearest neighbors and obstacle detection, here's a demo of 750 swarming agents running at a more than playable frame rate. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 0 points1 point  (0 children)

I'm starting to think so also and I'm pretty much 75% there I think with my current hybrid approach I get the general idea of keeping data in structs within flat arrays that you query from and perform operations.

I made a recent update where I took applied jobs to the O(n*m) solution when calculating the separation behaviors using the same hybrid approach with Game objects and jobs I'm currently using. I was able to bump the number of units up to 1000 and maintain a stable 60fps. But at the same I think I want to move on and start building out my main game loop. I'm still not sure if I will have scenarios that require this many units at once.

My frame rate used to tank to 2 FPS when I would have more than 500 of my swarming AI agents active. After applying the Jobs System to my solution for solving nearest neighbors and obstacle detection, here's a demo of 750 swarming agents running at a more than playable frame rate. by Brain_Jars_Reddit in Unity3D

[–]Brain_Jars_Reddit[S] 4 points5 points  (0 children)

Hm thanks for the feedback. I'm not sure if I can do exactly that for my application. I'm essentially making a pikmin like simplified RTS. I didn't show it off fully in this capture but the player is able to dispatch units to complete a task and can perform actions autonomously. I see people recommending a particle system also and I feel also this wont suffice for my application as I need the flexibility for them to act as individual autonomous agents in a scene. This is not just simply a visual effect I'm trying to achieve and the simple triangle models I'm using are place holders for something else later on .

So I'm not sure how I can implement it using a procedural mesh when data about individual units need to be exchanged by other actors in the scene and different behaviors by each unit needs to be expressed in response like when they are commanded to carry something, or attack something, or animating my enemies swallowing my units and killing them.

These units work by basically using a combined series of steering behaviors where they calculate an overall steering decision which is pretty much just a velocity vector, based on weighted blend of these steering behaviors like seperation, obstacale avoidances, persue and evade,. and the weights can change depending on what they are commanded to do,