Specific Doubt about dynamic mmoitems in SpaceWar

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Zenith
Posts: 55
Joined: 09 Oct 2017, 09:57

Specific Doubt about dynamic mmoitems in SpaceWar

Postby Zenith » 20 Mar 2018, 19:29

Hi,

First of all thanks for making SFS . This is an awesome framework (in my opinion best!) for multiplayer gaming.

My Doubt->

I am creating a Multiplayer shooter with imagine a big map and say 100 players. (Loosely Based on the SpaceWar Tutorial)

Now bullets are spawned as MMOItems and they work their way on server till they get destroyed.

Every Player Unit checks for bullets nearby and then check if any bullet is too near to hit that player.

Now I want to allow players to make walls. The walls are also hit by bullets.

So I imagine I would need to create those as MMOItems and then
each wall piece also checks for any bullets in its AOI too close to them ?
This should happen every tick of the game!

Am I right ? Or is there a more efficient way?
I understand java is fast and most of the wall pieces would have their
list of "nearby mmoitems in AOI" empty. Is this approach okay?

Similarly all buildings in map which I want to be destroyable should be built
as mmoitem who should check in each tick if there is any bullet near to them?

Hope you will take time to ponder on this!
Thanks a lot!
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Specific Doubt about dynamic mmoitems in SpaceWar

Postby Lapo » 21 Mar 2018, 10:44

Hi,
I think it is doable, because you just need to check in the vicinity of each bullet to see if there's a wall and check collisions with those, so in the end you will not have to check collisions with hundreds of objects, for every bullet.

Sure with thousands of bullets flying by the game logic will be somewhat expensive compared to other games, but I don't think it should be a problem. Indeed Java optimizes a lot of the most frequent calls and compiles them into native code at runtime making them super fast.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Baidu [Spider] and 59 guests