Latest Posts

Topic: scenario AI

Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-03-31, 08:49

@kaputtnik Videos look great!!!


Top Quote
SirVer

Joined: 2009-02-19, 14:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2017-03-31, 11:44

The random one looks amazing! But it should probably be faster and not depend on the size of the area being revealed - i.e. constant time. It looks really awesome though!


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

Thanks face-smile.png

For the curtain: I think it would be nice to have lua acces to the state where a field is 'half' hidden. I guess it's the state 'seen' but hidden (no military or other thing has sight to it). This state appears for example if a military building on the border is dismantled. Having access to it (set/reveal it) would make the curtain much smoother. Anyway my code to extract rows seems not to work correct.

I have adjusted the random hide/reveal to make it dependent of time and number of fields. That looks better face-smile.png Current code looks like this (for reveal):

function random_reveal(plr, region, time)
   -- if no time is given the default '1000' (1 sec) is used
   if not time then time = 1000 end
   -- Calculate the sleep as integer
   delay = math.floor(time / #region)
   -- Create a table with randomized fields
   -- This is done for efficience reasons
   rand_tbl = {}
   while #region > 0 do
      f = math.random(1, #region)
      table.insert(rand_tbl, region[f])
      table.remove(region, f)
   end
   --reveal field by field:
   for i, f in ipairs(rand_tbl) do
      plr:reveal_fields({f})
      sleep(delay)
   end
end

I am unsure about the table rand_tbl. Prior i used reveal_fields() directly in the loop with random, like here for random_hide() (call of hide_fields() instead of reveal_fields()):

function random_hide(plr, region, time)
   if not time then time = 1000 end
   delay = math.floor(time / #region)
   while #region > 0 do
      f = math.random(1, #region)
      plr:hide_fields({region[f]}, true)
      table.remove(region, f)
      sleep(delay)
   end
end

I guessed that removing a value from a Lua table is much time consuming, because the remaining values have to be shifted. The time used for shifting may has to be added to the time for sleep(). Don't know if this could be measured... in some small tests i can't see any noticeable difference, if an extra table is used or not. Any hints?


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

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 19:48
Posts: 2439
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-04-02, 21:29

Here is another one:

Concentric reveal/hide

Code:

function concentric_reveal(plr, center, max_radius, delay)
   if not delay then delay = 100 end
   local steps = 0
   while steps < max_radius do
      plr:reveal_fields(center:region(steps))
      steps = steps + 1
      sleep(delay)
   end
end

function concentric_hide(plr, center, max_radius, delay)
   if not delay then delay = 100 end
   while max_radius > 0 do
      local to_hide = center:region(max_radius, max_radius - 1)
      plr:hide_fields(to_hide, true)
      sleep(delay)
      max_radius = max_radius -1
   end
   -- Hide the remaining field
   plr:hide_fields({center},true)
end

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

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

Extra sleep time needed for shifting the table is probably below 1ms, so I'd say we don't need to do anything for that.

The concentric is better for the timing, but the random looks prettier... decisions, decisions. Maybe random for a maximum radius, followed by concentric? I definitely like concentric better than curtain.

As to the new function needed, please add it to the bug. It will be a few weeks until I can resume programming.


Busy indexing nil values

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

Hi everybody, I just uploaded latest revision of my branch 8342 containing following changes
8340:
- fixed my function to call the new economy options to work correctly
- added kaputtniks animated reveal / hide funtions to helper_functions.lua
- chose random reveal and hide for the region where the ship is placed, because it fitted best to the storyline of a ship in a stormy cloudy night.
- chose concentric reveal for revealing the start region around the provisional HQ because it fitted best to the story of getting more and more sight the morning after the shipwreck. (many thanks to kaputtnik for the code
- fixed the texts of the objective to collect the pieces of the shrine, because I discovered that I hided 6 pieces instead of 5 to the map. (@kaputtnik: may I beg you to add another piece to your image of saledus the missing artifact is the same as the upper right one)
- fixed the height of the message boxes containing objectives to improve readability.
8341: - made some changes to the map to add some gold on the island in the south west of the HQ
8342: - fixed the path to the background image to be displayed while loading the mission (also for empire mission 2)

From my side I consider the scenario mature now as I tested it with all of the changes and it worked very well and nicely balanced even for a not so experienced player. Only exception is the english wording of my texts.
@ Tinker: that is where your part comes in. I will upload the scenario file to my dropbox in an instant. But you have to grab the correponding build from appveyor to be able to run it (approx 180 MB) (correct build would be 1910 or 1916 if hopefully successful)

@ widelands-dev: after Tinker has done the proofreading of the texts I will upload the texts.lua again and then I'd like to propose it for merging

best regards hessenfarmer


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 19:48
Posts: 2439
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-04-06, 06:56
  • added kaputtniks animated reveal / hide funtions to helper_functions.lua

I am preparing a branch for those functions and put them into a global file to be able to use the animations also in other campaigns. The branch misses the changes to other campaigns yet.

  • fixed the texts of the objective to collect the pieces of the shrine, because I discovered that I hided 6 pieces instead of 5 to the map. (@kaputtnik: may I beg you to add another piece to your image of saledus the missing artifact is the same as the upper right one)

Yes, will do.

I am very busy with normal work, so i have less time for widelands these days... it may take some time to make the changes.


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

Top Quote
Ex-Member
Avatar
Joined: 2014-09-12, 09:53
Posts: 184
Ranking
Widelands-Forum-Junkie
Posted at: 2017-04-06, 10:43

I cannot find the d/l all I see is emp03.wmf.old and I have no idea what you are talking about with appveyor, it seems to be something to do with windows installs which are of no use to me, I have r8329 widelands.


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

Which operating system do you have? I could also do the first proofreading round and merge into trunk. You could do your proofreading on the trunk version then, and we can hold off on adding the translations to Transifex until you're done.


Busy indexing nil values

Top Quote
Ex-Member
Avatar
Joined: 2014-09-12, 09:53
Posts: 184
Ranking
Widelands-Forum-Junkie
Posted at: 2017-04-06, 17:43

I use arch linux but I also have a transifex account so I can do real English (not american) and nederland translations.


Top Quote