Game organization

So I’m working on a game related to magic, where players will have a type of magic and they’ll earn more spells by training.

I’m currently making the spells, but I have no idea how to organize this. I want the spells to be run mostly client-side to reduce lag (except for the damaging part, which will be handled on the server), but I don’t want to make a RemoteEvent for every spell, or a local script for every spell. I thought of having a unique Remote Event and a unique LocalScript, which would work by having a Script for each spell firing the RemoteEvent to all clients with a function that runs the spell as an argument, but then I found out functions can’t be passed as arguments.

Any ideas on how I could work this out?

4 Likes

I suggest Object Orientated Programming, All about Object Oriented Programming

Maybe have the spells fire in a certain way (method 1 would have 1 script, 2 would have another, etc) similar to how Arcane Adventures (if im not mistaken, haven’t played in years) had attacks that were from different classes but very similar to each other. See 0:50, Maxxz and the NPC use the same attack but from different classes. https://www.youtube.com/watch?v=KgVWChkqhTw

Also I suggest having most of it run on the server then maybe the server giving the effects to the client. See the FastCast module, Making a combat game with ranged weapons? FastCast may be the module for you!

Managed to get something working, but your solution could help other people. And thanks for the module, I’ll definitely use it :smiley:

1 Like

Any chance you could tell us the way you decided to organize your scripts and remotes? I’m currently trying to figure this out myself but everything I try seems messy.

Here’s a very general version of my method,

On the server I have

  1. Server Setup (Requires and Initializes modules, sets up things)

  2. Modules for specific categories (e.g. Weapons) (Probably does most of the work)

  3. Remote Handler (Bridge between Client - Modules)

  4. Replicated Storage - REs and RFs for certain tasks

  5. Client Setup (Sets up things on the client)

  6. Starter Player/Character Scripts (Does work needed)

On the client I don’t really have a remote handler and instead just fire off REs/Invoke RFs where I need them.

1 Like

Aero Game Framework. :relieved:

A framework makes you adhere to a specific organisation style. Aero is very easy to get used to after some fiddling around and it’s worth looking into.