Currently Online

Latest Posts

Topic: Empire Mission 4

hessenfarmer
Avatar
Topic Opener
Joined: 2014-12-11, 22:16
Posts: 2651
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2017-10-31, 20:46

yes in fact I think it is the algorithm to check whether the enemy has been seen. I have no idea how to improve this but would appreciate any help.


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 19:48
Posts: 2441
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-11-01, 09:28

From what i can see the function enemy_seen() gathers all border fields:

if field.owner == p2 and (field.trn.owner ~= p2 or field.rn.owner ~= p2 or field.brn.owner ~= p2 or field.bln.owner ~= p2 or field.ln.owner ~= p2 or field.tln.owner ~= p2) then 
            table.insert(enemy_border, field)
         end

There are a lot of comparisons. Have you tried just to gather all owned fields? So the array get much bigger, but iterating it to get sees_field is maybe faster than all those comparisons? Just an idea.

Isn't it possible to make the comparison of sees_field directly in the first loop? Maybe something like this:

if field.owner == p2 and p1.sees_field(field) then 
            return enemy_field_seen
         end

Maybe i have logical errors here face-smile.png


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
hessenfarmer
Avatar
Topic Opener
Joined: 2014-12-11, 22:16
Posts: 2651
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2017-11-01, 12:21

Very good idea. I wanted to make the comparison fast and eventually did exactly the contrary thing. will try it today and report bach tonight.

thanks for the help


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 19:48
Posts: 2441
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-11-01, 20:17

To speed up testing you can create a lua file like this test.lua. Then open a normal game and open the scripting console per hitting F6. There you could run the file by typing:

dofile("/path/to/the/test.lua")
Edited: 2017-11-01, 20:17

Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
hessenfarmer
Avatar
Topic Opener
Joined: 2014-12-11, 22:16
Posts: 2651
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2017-11-02, 23:39

hi everybody, finally things are getting closer. New revision is uploaded.
- fixed the performance issue in check enemy with the simplified code of kaputtnik. many thanks.
- prevented the foresters house objective if no old forester exists anymore.
- stopped running check_ enemy after heros objective beeing fired.
- improved the map (tried to avoid water on steep triangles cause it looks weird
- improved the image of the fremil mayor to not look like a clone of Lutius

Hope this will fit now. Anyhow feel free to comment if there is anything still to be improved. But if no comments will be received within a week or so I'll give it a try and start a merge request eventually.

regards hessenfarmer


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 19:48
Posts: 2441
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-11-03, 08:03

Hm, i can't build any building because the buildings menu do not pop up, instead another menu pops up when clicking on a free buildings space. This happens also after i get enough resources for a new building, e.g. Lumberjack.

First i merged latest trunk and startet from trunk with the option --datadir. After encountering the missing buildings menu i compiled the Mission4 branch but the result is the same. Starting a normal game the buildings menu pops up.

Last weekend it works, so i guess there are now some changes implemented which prevent the buildings menu to pop up?

Edited: 2017-11-03, 08:03

Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
hessenfarmer
Avatar
Topic Opener
Joined: 2014-12-11, 22:16
Posts: 2651
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2017-11-03, 16:51

That change was introduced at rev8429 due to comments in this thread. I forbade all buildings until the first objective cleared to prevent this objective to become unfulfillable due to new build quarries . But I will reconsider to allow at least lumberjacks and wells to be build. Perhaps I will only forbid quarries and fisherhouses. Need to think about this


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 19:48
Posts: 2441
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-11-03, 20:45

Please do not make it too complicated. It is already a challenging campaign.... i am not sure if i would solve it on first try. If you allow buildings, it is also challenging to not get out of resources.

Just my opinion face-smile.png


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
hessenfarmer
Avatar
Topic Opener
Joined: 2014-12-11, 22:16
Posts: 2651
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2017-11-03, 22:15

Ok promised it will not be more complicated. Anyhow I try to cope with any possible user decision in the direction that the scenario will still work if you don't play straight to the objectives. E. g. in the last revision the forester objective is only triggerd if at least one of the crippled foresters is still on the map. Otherwise ( the player has fixed this issue already) the message will not be triggered due to it would not make any sense. same with other objectives. the plan is to have a demanding scenario which is not quite linear.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-11-04, 08:17

That sounds very interesting - it will also increase replayability if objectives depend on player action face-smile.png


Busy indexing nil values

Top Quote