GUI work…
Work has kind of slowed to a crawl lately, since our real jobs are stressful of late, and after a day of complicated programming work, my night-time coding really takes a hit.
Still, I managed to make some progress with the GUI elements of the game.
The way I’m developing the game is to use my bad programming art and stuff I have lying around in my hard drive from previous projects to drive it forward… This way I don’t have to wait for Rincewind, and I get to experiment with the Lua scripts and see any pitfalls we have to be careful with.
Currently, I’m working on getting the player to select an unit (a friendly one) and command it to move to a specific place in the game scene, using path-finding. At the moment, the player can select any creature in the game world and see its portrait and health:
This of course is not using any final art, just beautiful programmer art!
On SurgeEd, I just built an image bank with a mouse cursor and a “selection circle” (that thing on the character’s feet). I also created another image bank with the portraits of the two creatures available in this experimental framework (the dark and the red robot). Then I added on the game database (a simple MySQL database) the fields for the portrait image name and ran my data file application (all without leaving the editor).
The data file application grabs tables from a database and converts it to a Lua file with the definitions, so I can use it in scripting. An example of one entry would be:
Classes["TestEnemy"]= { base_faction="Neutral", editor_category="Test", lua_id="TestEnemy", portrait="massive_dark", template_name="DarkMassive", type="Human" };
I can then use this freely in my scripts.
In this case, every time the player clicks on the screen, a function that I registered is called by the event, I do some raycasting (to find out what has the player clicked on), if it is a character, I update the GUI on the right side of the screen (the health bar and the portrait, accessing the Classes table I automatically generated from the database), and I add two new 3d objects: the text on top of the character (simple billboarded text, although I have a lot of control over the way it is displayed, like color, facing, size, distance scaling, etc) and the selection circle on the bottom (a 3d sprite).
This is all done through scripting, and the code for this doesn’t take more than 20 lines or so, which is pretty economic…
And since I use LuaJIT to run the scripts, it’s very fast (the slow part is the raycasting, which is done in pure C++).
Now, I’m working on finding out where the player clicks the selected unit to go (right-click on the environment)… Already have a rudimentary system working, but it was a challenge getting to work, because it was hard finding a way to transfer array/list data from C++ to Lua without making it overly complicated from an usage standpoint…
In the meantime, Rincewind is still working on the main character’s model, but he won’t let me show it yet (which might be a good idea, since he’s missing the top half of his head while he does the hair)… I’m very happy with the results of the normal mapping on the face, specially considering all the problems we had on the weekend with it…
Comment
You must be logged in to post a comment.