Topic: AI: init.lua blocks the game
Tibor Topic Opener |
Posted at: 2014-01-29, 18:21
Hi,
Top Quote |
SirVer |
Posted at: 2014-01-30, 13:56
I think everything is working as intended, the problem is just that you have nothing on your map - i.e. you have no buildings that give you vision. When you are running a scenario, none of the other starting conditions of the game are loaded by default, so you have to place your headquarters and so on yourself. Take a look at the scenarios in campaigns/ - they all place headquarters. You can also use some of the starting conditions by use()ing them. Top Quote |
Tibor Topic Opener |
Posted at: 2014-01-30, 21:48
Well, this is not the best news, but not the worst either. Allright I will investigate it. But this is another obstacle and another additional work This practically means that as by now plug&play LUA AI is not possible. I mean, it is not possible just attach any potential LUA AI to any random map... Top Quote |
SirVer |
Posted at: 2014-01-31, 07:22
This only works if all players are defined as barbarians in the the map though.
There are ways: Start a game on the map you are interested in with the configuration of players you want to test (make sure the player you want to control is set to the None AI). Safe the game. Load the safegame from the commandline (--loadgame) and start your script immediately (--script). Of course this will not work in multiplayer games, but it should be enough to get you started. Edited: 2014-01-31, 07:23
Top Quote |
fk |
Posted at: 2014-01-31, 12:51
Top Quote |
Tibor Topic Opener |
Posted at: 2014-01-31, 20:39
SirVer, it works flawlessly, thanks!!! Top Quote |
SirVer |
Posted at: 2014-01-31, 20:55
This is a 'feature' of the Lua langue:
This quote is from "Programming in Lua": http://www.lua.org/pil/5.html Top Quote |
SirVer |
Posted at: 2014-01-31, 20:56
Glad to be of service - actually all this discussion got me interested in writing a Lua AI too - if there were not sooo much more work to be done for Widelands Top Quote |
Tibor Topic Opener |
Posted at: 2014-01-31, 21:10
Today I spent some time on a road algorithm, though an algorithm itself is logical and reliable, to put it into lua is too complex for me. I am thinking about other approach now... BTW, what is miss most in LUA is break and continue Top Quote |
SirVer |
Posted at: 2014-01-31, 22:00
break is in the language. In lua 5.2 there is also goto which can simulate a continue - unfortunately, lua 5.2 support will only be merged after b18. Top Quote |