A New Land Era

It's not easy creating an entire faction or era. Post your work and collaborate in this forum.

Moderators: Forum Moderators, Developers

Re: A New Land Era

Postby Robertdebrus » March 28th, 2017, 10:47 pm

This is not dead, I have been working on this!

I have updated ANLEra to 1.4 on the 1.13 add-ons server.

Many fixes and bettering of code, updated units, (such as the extremely weak Orcish Shaman,) and a mod for SP/MP that allows all lvl 0s to build.
User avatar
Robertdebrus
 
Posts: 14
Joined: May 16th, 2014, 10:02 pm

Re: A New Land Era

Postby Wayirr » October 8th, 2017, 12:01 pm

Add-on falls to load with a error message:
Code: Select all
error config: Macro/file '~add-ons\ANLEra\utils\buildings\buildings_drake.cfg' is missing
at ~add-ons/ANLEra/utils/buildings.cfg:3
    included from ~add-ons/ANLEra/ANLEra.cfg:21
    included from ~add-ons/ANLEra/_main.cfg:10


The likely reason for this is use of invalid file separator '\', Battle for Wesnoth only allows / character to be used as path separator.

Full list of files with invalid separator:
Code: Select all
ANLEra/scenarios/ANL_utils/buildings/buildings.cfg
ANLEra/scenarios/ANL_utils/buildings.cfg
ANLEra/utils/buildings/buildings.cfg
ANLEra/utils/buildings.cfg
ANLEra/buildings.cfg


Another problem with add-on is using () in file name:
Code: Select all
ANLEra/images/units/drakes/worker-fly-1-(2).png


() are special characters, they should not be used in file name, even if operating system allows them.

This sprite is not used anywhere, so it can be safely removed or renamed. It also looks like a copy of one of drake fighter picture.
If you want a unit which looks exactly same as existing unit, you can use
[base_unit] instead of copying whole file and only add properties you want.
Alternatively you can copy file but keep all image references on place.
Wayirr
 
Posts: 55
Joined: February 11th, 2012, 3:42 pm

Re: A New Land Era

Postby jyrkive » October 8th, 2017, 12:35 pm

Wayirr wrote:Add-on falls to load with a error message:
Code: Select all
error config: Macro/file '~add-ons\ANLEra\utils\buildings\buildings_drake.cfg' is missing
at ~add-ons/ANLEra/utils/buildings.cfg:3
    included from ~add-ons/ANLEra/ANLEra.cfg:21
    included from ~add-ons/ANLEra/_main.cfg:10


The likely reason for this is use of invalid file separator '\', Battle for Wesnoth only allows / character to be used as path separator.


To be exact, the macOS and GNU/Linux operating systems don't allow backslashes as path separators. Wesnoth itself allows them, although we're planning to ban them in 1.13.11.
jyrkive
Developer
 
Posts: 22
Joined: July 7th, 2016, 6:20 pm
Location: Helsinki, Finland

Re: A New Land Era

Postby Robertdebrus » October 8th, 2017, 1:58 pm

Thanks for finding that! I will try to get fix out tonight!
User avatar
Robertdebrus
 
Posts: 14
Joined: May 16th, 2014, 10:02 pm

Re: A New Land Era

Postby Wayirr » October 8th, 2017, 2:59 pm

Fix should be as simple as opening the files in text editor and changing \ into / via replace function. You don't seem to use \ anywhere else in the affected files.

PS. After more research:

I do not think you really need to keep duplicate files building.cfg, one in utils and other in utils/buildings

Actually, you can remove utils/buildings/building.cfg and replace content of utils/building.cfg with this two lines:
Code: Select all
#textdomain wesnoth-ANLEra

{./buildings}


./ should make it include everything from subdirectory, using relative path.
Wayirr
 
Posts: 55
Joined: February 11th, 2012, 3:42 pm

Re: A New Land Era

Postby Shiki » October 8th, 2017, 6:07 pm

I came across a few more things:

1) It was enough to change \ to / in utils/buildings/buildings.cfg to get the add-on loading.
This means that the other places mentioned a few posts before are not needed.

2) Wesnoth requires all add-ons to be in utf8. It seems that the encoding in use is what windows uses by default. What windows uses by default is dependent on the language, it will be sth. like cp12xy, e.g. cp1251 or cp1252.
An example of where it causes problems:
scenarios/ANL_utils/ANL_help.cfg lines 69 and 111: The — and ‘ ’ signs.
I noticed it also in the message which is displayed when your mines or farms produce more gold.
To fix this you need an editor which can save files in utf8. Notepad is not one of them.
After that remains the problem that the code is already written. 4) might remove many cases.
If you want to be sure you can look what encoding your windows uses, and convert it with some tool.

3) Many parts of the text are copied from mainline, but are displayed in English. This is due to the textdomains. Have a look here: https://wiki.wesnoth.org/Wescamp (Wescamp is dead, but the explanation for textdomains are still valid.)
Feel free to ask if you have some questions about it.
I think it would be relatively easy to translate the add-on, since not so many new strings are used.

4) What I would recommend and which would cover some of the problems:
Many parts are copied from mainline - include them directly from mainline
This will leave you with less code to maintain, and easier to keep it up to date.
Code: Select all
{~multiplayer/scenarios/ANL_utils/}

This should include all. For the macros which need modifications, you can change them like:
Code: Select all
#undef LEADER_OPTIONS
#define LEADER_OPTIONS
... the copied part + your modifications. Your text editor MUST use utf8 when copying.
... in case you add new strings in this part you need to switch the textdomains in-between
... in case that the stings are in another file and you just include them with a macro it's not necessary.
#enddef

You don't have to worry about in which order the macros are defined and used, that will the preprocessor do for you.

5) In ANLera.cfg, lines 22-36
Good to see that you are already using 1.13. This part can be 1.12 compatible if you wrap a
Code: Select all
#ifver WESNOTH_VERSION >= 1.13.1
around it.

6) I'm not sure why there are two eras. Maybe you can specify in the description which one to use for what, or unify them?

7) As for gameplay bugs: I tested with setting the other players to the AI.. After a few rounds, there comes a message for each AI side (enemies and friends) that they can now recruit a new unit, and they can.

8) If a enemy goes onto a castle hex, it's not destroyed. Maybe 4) solves this too.

9) You don' need to include images the same way like .cfg files. (e.g. in images/images.cfg)
That's already done by the [binary_path] in _main.cfg.
Wesnoth's core units (unlike the campaign specific units) are as well using a binary_path - so you don't need to copy the image for e.g. the zombie into the add-on.

That's all what I found.
If you set up an repo at github I may contribut the one or other patch.
Maintainer of Era of Myths.
Shiki
 
Posts: 117
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: A New Land Era

Postby Robertdebrus » October 9th, 2017, 2:46 am

Wayirr:

Thank you for the time you spent looking at this, that fix should be uploaded by tonight
That drake file was an accidental copy, thanks!
The "Worker Drake" is supposed to be smaller and have no warblades, but I never got around to taking the blades off all of them, and there may be some wrong ones still. There is a lack of drake art for lvl 0 that look similar to mainline drakes, and I am not an artist.

Shiki:

Thank you so much for this helpful explanation. I am rather new to programming, and so many of these things had not even occurred to me.

I do have it in GitHub: https://github.com/Robertdebrus/ANLEra
This version is for 1.13
If you would like to help, feel free!

What version of Wesnoth are you using?

1) Yup

2) I use Notepad++, but I had not known that I needed to use UTF-8 formatting. Thanks!

3) Thanks for the link to the explanation!

4) For some of the macros this could work. It seems that I might need to clean out things that are not needed. Some of the files are copied, yes, but the entire file is different. (For instance, the worker_options is totally different now, and supports far more terrains. leader_options is far bigger, because of the different options for different leaders.)

5) Good point!

6) I do believe that in the one on GitHub I have remedied that by getting rid of ANLEra_maps. (This was a quick fix because using my era with my maps was somehow giving double, because it was calling everything twice. I think this behavior is fixed now.)

7) This is intended to give them more units, like how the player gets more, similar to the original map, where the enemies get gradually tougher. It still could use some work

8) I will look into that. I think that it should be only AI that can do this, because Human players would exploit this. (Cavalry raids destroying a player's economy and overpowering them by burning everything.) However, this could add more strategy to the game. I think that castles, however, would not get destroyed, because a skirmisher could stop you from training quite easily if not taken care of.

9) Again, thanks, I had forgotten.

And again, thanks for the advice and information. I had not known about many of these things, and they will be useful!

I do think that the repo at GitHub is a bit more updated, so give that a look.

I also will definitely make sure that the 1.12 version runs, but my main focus is on 1.13, with 1.14 looming around the corner(ish)
I would like for it to have the same code run on all three versions.

I think I got everything, if there is something I missed, or you have any more questions, please let me know!
User avatar
Robertdebrus
 
Posts: 14
Joined: May 16th, 2014, 10:02 pm

Re: A New Land Era

Postby Shiki » October 9th, 2017, 4:31 pm

You're welcome.
I used 1.12 when I tested, though I use 1.13 too. Focusing on 1.13 is best.
Can you check what encoding was used for the files? I'll have a look at changing it then.
7) ended up in my case with an loyalist recruiting skeletons.
Maintainer of Era of Myths.
Shiki
 
Posts: 117
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: A New Land Era

Postby Wayirr » October 9th, 2017, 5:45 pm

Why do you ask about encoding? Anyway, it's easily done in shell:
Code: Select all
$ LC_ALL=C grep -Ir $'[^\001-\176]' . | grep -av $'[\uFFFD’—]' | iconv -f cp1252
./utils/ANLEra_help.cfg:        message= _ "Any of the ‘Elvish’ style villages represent universities. At the start of your turn, Mages in universities automatically add to the study progress of your chosen research target. Right-click on a mage in a university to change research target."
./utils/ANLEra_help.cfg:                        caption= _ "A New Land — Help"

This file seems to be in Windows codepage. Should be reencoded into UTF-8

Code: Select all
$ LC_ALL=C grep -Ir $'[^\001-\176]' . | grep $'\uFFFD' | cut -d: -f1 | uniq
./utils/ANLEra_research_options.cfg
./utils/ANLEra_special_macros.cfg

These two files are in garbled up UTF-8, apostrophe has been replaced with � (Unicode replacement character). Only way to fix them is to replace it with apostrophe.

Code: Select all
$ LC_ALL=C grep -Ir $'[^\001-\176]' . | grep '[’—]' | cut -d: -f1 | uniq
./units/dwarves/Dwarvish_Witness.cfg
./units/outlaws/Rogue_Mage.cfg
./units/elves/Sorceress.cfg
./units/elves/Civilian.cfg
./scenarios/4p_A_New_Land.cfg
./scenarios/4p_The_Wall.cfg
./utils/abilities.cfg

Most of files are already in UTF-8, no need to do anything.

In 1.12 version there are more affected files:
Code: Select all
$ LC_ALL=C grep -Ir $'[^\001-\176]' . | grep �
./scenarios/ANL_utils/ANL_research_options.cfg:                message= _ "$player_$side_number|.name|�s farms now produce $player_$side_number|.farming.gold gold."
./scenarios/ANL_utils/ANL_research_options.cfg:                message= _ "$player_$side_number|.name|�s mines now produce $player_$side_number|.mining.gold gold."
./scenarios/ANL_utils/ANL_special_macros.cfg:            message= _ "Let�s cut you free!"
./utils/ANLEra_research_options.cfg:                message= _ "$player_$side_number|.name|�s farms now produce $player_$side_number|.farming.gold gold."
./utils/ANLEra_research_options.cfg:                message= _ "$player_$side_number|.name|�s mines now produce $player_$side_number|.mining.gold gold."
./utils/ANLEra_special_macros.cfg:            message= _ "Let�s cut you free!"


Files utils/ANLEra_help.cfg scenarios/ANL_utils/ANL_help.cfg are duplicates, both in cp125*
Code: Select all
$ diff -u0 utils/ANLEra_research_options.cfg scenarios/ANL_utils/ANL_research_options.cfg
--- utils/ANLEra_research_options.cfg   2017-10-08 23:23:11.187186419 +0800
+++ scenarios/ANL_utils/ANL_research_options.cfg        2017-10-08 23:23:11.181186494 +0800
@@ -121 +121 @@
-                       {PICK_RECRUIT_OPTION ("units/elves-wood/archer.png~TC($side_number|,magenta)") "Elvish Archer" _"Elvish Archer" troop_1}
+                       {PICK_RECRUIT_OPTION ("units/elves-wood/archer.png~TC($side_number|,magenta)") "" _"Elvish Archer" troop_1}
$ diff -su0 utils/ANLEra_special_macros.cfg scenarios/ANL_utils/ANL_special_macros.cfg
Files utils/ANLEra_special_macros.cfg and scenarios/ANL_utils/ANL_special_macros.cfg are identical

Files utils/ANLEra_research_options.cfg and scenarios/ANL_utils/ANL_research_options.cfg are almost same, but one strings differ. Both have garbled UTF-8, � in place of apostrophe.
Files utils/ANLEra_special_macros.cfg and scenarios/ANL_utils/ANL_special_macros.cfg are duplicates. They too have � in place of apostrophe.
Wayirr
 
Posts: 55
Joined: February 11th, 2012, 3:42 pm

Re: A New Land Era

Postby Lordlewis » October 13th, 2017, 9:38 pm

Not sure if anyone has said this yet but for some reason I can't cut down or grow trees anymore. It happened ages ago and it was an update as far as I now, also when I could cut down trees if I kept right clicking on a different that one would turn into the grass patch instead on the one with the unit cutting it. The reason why this is so bad is that you can destroy the enemy's keep so he/she can't recruit anymore. It's a bit cheaty is what I'm saying.
GOLD IS GREAT!
Swat them bugs!
User avatar
Lordlewis
 
Posts: 125
Joined: July 20th, 2016, 11:15 am
Location: All around, every where. All in one place yet I'm there.-Lordlewis

Previous

Return to Faction & Era Development

Who is online

Users browsing this forum: No registered users and 3 guests