Just about as long as I've done game programming, I remember interacting with some kind of a scripting engine. GML, Lua, AngelScript, Python. All of them have something to dislike, something that makes a developer pull his hair in an attempt to defy laws of gravity as even that seems easier than making the code behave just the way it's needed at the time. I'd been that developer for some time and I've had my share of those moments. Then, two years ago, near the beginning of the year 2012, I decided that I should try to address every problem I noticed in there, as well as integrate the successful decisions of various languages. There were tradeoffs to be made, not all good things go well together, though there is some place for being proud of what's accomplished. High portability, ease of integration, accessible API and debugging / profiling tools.
The Reasons and Solutions
- Programmability - control over software should not be exclusive to the man with the compiler and all that other stuff. Sometimes it helps to be able to just change the things you want. In those moments, SGScript is there for you. As a dynamic language with a friendly interface, it allows to do a great deal of work with a few small scripts.
- Portability - with other operating systems and cloud storage becoming more accessible, it is important that binaries as well as SDKs are small, and everything works largely the same way everywhere, with only a few things to swap when moving between different OS's, to make it easy to work on your projects anywhere, without setting up huge SDKs and build systems. Working in a cloud storage folder is a real possibility, and not only that - I've been doing it when I need to test how things work on different platforms.
- Compatibility - with a few code files, everything's possible. Adding non-trivial makefiles, various dependencies on other libraries or even a C++-only API makes things worse. It's sometimes necessary or helpful but certainly not here. SGScript therefore can be fully compiled with just one step, using the most available tools: GCC, a C runtime library and GNU Make.
- Performance - don't you just *love* it that when closing in on the release date, suddenly there's garbage collection hiccups everywhere and there's no good way of getting rid of them? Since memory management to some extent is always a necessity, it's easier to just start with that. There's not much to be done anyway and whatever there is, the included memory profiler will help with that. It shows allocations / frees / allocations - frees (memory block count change) / memory usage change in bytes per call stack frame so it's easy to see where your resources go and where they come back.
SGScript is the game scripting solution and a library that helps you add external programmability to your software. To find out more, you can visit the website at http://www.sgscript.org! You can even try the language at http://www.sgscript.org/try to see for yourself how easy it is to use.
I've built a few extension libraries for SGScript. All of those can be found at https://github.com/snake5?tab=repositories. sgs-sdl, sgs-box2d, sgs-audio and sgs-ui are some of the more finished ones, though they do lack proper documentation at the moment.
SGScript in the Wild
I've used these libraries for two published game demos. Both are top-down shooters due to their artistic simplicity.
Ludum Dare #29 game: http://www.ludumdare.com/compo/ludum-dare-29/?action=preview&uid=34947 (includes source code). Using pre-v0.9.5 libraries so swapping something might not work or require the full set of new libraries + some code changes.
TACStrike: http://sgscript.org/files/tacstrike.zip (screenshots: ). Source code might be released later. Using old (pre-v0.9.0) libraries.
Currently the plan is to finish a UI toolkit, make a basic 2D game engine and an editor, finish other libraries and document all written code to make them available for everyone. As demonstrated, all those libraries are usable and stable, however the lack of documentation leaves only sample code and original source code as the only ways to learn the library.
UI library test video: http://screencast.com/t/yPZ7nV3zYKL
UI library / 2D editor screenshots: |
sgs-sdl-3D screenshots: | |
I hope you'll have just as much fun using the library as I do. If you have any questions about it, you can post them here or ask me directly. If you run into any bugs, you can either post them in GitHub (https://github.com/snake5/sgscript/issues) or send me an e-mail. A test case, in the form of one or several source files / code snippets, must be included.
E-mail: snake5creator+sgscript [at] gmail [dot] com
Edited by snake5, 15 July 2014 - 07:56 AM.