Lua in SpringRTS/What is the Spring engine
What is an engine[edit | edit source]
Engine simply put is the core of a game. Usually game development teams make an engine which handles most of the heavy duty work like physics and 3D rendering. Physics and 3D rendering are the parts of a game that are the most CPU/GPU consuming and they are the parts that usually have the most code of the whole game. The 3D models, textures, etc are held outside of the engine.
The reason for this is so tweaking the game doesn't need to make huge changes in the code of the whole game. In the old times(before engines were used) there used to be big files that kept all the game content so if someone wanted to change something in the game it was a big hassle. The person had to dig inside every little line of code of the game and double-check that nothing is broken after the change. Separating models, textures and other game elements makes it much easier to maintain a game and easier for future tweaking.
The Quake example
You have probably heard of the Quake engine that was given to the public. With an engine in hands, someone is capable of changing many things(modifying) or even make a new game. From the Quake engine for example an open source game derived called Warsow(among others). What the developers of Warsow did was taking the engine and using their own models, textures and other files. They probably changed a bit the engine as well to fit in their needs. The thing is that you could yourself take the Quake engine and use your own models with it and modify it if wished. That way just by modifying a little piece of a game you make it appear as a new game.
That methology of "game modifications" is even used in the broad market. It is very often that a team develops an engine and uses the same engine for a series of different games. That way there is limited coding needed in the future games.
The Spring engine[edit | edit source]
Spring engine was built with the old game Total Annihilation in mind. That's the reason why so many different games(mods) share the same characteristics like the metal and energy resource system.
When making a game for Spring what you really are making is a modification(mod). The engine is left intact and the only thing being changed are the external parts like the map, the unit models, unit behaviours, textures, soundtracks, AI behaviour etc. The core of the game is still inside the engine so your freedom is somewhat limited.
Even with that limitation you can still change the look of a game in many ways. You could change even the metal/energy system but that would take a lot of Lua coding and thus making the game in the end a bit slower. Keep in mind that Lua is 3 times slower than C++ which is the language that Spring engine is coded in.