How many coordinates can a single moveto event handle?
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Re: How many coordinates can a single moveto event handle?
Did he?
Anyway, I'm heading away from using coordinates (too risky).
I'm exploring the possibility of using either an invisible terrain overlay, or a time zone area. In both cases the game wouldn't care if the trigger area is a single hex or covers randomly 99% of the map.
Anyway, I'm heading away from using coordinates (too risky).
I'm exploring the possibility of using either an invisible terrain overlay, or a time zone area. In both cases the game wouldn't care if the trigger area is a single hex or covers randomly 99% of the map.
Re: How many coordinates can a single moveto event handle?
another option coudl be to use wml attribues as map, liek habng a table
[bad_locs] 12_3=yes 24_2=yes ... [/bad_locs]
and then use [filter_condition] [variable] name = "bad_locs.$x1|_$y1|" equals=yes
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: How many coordinates can a single moveto event handle?
[store_locations] works like [store_unit], and put the locations in an array. The wiki is your friend. But if invisible overlays will work, that would be easy.kurt751 wrote:Store where, how?
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: How many coordinates can a single moveto event handle?
That's just another way to have the game sift through a huge list of coordinates, isn't it? Given the game will have to do it each time the player moves an unit, won't it risk bogging down the game the same way?gfgtdf wrote:another option coudl be to use wml attribues as map, liek habng a table[bad_locs] 12_3=yes 24_2=yes ... [/bad_locs]
and then use[filter_condition] [variable] name = "bad_locs.$x1|_$y1|" equals=yes
Re: How many coordinates can a single moveto event handle?
This way takes only memory, but would have constant time no matter how many locations you have.
Re: How many coordinates can a single moveto event handle?
I see. Given I'm not very comfortable with advanced programming stuff, I'd rather avoid the opportunity to make stupid errors.beetlenaut wrote:[store_locations] works like [store_unit], and put the locations in an array.kurt751 wrote:Store where, how?
Friend, friend... An acquaintance, I'd say...beetlenaut wrote:The wiki is your friend.
It would work, I just have to find out how to do it. Do you make overlays the same way as custom terrains?beetlenaut wrote:But if invisible overlays will work, that would be easy.
The invisible overlay is the only easy way I see, since the time zone area thing apparently won't work (I just tried): The game doesn't recognize "area=someID" as valid WML, so it triggers all the time.
Re: How many coordinates can a single moveto event handle?
I see. Even if there are hundreds of coordinate pairs? Astonishing. (But then I'm not a programmer, in case I didn't say it...)Ravana wrote:This way takes only memory, but would have constant time no matter how many locations you have.
I'd rather go for something simple nevertheless, something I can wrap my mind around. (Yes, I know, that severely limits the choices... )
First, it would help me avoid bugs and errors, second it would speed things up, preventing me from wasting days on what should normally only take an hour. I'm well past the 50% completion mark, but September is already here.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: How many coordinates can a single moveto event handle?
Yes. You can just use a blank image. If you're clever it can be visible in the editor, but not in the game. (I have a terrain like this in Secrets of the Ancients if you want to see an example. It's code is ^Nhyr in the terrain files.) But you don't really have to do it yourself if you don't want to. The castle overlay doesn't do anything without an adjacent keep.kurt751 wrote:Do you make overlays the same way as custom terrains?
Storing units and locations is one of the most basic functions of WML! Half the scenarios I've ever written required one or the other. There is going to be a lot you can't do if you view them as too advanced.kurt751 wrote:Given I'm not very comfortable with advanced programming stuff...
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: How many coordinates can a single moveto event handle?
Weel variable lookup is O(log n) which is not constant but still much better than O(n) which a locatios list (as given by store_locations) would take.Ravana wrote:This way takes only memory, but would have constant time no matter how many locations you have.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: How many coordinates can a single moveto event handle?
Yes, I already made my terrain.cfg and terrain-graphics.cfg (containingbeetlenaut wrote:Yes. You can just use a blank image. If you're clever it can be visible in the editor, but not in the game.
{EDITOR_OVERLAY *^TCtrigg unwalkable-editor}
). What I'm wondering is how the game knows where to look for them. Does it check all the known folders? I've put mine in /add-ons/MyCampaign/utils.Except I'm already using them (for an invisible castle)...beetlenaut wrote:The castle overlay doesn't do anything without an adjacent keep.
No problem, I made my own terrain, it's not like it's difficult to make since it doesn't have any graphics... Took me 10 minutes trying to guess the syntax from the core files and 20 seconds to make.
Yes, it's basic, but until somebody gives me the secret password of how to use it I'll avoid. The problem is I never know what the game expects to be fed with, and the WML Reference guide is just a sterile list of options, with no examples and minimalistic explanations.beetlenaut wrote:Storing units and locations is one of the most basic functions of WML!
I guess BfW programmers know instinctively how to formulate stuff ("it's just like C" or some such), but common people are really fighting to understand. Everything obvious to a programmer is for us a riddle we have to guess the solution of. It gets tedious.
My goal here is to make a nice campaign, and WML is a means, not a purpose; I don't want to spend a day each time I want to do something which normally should take 15 minutes.
Re: How many coordinates can a single moveto event handle?
Hm. This phrase looks like english, uses apparently english words, yet I didn't understand a single one...gfgtdf wrote:Weel variable lookup is O(log n) which is not constant but still much better than O(n) which a locatios list (as given by store_locations) would take.
I hope you were talking to Ravana.
Anyway, I'll use a custom overlay for my triggers. Thank you everybody for your time and effort!
Re: How many coordinates can a single moveto event handle?
I didn't have any doubts about it...
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: How many coordinates can a single moveto event handle?
To be clear: coordinates are not the issue: WML is the issue.kurt751 wrote:Anyway, I'm heading away from using coordinates (too risky).
My point was that if you're looking at processing just a few "things" (in this case, coordinates) WML is fine. This is why processing the entire map in HttT S12 is not an issue .. it processes a fraction of the map each turn until, at turn 40, it has processed the entire map.
But if you're looking at processing a lot, WML will be the issue and Lua the solution. This is why processing the entire map in HttT S13 was an issue .. and why I re-wrote the WML in LUA.
If the use is to load, basically, the entire map into a variable and, for an event, search that list once or twice (maybe even 30 or 40 times) for something, I would expect WML to perform "good enough". That is: the performance hit would be less than 1/20th of a second or so (basically not noticeable by a normal human).
But if the idea is to change the entire map to hills if a dwarf hits, and forest if an elf hits, you're going to want Lua.
I forked real life and now I'm getting merge conflicts.
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: How many coordinates can a single moveto event handle?
Gak. Big-O is so misleading. To begin, read it as "time on the Order of (X)" For those who don't know, here are some common notations:
O(1) means something take a constant amount of time.
O(log n) means something takes a bit longer for every added item, but the rate of increase tapers off toward zero as we add more items.
O(n) means something takes a bit longer for every added item, and the rate of increase remains about the same.
But it's all misleading.
O(1) taking a year is acceptable Big-O notation, just so it takes a year no matter if we have 1 or 1 billion items, even though it's terrible response time for a computer.
And if I can write an O(n) which is faster than your O(log n) or O(1) for all reasonable values of n, that does not make it worse than yours simply because it's O(n). Sure, your method may outperform mine if maps are allowed to be 8192-by-4096, but if maps are limited to 1024-by-512 and mine beats your there, which would you choose?
O(1) means something take a constant amount of time.
O(log n) means something takes a bit longer for every added item, but the rate of increase tapers off toward zero as we add more items.
O(n) means something takes a bit longer for every added item, and the rate of increase remains about the same.
But it's all misleading.
O(1) taking a year is acceptable Big-O notation, just so it takes a year no matter if we have 1 or 1 billion items, even though it's terrible response time for a computer.
And if I can write an O(n) which is faster than your O(log n) or O(1) for all reasonable values of n, that does not make it worse than yours simply because it's O(n). Sure, your method may outperform mine if maps are allowed to be 8192-by-4096, but if maps are limited to 1024-by-512 and mine beats your there, which would you choose?
I forked real life and now I'm getting merge conflicts.