Xudo questions about WML.

The place to post your WML questions and answers.

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.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Xudo questions about WML.

Post by Dugi »

That should be fine, but you may try to make from it a custom event that is used only once and fired in both cases with the target unit as primary_unit. Custom events are very similar to functions in normal programming languages.
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: Xudo questions about WML.

Post by Xudo »

Dugi wrote:you may try to make from it a custom event that is used only once and fired in both cases
I think there is no benefit of custom events in this case. Macroses are easier to read and they follow simple logic.
I can think of three meaningful uses of custom events:
1. To break large switch tag, used multiple times. I have faced this case when I have tried to improve Zombie apocalypse RPG
2. To decrease savefile size. For example I have used this macro two times. After macro substitution, I will get two same pieces of code.If I create the custom event, I end up with a single piece of code (with some overhead). Size of save file is not an issue for now, so I decided to keep code simpler.
3. To use this event from lua. I will use lua only when I will face real trouble with perfomance, or when I will create custom UI. Neither is going to happen in foreseeable future.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Xudo questions about WML.

Post by Dugi »

Xudo wrote:Macroses are easier to read and they follow simple logic.
As long as they don't hide a fire_event themselves with the event being elsewhere.

And the save file size is not an issue now, when your add-on doesn't contain much code. It will become an issue if you will continue following this philosophy.
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: Xudo questions about WML.

Post by Xudo »

It will be better if you tell me what do you think about the idea of drawing sprites of weapons with transparent areas for hands.
May be it is better to use three layers: unit layer, weapon layer(without transparent areas) and hands layer.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Xudo questions about WML.

Post by Dugi »

I am not sure why do you need to separate the hands at all. Why can't be the hands attached to weapons on one layer? The hands are to be the connection between the weapons and the body and any position of weapons will be correlated with a position of the body. Or you want to add a race that would have darker hands?
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: Xudo questions about WML.

Post by Xudo »

I want to allow different weapon grip for same weapon. Goblins, mermans and humans might use same spear, but i cant just re-color human hands to get goblin.
I want hands to look armored too.

I also think a bit about using pure red, green and blue instead all other colors. Thy can be chaged to any other color with image path functions.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Xudo questions about WML.

Post by Dugi »

So make the hands a part of the body, no?
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: Xudo questions about WML.

Post by Xudo »

But it should look like unit actually hold the weapon, not just weapon over unit.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Xudo questions about WML.

Post by Dugi »

Don't draw the part of the weapon that is to be hidden by the hand. It will look like if it was behind the hand. The rest of the weapon can be before the unit
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: Xudo questions about WML.

Post by Xudo »

You have described current concept.

The problem is: small or large creatures might not fit to the transparent area of weapon.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Xudo questions about WML.

Post by Dugi »

So make the transparent area half-infinite: you can't see the other end of weapon, hiding it somewhere behind the hand. It is quite realistic to show 1-2 pixels of the hilt's end at the other side of the hand, but you can ditch this to increase versatility.

An alternative approach is to make the size of all hands have an equal size in pixels. Shading can make quite a difference in its apparent size (this is how can women's make up change the apparent size of nose).
User avatar
Xudo
Posts: 563
Joined: April 3rd, 2009, 5:26 pm

Re: Xudo questions about WML.

Post by Xudo »

Does anyone tried to figure out: How many simple units should be on the map to make Wesnoth unplayable?
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Xudo questions about WML.

Post by Dugi »

Once I created a scenario that was supposed to generate a few units in a while cycle and I made a mistake in the iterator and it kept looping and looping. There was maybe 500 units when it started with weird behaviour and after some more iterations it used so much RAM that I had to kill the process (that is, terminate wesnoth.exe). So, I suppose that more than a few hundreds is too much.
User avatar
Ravana
Forum Moderator
Posts: 2952
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Xudo questions about WML.

Post by Ravana »

For me after ~1800(out of 2256, checked array size before) they didnt show up on map, wml filter found them still though. After that I have used to_variable= for some more filtering and placing on map only those that need my attention.
Post Reply