However, there's one set back, speed. Script languages have to be interpreted, which can be up to 100 times slower than machine code. However thinking back to embedded scripting, its used to basically configure or customize and application. Rather than doing the heavy lifting, the script tells the application how to do certain things, resulting in minimal performance loss. You can go even further with this idea and make frameworks/engines that utilize event driven systems to minimize computation done using the scripts.
My idea is to utilize this idea to make a game engine that will not only be very easy to use, but also bares little to no performance loss. The idea is simple, you define event handlers in your scripting language and loading objects, then the main loop and geometry work is done in the compiled machine code.
Heres an idea of how it works:
- Load function is sent to the engine and called
- Obj1 obj2 and obj3 are loaded
- Event handler function is sent to the engine
- When W is pressed Obj1 decreases on the y axis by 5
- When S is pressed increases by 5
- When D is pressed Obj1 increases on the x axis by 5
- When A is pressed decrease by 5
- The methods used to move Obj1 are functions in C
- Music Handler is sent to engine
- Obj3 is played on loop till Obj1 and Obj2 collided, notified via trigger.
- Collision handler is set for Obj1 and Obj2
- When Obj1 collides with Obj2, Obj1 can no longer move in that direction.
- Will trigger Music Handler to stop.
- Collision is detected using Bouncing Box in C
The idea is to do as much of the processing in C and leave the scripting language to make the decisions. Think of it this way, C is the body, Script is the brain. I realize this has been done, but not with the same goals in mind. I think it would be very innovative to create an engine that will only use script language eventfully.
I'll post more ideas on this engine as I go, maybe I'll even write a Doc or API structure. Who knows, maybe I'll do it.