Topic: Avg. FPS available from LUA?
Tibor Topic Opener |
Posted at: 2017-06-03, 20:18
From lua script we can set a speed of the game. But can we get actual average FPS from lua script ? My idea is a script that would continually tweak speed of game to keep FPS in range f.e. 15 - 18. To speed up AI testing... Top Quote |
GunChleoc |
Posted at: 2017-06-04, 08:10
Not yet, we'd have to add it. At the moment, it's calculated in Busy indexing nil values Top Quote |
Tibor Topic Opener |
Posted at: 2017-06-04, 09:55
I will look at the code, it would help me... Top Quote |
Tibor Topic Opener |
Posted at: 2017-06-04, 16:12
It seems to be too complicated for me :( Alternatively if there was a counter of frames and LUA could get a number of actual frame - I would calculate the rest... But it seems there is nothing like that... Top Quote |
Tibor Topic Opener |
Posted at: 2017-06-04, 21:50
BTW, is there a way how could LUA script read a file? I found some examples on net, but it failed because of missing IO library. I tried 'require "io"' but no success Top Quote |
GunChleoc |
Posted at: 2017-06-05, 11:02
We route everything through C++ for security reasons, so this would have to be added to the Lua interface too. How about we try to finish up a branch for the new AI, and then deal with this stuff for further tweaks afterwards? Edited: 2017-06-05, 11:02
Busy indexing nil values Top Quote |
Tibor Topic Opener |
Posted at: 2017-06-05, 11:41
To have it considered ready to trunk one big thing remains: Having AI DNA in separate files, unlike now, when it is part of *.cc file. Such files would be loadable when AI is initialized and a very conveniet would be dumping current DNA of each AI player to a file during AI initialization and DNA mutation, in a format so that it can be used for initialization next time if somebody decides that he likes the performance of the AI player. The goal is to enable training of AI without modifying the .cc file and necessary recompilation. Editing the .cc file is complicated and requires some formatting woodoo. Top Quote |
Tibor Topic Opener |
Posted at: 2017-06-05, 19:39
So I managed a cool hack - purely within interactive_base.cc. Auto-adjusting speed of game to keep avg fps within 13-15 fps. Very very cool and useful for testing of AI!!! Top Quote |
GunChleoc |
Posted at: 2017-06-06, 08:12
You could use the Profile format for writing and loading the AI initializations. You can see a small code example on how it's used in the Options panel, and in Using LuaTable instead would allow you to have a structure that's easier to understand, but we don't have a good writer for it. I do have a working Lua writer in a branch, but it's a bit hacky and tricky to use because I was too lazy to write a proper parser. Busy indexing nil values Top Quote |
Tibor Topic Opener |
Posted at: 2017-06-06, 08:35
this probably belongs to the other thread. I will look at it, though I am bit afraid of it Top Quote |