MMO Progress Update #3 Item Drops

Hey everyone, I wanted to showcase a feature I implemented, with some code included. Would love to hear thoughts/feedback on this. This is the first time I am posting a video of my MMO, all feedback is welcome.

The feature I finished is Item Drops from enemies. When an enemy is defeated, there is a 1/X chance of the player receiving a given item on the enemy’s drop table.

Here’s the video. I’m specifically looking for feedback on the GUI, but again any and all feedback is welcome :slight_smile:

https://gyazo.com/03b8e44a259f12fa8335458013c8e659

I utilized two ThreadQueues to only slide up to 2 drops on the screen at the same time. Subsequent drops are put into the queue and only displayed after the current drop is finished displaying. Here’s what some of that code looks like on the client:

function ClientItemDropManager:AddDropToQueue(item: SharedTypes.UIItem)
	self = self :: ClientItemDropManager
	local reference = self

	if self.QueueSwitch then
		task.defer(function()
			self.Queue1:SubmitAsync(function()
				reference:DisplayDrop(item, true)
			end)
		end)
	else 
		task.defer(function()
			self.Queue2:SubmitAsync(function()
				reference:DisplayDrop(item, false)
			end)
		end)
	end
	self.QueueSwitch = not self.QueueSwitch
end

You might be wondering why I do local reference = self. Seems redundant right? Well, the type checker sometimes doesn’t like when you reference self inside of task.defer or task.spawn, as well as callback functions, and this solves that.

Anyways, thanks for taking a look!

3 Likes

UI Icons are good, but do a vertical layout instead of a horizontal one. Also how are you making the NPCs? are they all client side or server?

1 Like

Can you explain what you’re referring to for horizontal vs vertical layout?

Also the enemies are spawned in on the server

Looks pretty neat, don’t know whether you’ll have multiple item drops be possible (for example by having killed multiple enemies in one attack, of which more than 1 drop an item) but in the case that is a thing, I think making the “Item received” UI popup a little smaller and stackable(as in stacking multiple of those popups on top of eachother) would look nice.

Also maybe making the gap between the popup & screen border a little thinner;
image


(Not sure how compatible this layout would be for Mobile controls ^^^, maybe a customization option to switch between?)

Much luck on your project

1 Like

This is a great point. At present, I was planning on only allowing the player to fight one enemy at a time, but that may change and if so I would need to take this into consideration.

That makes sense making the buttons vertical. I have them horizontal because I have a sliding menu that comes out underneath them. Not sure how that would look with the buttons on the left. https://gyazo.com/8dfd709f61939e31c6450170ee99143c

1 Like

also, here’s what 2 drops at a time looks like:
https://gyazo.com/3154a619057bf04e15fd98f29231fa86

1 Like