Hello, I’m a programmer and I’m currently making my own game. I’m planning to make a framework that will make designing and scripting games easier. I know a framework is a software, or a program that can make scripting more organized.
Please tell me how to make a framework, and what to look out for. (Maybe also a detailed explanation of what a framework is). Thanks.
One of the methods is called modular programming. You use ModuleScripts and logically sort them like a tree into several branches. Fairly easy to debug.
Frameworks are like a meta layer of code that your code runs on top of.
Some can be very simple and basically be just utility libraries.
Some provide easy-to-use abstractions for communication between the client and server.
Some encourage you to wrap all of your game’s logic in special-made objects which they’ll control the lifetime of.
Usually, don’t. Use someone else’s that’s already figured out all the best practices and corner cases. AGF is popular.
Frameworks aren’t the end all, be all of code organization. They can encourage good practices, but there’s no reason that you can’t achieve beautiful code just by keeping your code modular and simple.
Make one game. If you start to have many games, and you start to see a lot of code reuse between those games – like
oh, I always use this set of utility modules, and I always want to use this custom event loop wrapper, and I always end up writing the same boilerplate for every new game, and I want every remote call to go through this logging utility, and…
– then you can start looking at factoring out all that code into a standalone “framework” that you can use as a jumping off point for all your new projects.
Don’t add more architecture than you need. You’ll get dragged down into the weeds.
As previously mentioned, it’s almost as a tree. You would most likely parent the module scripts to a script or other module scripts, based on which requires what.