New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI: problems with ai.get_new_enemy_dst_src and related functions #2346

Open
mattsc opened this Issue Dec 31, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@mattsc
Member

mattsc commented Dec 31, 2017

Migrated from the EasyCoding wiki page:

ai.get_new_enemy_dst_src and related functions have several problems:

  • They use the current moves of the enemy units, which generally are all zero.
  • Hexes occupied by other enemy units count as not reachable.
  • Working around this with a Lua wrapper makes this actually slower than ai_helper.get_enemy_dst_src, which makes the functions pretty much useless, as speed is the only thing speaking for them.

@mattsc mattsc added the AI label Dec 31, 2017

@CelticMinstrel

This comment has been minimized.

Member

CelticMinstrel commented Dec 31, 2017

This has been done as a Lua wrapper, but I guess porting that to C++ would be a good idea.

@mattsc

This comment has been minimized.

Member

mattsc commented Jan 1, 2018

I just checked and the first two bullets have not been taken care of, the problems remain. The Lua wrapper mentioned in the third bullet is one that would take care of the first two bullets, but that's already done anyway in ai_helper.get_enemy_dst_src (although I personally do not like that that function returns an empty array for units that cannot move, rather than array with the units' locations).

In any case, this is a rather low priority, I think. Iterating over wesnoth.find_reach works just fine.

@CelticMinstrel

This comment has been minimized.

Member

CelticMinstrel commented Jan 1, 2018

The Lua wrapper I was referring to is actually defined in stdlib.lua and cache.lua (in data/ai/lua)... I wonder how that compares to the ai_helper functions? It should be available automatically, in place of the functions like get_new_enemy_dst_src, to any AI that doesn't explicitly initialize the Lua [engine] (ie, one that doesn't have an [engine] tag for Lua).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment