This is a nice little trinket. Though I don’t see myself using the module entirely (I’ll either edit it, reference it for code or not use it at all), it’s a good resource for getting started with round-based games. You can learn with it and eventually create your own system without the use of the module to facilitate the game’s core.
Out of curiosity, with regard to the way the module is coded, why use colons for the methods? As far as I can tell, there isn’t any OOP or usage of the self
argument.
I also have some requests. They aren’t really personal requests but I anticipate that some people may want to have or explore these functionalities for future use. Most of them are based on current functionality, don’t have the time right now to suggest anything wholly new.
:PreparePlayer(obj) - Run this function on player added, it will give the player the needed values.
This function here gives players the Ready and Alive values, as far as I know. This feels incomplete though - the module contains no set or get methods for the created values. The use case here would be preventing the player from participating if they haven’t loaded up or if they want to skip rounds. Not allowing a player to sit out of rounds due to personal preference or a need to be AFK/BRB, depending on the game, is pretty bad for UX, especially if round history is logged or there’s data related to rounds played and won.
The methods can also be used to shortcut and force set a player’s alive state instead of having the developer write that out. Having Alive be set to false on death is bad because not every round-based game may expect a player to physically die for them to be counted as dead or ineligible to win.
:ReadyPlayers() - This function gets the amount of players which have the “Ready” value set to true.
This only gets a number. In the instance that a developer needs a table of Player objects to act on, they have to do it manually. I personally don’t see a use case for getting the number of players ready over getting all players and including their player instances and Ready values.
The naming of this method is also pretty awful; without documentation or reading the source code, I’d just assume this function gets everyone ready and sets their Ready values to true rather than getting the number of people Ready.
:AlivePlayers() - This function gets the amount of players which have the “Alive” value set to true.
Essentially the same criticism as Ready players, except the naming here doesn’t make sense or relate to the method’s intended function at all.
:Countdown(string, int, bool) - This function counts down from the int value (2nd argument). The first argument is the status (example: “Intermission”, “Team Deathmatch”). The third argument is toggling if the round should end if only one player is left. You can get this from the client with the value called “Timer”, which is a child of the module.
This countdown method looks more built to support actual rounds than using it for a non-round sequence, such as intermission. I assume that’s where you set the third argument EndAtOneAlive
(?) to false. If it’s not already a thing, this book should be defaulted to false if the third argument isn’t included when the method is called. That way, it may feel more like a real countdown function that can be bent depending on it’s use case.
I’ve also noticed that throughout this thread, there’s been mention of remotes several times, including this module. Nowhere in the module or this thread is it specified what remotes are needed from the developer to work nor is there documentation on those remotes. Considering this seems to be a big part of the module itself, missing mention of those can be detrimental to a programmer, especially a less experienced one. Touching up on those remotes would be much appreciated.
As far as I personally know, the Timer remote mentioned in this method is used to get the time left in a round. I think that it’s inefficient to have clients constantly requesting for the time left in the match. Since the module relies on a IntValue object, you can shorten this all to a callback method Module::GetTime. When either the server or client require the module, they can quickly call this function at almost no networking cost. This works since the content returned on require is different on the server and client.
Last thing. I haven’t read the module’s code since last night so I don’t know how specifically the counting down works, but no method has been provided to allow developers to force stop a countdown aside from setting the value to zero, which is uncomfortable in practice. There is also no way to determine if a countdown is already active, so the developer could end up accidentally starting two conflicting Countdowns. These kinds of seemingly small issues are the ultimate gateway to larger issues.
I think that the Countdown method overall is worth in depth exploration on your behalf, OP, as it’s developer and maintainer. It feels like the method that needs the most attention right now, since it’s essentially the core of the game overall.
EndGame(table) - This function will be used for showing a results GUI.
I don’t think that developers are only looking to show results UIs when calling a EndGame function. Some developers may not even need this UI. EndGame should be the method that stops an active countdown and allows developers to determine what is supposed to happen when a round concludes. For primitive learning purposes this is alright, but for people who are also using this for advanced purposes this may not seem like the greatest thing.
Regardless of the round results, the method demands that only one player should be the winner of a round. This furthermore disallows any other player to be listed as a winner. No complaints about the varargs (variable arguments for those curious), that’s up to the developer to handle. I haven’t experimented with your module in depth yet, but I personally would use the varargs to pass in a function of my own that runs when the round ends to do post-round stuff.
Just like Countdown, there’s a remote involved with no explanation regarding it. This function is also worth further exploration and development in general.
While I understand that a couple of things I provided may be more suited for more experienced scripters, it’s also good to be inclusive of less experienced ones and devise methods to help them along the process of learning or integrating your resources into their projects.
I spent about 2 hours writing that between breaks in my classes, on mobile. Excuse any mistakes or whatever.
Cheers.