Array based collision system?

New releases and general discussions.

Post » Wed Oct 08, 2008 1:35 pm

Hi there,

I remember this was an absolute hassle making in MMF and i never got it working. Basically, my online game was meant to have real time shooting involved. Collisions would have to be server controlled. I would input each bullet into an array and change the array values to represent X/Y co-ords.

Heres my question

1. Huge amount of loops/For Eachs? (You would have to loop through every bullet each tick, moving it xpixels in the x/y directions. You would then have to loop through every bullet and every ship checking if there were any collisions?

Surely there is a more CPU efficient way of doing this? For example, is this how construct handles collisions?

Thanks for reading. I'm looking for people's opinions/theorys on this.
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Wed Oct 08, 2008 4:10 pm

Yeah, why not use real sprites and check for real collisions? Why even use an array for collision detection in the first place?
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Oct 09, 2008 1:37 pm

[quote="Ashley":3ckv0mbn]Yeah, why not use real sprites and check for real collisions? Why even use an array for collision detection in the first place?[/quote:3ckv0mbn]

I would suggest it's a better way of coping with server lag. If the bullets are hitting the enemy on your screen, but it's lagging out, so really you are missing... it would be more accurate to use an array to control things maybe? I dunno... seems a bit over the top to me as well but it could work out more "fair" for online play.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Thu Oct 09, 2008 1:46 pm

Normally (I think) servers run the 'true' copy of the game and the clients are essentially interacting with that, so if a collision happens on the server a collision has happened for everybody. Also, arrays would never be as accurate as using real collisions. They probably wouldn't even be as fast - using arrays for their non-intended purpose of collision detection would involve events so complicated it'd probably run slower anyway! Remember the collisions code is compiled C++ code, and events have to be interpreted on the fly with a relatively high overhead.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Oct 09, 2008 3:13 pm

I think halo 3 does it different. Like if you shoot at a player and hit them, you send a signal to the player saying ' I hit u lol' and they lose health

And if your shot kills them it sends a signal 'you died' and they fall over dead.

Gives people with lag an advantage though!
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Fri Oct 10, 2008 6:38 am

[quote="David":x5ac5la8]I think halo 3 does it different. Like if you shoot at a player and hit them, you send a signal to the player saying ' I hit u lol' and they lose health

And if your shot kills them it sends a signal 'you died' and they fall over dead.

Gives people with lag an advantage though![/quote:x5ac5la8]

Halo sucks though... nuff said really xD

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Sat Oct 11, 2008 5:51 pm

Ashley,

How can a server like that ever hope to run an MMO? It would have to be doing the collisions for alot of levels (I understand there are multiple servers for MMOs but still).

Also, if one was to write a server app in python for example (if the online object supported this) so we could run the servers on linux etc. Then surely an array would be the way to do this?
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Mon Nov 10, 2008 12:13 pm

halo like other commercial fps are server based.
B
1
G
4
Posts: 1
Reputation: 1,077

Post » Mon Nov 10, 2008 5:42 pm

u shouldnt use the server for processing collisions,and also an array would cause severe lag, just the matter of writing in everythings position each frame is a lag machine, take that "fluid sim cap (it was sand)" that i made a while ago as an example, at over around 2000 pixels it started to kill the cpu, and thats barely anything, its a 50x40 sprite and an mmo has lots of sprites. . what i would do is is write each players progress, items, xp ect. to the server and actually handle the matter of collisions using parties and hosts, parties of 10-20 per host could probably work
the person with the best connection in the party would be chosen as the host automatically for his party and when you break from a party you become your own host, i dont know excactly what u need to do in your mmo, but id use parties and hosts, instead of one huge server which is guarenteed to lag, servers could be used to hold stats, things that dont need to be constantly acsessed, and with clever script you could make things work very nicely
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Mon Nov 10, 2008 5:47 pm

If performance is THAT big a deal, Construct isn't the tool to use. For heavyweight processing it'll have unnecesary large overheads for the generalised collisions engine, events engine and so on. If it matters that much to you, I'd say write the serverside in a written language (C++, .NET, Java, Python...) and use Construct only for the client. You'd still need a sockets plugin which doesn't yet exist, but you can customise and tweak the performance to work exactly as you want it.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests