Array based collision system?

This forum is currently in read-only mode.
  • 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.

  • Yeah, why not use real sprites and check for real collisions? Why even use an array for collision detection in the first place?

  • Yeah, why not use real sprites and check for real collisions? Why even use an array for collision detection in the first place?

    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

  • 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.

  • 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!

  • 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!

    Halo sucks though... nuff said really xD

    ~Sol

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • halo like other commercial fps are server based.

  • 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

  • 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.

  • halo like other commercial fps are server based.

    Halo isn't an MMO or server based. The clients do all the work.

    Yeah Ashley I know what your saying. I've decieded to scrap the collisions and use a simpler system (clicking the attacks). This should only need to send to the server everytime someone uses an attack and be processed only then, rather than constantly processing. I'm hoping this won't be too slow in construct...

    Quazi, there is no alternative for proper MMOs im afraid. You simply can't let the client do anything unless your willing to have cheaters. And your suggestion is how guild wars works, its a kind of half MMO as only towns/cities actually are hosted on the servers, everything else uses your client as a host system. Its quite restricting.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)