Hi, I just wanted to post, why I am here at the moment...
The screenshot is nothing special, there is the terrain with the houses from the irrEdit Examples and some palettes randomly on the screen. Oh, and a stupid window and a button
I am playing around with lua at the moment and have the basics running now.
Everything in this screenshot is configureable by XML and/or LUA.
Before I do anything with Irrlich, I initialize lua with my library, load all lua files from a special directory and initialize the environment this way.
For every configureable entity I have special functions in a library to register them to the engine.
At the moment, I can define enemies, triggers and maps (zones). Every enemy configures itself a mesh, a position etc. and some callback-function-names.
That way I can implement movement, aggromanagement, fighting, dying, respawning for every enemytype in lua. The trigger do nothing than tell the console, when the camera is coming into a defined range. the map defines a .irr-file, a list of enemytypes with startpositions and some enemyinstance-informations like level, attackpower etc., a list of triggers and a list of Node-names that should be handles by Collisiondetection. I use the names you can define in irrEdit for each Node.
Than, every frame, I iterate over all created Enemy and Triggerinstances, check what status they have, if they have the needed callback method registered and call those, if found. That way those palettes are moving in defined ways ("circles" with 6 to 12 edges ) or in lua defined paypoints (some with fixed locations, some with waypoints relative to their spawnpoint).
- The GUI is loaded by parsing one or more (referencetags in the start-xml) XML Files. Functionality behing buttons and latter Lists is implemented in lua. in XML the Functionname of the Lua-function is named and when the Button is hit, the lua function is loaded to the stack and called with all needed information as parameters.
There are currently around 50-60 Functions I implemented in C++ and loaded into LUA to provide access to needed Objects and Methods.
Before I started I implemented the current version (without the gui) in pure c++ to know the impact of lua.
I was alittle worried, as loading the .irr file "downed" my FPS alot. The terrain.xml with 100 "walking" Palettes ran around 60-70 Frames. When I loaded 1000 my FPS went down to 1 *sigh* and were around 100 FPS when I walked the camera under the terrain and looked down. ... moving more down rised the FPS, but the position just under the terrain was a point I would reach again later In C++ I only implemented one movement-method (running edged circles with random radius and random edgecount)
So I hade those 2 values
60-70 with 100 Enemies
100 with 1000 but no direct rendering
My current system (with 3 different callback methods so no chance in the lua-vm, was at
55-65 with 100 Enemies
~92 with 1000 Enemies butno direct rendering.
So those ~ 90.000-100.000 lua-function calls per second cut the framerate by under 10% and... I don't know a game in the rpg-sector with 1000 scripted enemies at a time per map/zone.
Some more informations:
- I call the callbackfunction of the enemies and triggers every frame (this will be changed later. Aggro, and Trigger-Range checkes can be called in longer intervals, based on the movementspeed of the player(s))
- I call the "ground" method, that calls getHeight() on the terrain and places the enemies back to the correct height only 30 times a second. that way I get alittle performance but avoid visible jumping. I this this is still faster than using collision for every enemy.
I extracted all Irrlicht-calls into a irrlicht class, so I can change this, if I ever want to. Same with the XML parsing. I currently can work with irrXML and tinyxml.
LUA + XML + Irrlicht + Performancetests
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I actually got a warm fuzzy reading this. It's really great to see a project starting from a solid basis. Thanks for sharing this with us.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
As you climb up the frame rate ladder, frame rate decreases/increases are less statistically significant since the difference at high speeds gets closer to the resolution of the timer. So you may have a smaller frame rate decrease with lua but the fps timer is giving you imprecise results (you might still have a fast game after those -10% ).
Good luck though, you seem to be clear minded in what you want, makes the project look promising.[/i]
Good luck though, you seem to be clear minded in what you want, makes the project look promising.[/i]
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p