Moving large amounts of blocks?

Discussion in 'Plugin Development' started by joehot2000, Apr 18, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    joehot2000

    Hi, i am making an 'alien invasion' plugin. Spaceships will appear and start shooting fireballs on players.
    The problem is, how do i get the spaceships to move? They will be pretty large, and i also need to eliminate lag. hence iterating through the block list would not help - as players would lag too much.
     
  2. Iterating through blocks would not be the problem, that's quite fast.
    The problem is when you set them, setting them individually with setType() and stuff via the API would send packets and lightning updates for each block which would be a pain for the server to calculate.... you need to do changes per chunks and updates per chunks.

    First, I want to ask you... are your spaceships *real* or do you want them to just be like clouds, uninteractive ? Because you could save yourself alot of trouble and just send players chunk (or individual block updates, you need to calculate which is better for the current chunk you're updating blocks on) and basically fake the existance of the spaceship... that is, until some player touches/shoots at it =)

    But if you want them to actually be there then you need to hook into CB code to internally set types and call group light recheck to minimize the lag and you need to do it progressively....
    You should search about this in the Resources section because I think I remember someone actually adding something like this.
     
    joehot2000 likes this.
  3. Offline

    joehot2000

    Sorry for not replying.

    Yes, they are going to be 100% real. They will float across the sky attacking any player in sight.

    But how could i "hook into the CB code" to stop this?
     
  4. joehot2000
    That doesn't sound like 100% real if they just float around without players interacting with them... like shooting back or walking on them, otherwise they can be just visual.

    But anyway, hooking into game code is complicated because it's obsfucated and you need to keep it updated more frequently, I don't know where to point you for this, search in the Resources section :}
    But to start you can just replace the bukkit jar from your buildpath with craftbukkit jar, then you'll have more options available... however, they're not officially supported by Bukkit, they only support the API.

    I belive there's also a feature request (at https://bukkit.atlassian.net) to add methods to massively change blocks without updates on individual blocks, you should search for that and vote for it :p
     
    joehot2000 likes this.
Thread Status:
Not open for further replies.

Share This Page