# I'm overriding Timedelta, and it... seems good.

This forum is currently in read-only mode.
0 favourites
• 23 posts
• Interesting game looks like it could be a lot of fun...

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• This is a very sweet game. I'm very tempted to make a couple more levels just so I can play it some more.

As far as calculating standard deviation:

+ variance = 0

+ for each:

- variance_x = variance_x + (mean_x - current_object.x)^2

+ std_dev_x = sqrt(variance_x)

That will give you a true standard deviation. But it also requires going through the loop a second time. I think it would be faster to just calculate an approximate standard deviation:

+ Always

-> Set x_sum to 0

-> Set y_sum to 0

-> old_mean_x = mean_x

+ For each swarm_object

-> variance_x = variance_x + (old_mean_x - current_object.x)^2

+ Always

-> Set mean_x to x_sum / swarm_object.count

-> Set mean_y to y_sum / swarm_object.count

-> std_dev_x = sqrt(variance_x)

(Sorry for mixing syntaxes but I just had time for a quick post.)

If you want a better approximation for the standard deviation maybe adjust old_mean_x by taking into consideration which direction the swarm is traveling and shifting old_mean_x in that direction. (or maybe just shifting it towards the current mouse position) but I think the approximation I showed would be good enough.

• If you have less than 1000 objects, I think the performance impact of looping twice would be negligable.

• Good to know, thanks. (I always wonder how people know that stuff.)

• Events are highly optimised. Events which operate on just a handful of instances often run in negligable time (with a few exceptions, like RTS movement's 'move to' actions, which run a fairly CPU-intensive pathfinding search). To get events to be the cause of your application's slowdown, generally you'd have to make something which repeats tens of thousands of times per tick. That could be a for-each, or an action applying to a lot of instances, etc. Also read up on how the CPU and GPU work in parallel in Optimisation Tips.

• That's a good article. I probably should have read it by now.

• Thanks for the standard deviation! It'll definitely be useful.

It's interesting working on ideas for a game with a distributed main character. If most of you makes it to the exit, do you continue, or play the few particles stuck or left behind? What if part of you gets split off and starts to develop as a separate entity? Maybe the character you're playing is part of a larger organism that wants you back. This is fun.

• Hey, I hate to necro-post but...this sounds like a neat game that kind of disappeared.

Does anyone know what happened to it? The mediafire link seems to be down; does anyone still have the cap? Did this game continue in some other form? Looks like Mort came up with a lot of neat stuff, but hasn't posted in a long time...