Help with Object-Oriented Programming

I recently have began learning the fundamentals of object-oriented programming in Roblox Studio. I have familiarized myself with the basics, but I would like to know how it can be utilized in an actual project. I, at the moment, cannot think of many ways that it can be useful without better, alternative methods.

2 Likes

There are tons of OOP resource tutorials that you can look into, it’s just a search away. – [Coming from someone who clearly didn’t read the post] 2024-03-09T16:29:00Z

OOP is useful for a lot of different things. They’re good for making different types of cars, (been seeing that in so many tutorials) or to make a class to limit the amount of code and scripts you would have to manage, hell, it could even be used to create a class for humanoid objects.

If you still need examples, I’ll just list a few game genres that would benefit from it.

Tower Defense – You would need to create a base class for the different entities in the game. (Towers, Zombies) This is so you could easily create these entities and change their properties, and to even add additional functionality while keeping the base functions within their base class. The different uses are close to infinite, from making simple objects with functions to making object-orientated services.

Fighting Games – I know this from experience. You may want to create a HitboxModule for different types of hitboxes. But, you would also create an OOP for the base class of the hitbox, it’s functions and properties. You might even create an OOP for the weapons for an easier way of storing/giving information between client and server.

Artificial Intelligence – You might even need to create AI for your game if there will be any. OOP would make it easier to have the base class of creating these androids. You would then create different types of behavior functions for them, which could also be created as an object for you to modify for that AI.

Like I said before, these are practically only a few of the hundred use cases. You might even use it for the littlest of things, because of how organize it makes your code in that case. Not to say praise OOP or the use of modules, but to utilize it and see its benefits. Hopefully this helps, and good luck on any of your future projects that might use it.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.