Item drops
#1
I've been refactoring item drops and I've come across a decision that needs to be made.
If a block mined drops multiple items of the same type, do we:
- create a pickup for each of the item?
- create one pickup that represents all of the items?

The first approach is visually correct - lapis ore blocks drop 4 lapis dye items, etc. But it has the disadvantage of slowing the server down and potentially flooding the clients with too much network traffic - each item needs a packet to spawn and some CPU + RAM to handle.
The second approach would be visually confusing to new players, but better for server performance.

So, which one should it be?
Reply
Thanks given by:
#2
I say create a pickup for each of the item. That's how it is right now in MCServer, and that's also how it is in Minecraft.


I doubt it has much effect on performance because there aren't that many blocks that drop multiple items
Reply
Thanks given by:
#3
(06-06-2012, 06:22 PM)FakeTruth Wrote: That's how it is right now in MCServer.
No, sir, MCServer now creates a single pickup for the item with its count set to higher amount. At least it creates a single cPickup object.


(06-06-2012, 06:22 PM)FakeTruth Wrote: I doubt it has much effect on performance because there aren't that many blocks that drop multiple items.
I wonder then, why people write mods for the vanilla server that do exactly this - combine drops into a single pickup for performance.
If you mine a chest, for example, the amount of spawned pickups may be overwhelming.
Reply
Thanks given by:
#4
It does?Tongue It shouldn't!

If you destroy a chest, all items are grouped by type.
If you destroy a lapis block it should drop multiple pickups of the same type.

I thought that happened, but I think I never tested breaking lapis
Reply
Thanks given by:
#5
I haven't tested either, but it creates a single cPickup object, without any regard to item count, so I suppose it created a multi-pickup.
Anyway - so do we want to create multiple pickups, one for each item, or one pickup for all items of the same type?
Reply
Thanks given by:
#6
Quote:so do we want to create multiple pickups, one for each item, or one pickup for all items of the same type?
Unless we're breaking chest/furnace - multiple pickups. Is it possible?
Because it seems to be the best solution - no confusion, still minimal perfomance impact in critical case (I double we'll see a lot of multiple simultanious lapis/redstone blocks dig - so this case isn't "critical" IMO)
Reply
Thanks given by:
#7
Isnt it possible to add both ? :p.
Simply or a configuration for big servers/small servers.

Or a midway if a amounth has passed start merging them ?
Reply
Thanks given by:
#8
Xoft - check out the new snapshot, a lot of game mechanics are changing in 1.3. Also the items of the same type are one pickup. That's what vanilla server will do, and MCServer should act the same.
Reply
Thanks given by:
#9
Quote:the items of the same type are one pickup. That's what vanilla server will do
I'm not sure if this is what I want personally Smile
Because, you know, the only reason for me to dig Lapis Lazuli was that warm feeling of happines when I see lots of items to pop upBig GrinTongue

Maybe two more config values? StackChestDrops = 0/1 and StackOtherDrops = 0/1
Reply
Thanks given by:
#10
Okay, I refactored the item dropping code. Right now it drops single pickups even for multiple same items. But should we want to change this behavior, it wouldn't be too difficult to do, it's all centralized in two functions, cWorld::SpawnItemPickups().
I'm not playing with that anymore, because that part of the code is really really boring to write (check out the cBlockToPickup::ToPickup() function, that was a nightmare! )
Reply
Thanks given by:




Users browsing this thread: 6 Guest(s)