Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info forum | HOMM4: info forum | HOMM5: info forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: Era II
Thread: Era II [ This thread is 107 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (17) 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 ]
Bersy
Bersy


Responsible
Supreme Hero
posted April 13, 2012 05:45 PM

Anyone is free to write those bindings to python. Era exports ExecErmCmd function to execute ERM on-the-fly. As far as I know, Sav on wog forum began doing it, but the work is not over, as always.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Draker
Draker


Known Hero
Building the Dragon City
posted April 13, 2012 06:37 PM

I've installed 2.1 on clean HoMM III Complete I have problem with current version of TEW IV. After using installmod.exe and Mods Manager Utility, ERA still don't see TEW IV, even a map is not displayed.

What I am doing wrong?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Responsible
Supreme Hero
posted April 13, 2012 06:43 PM

Download TEW from Era II mods topic.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Honorable
Undefeatable Hero
posted April 13, 2012 06:51 PM

Select ALL maps, TEW is not displaying in regular size columns.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Draker
Draker


Known Hero
Building the Dragon City
posted April 13, 2012 06:53 PM

Quote:
Download TEW from Era II mods topic.


Solved the problem. Thanks.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
majaczek
majaczek


Famous Hero
Work at Magic Dimmension
posted April 14, 2012 04:46 PM

@Bersy

Sorry I didn't mean to force you. Just I read what you have written and concluded you actually WANT some better script language than ERM, so i given the IDEA which one it should be. Sure any programmer with skills and knowing python is able to prepare headers and inter-library for ERA api, and perhaps name all that receiver like proper high-level language name (since ERA plugin can execute any erm command), so it really doesn't need the time of such important person like you Bersy. The reason why I shared the opinion about Python is because I already believed you wanted include support for "some script language better than erm" on your own, before me adoring Python :S. Okay I'm not forcing anything and perhaps some people would do it (I wouldn't work on it yet as it seems my time resources is five time lesser than it should, but once summer holiday happen I believe I would have time for more than just one project for H3). It seems a great starter project for ERA and would be really useful project (all those "Hello World!" are useless like somebody making himself/herself all the dates from his/her country history).

By the way: I seen that ERA plugin has ability to trigger some function from ERM via the API, and all triggers are actually hidden names for just functions (yeah I even read ERA sources a bit) in ERM. But is an ERA plugin actually able to answer some triggers? Are they able to catch all function calls (so handling events for all triggers, and numbered unnamed functions)? If it is already possible Python bindings would be even easy for somebody actually programming only scripts (scripter - not real programmer) and it would actually help more H3 modders know Python better, as Python seem to be main scripting language for VCMI (so double profit). Well it's a bit harder to do the bindings, than doing tutorial script in python but still easy.

So currently there are three possible projects for me for the holidays: Python wrapper to ERA API, fiddling with commanders, fiddling with stack experience. First is entirely possible for me once I have time, the other two need some learning on Reverse Engineering, and are not guaranted to succeed. I also have some Ideas for mods which doesn't need to be plugins: Better Version of Enchanced Commanders script, Creature compilation from not my defs as demo mod using Amethyst, graphic pack with bunch of scripts as some demo mod using Emerald, bunch of functions for scripted creature abilities (so they not waste SE slot and are much more predictable and customisable). Pretty lot of work so I shouldn't be bored once Summer Holidays (and if I will pass all exams at first try I would have even more time to do this). Seems starting with Python Wrapper/Bindings is good candidate for one to try first, because once complete I wouldn't need to use ERM anymore (until I lazily decide to not make names for events, just bind ERA API and make scripter actually use ERM-Exec API from ERA). I hope to be also able to actually play since the next semester woulod be also tiring.

Good Luck! Vivat ERA!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Responsible
Supreme Hero
posted April 15, 2012 11:42 AM

Come on, majaczek, you don't need to excuse for any suggestions. We know two historical examples of attempts to introduce new script language in WoG: Lua by GrayFace (and some guy here on HC also tried) and Python by Sav. Till now there is no fully working solution with at least the following requirements:

-) Scripts automatic saving, loading, unloading, reloading on demand.
-) Means to regulate scripts loading order, mutual exclusions and so on.
-) Permanent memory serialization/deserialization in save games. The mechanism should be enough friendly to non-programmers and newbies and to allow having run-time variables, which always exist, but do not save their values in files. Currently, in ERM serialization/deserialization is done automatically and all variables are saved in files.
-) Connection between ERM events and scripting language handlers.
-) Bridge between scripting language and ERM, DLL's and game functions/variables.
-) Debugging tools: breakpoints, memory inspecting, variables dump.

Personally I prefer strongly-typed human-readable syntax languages of Pascal family, in particular, Oberon as the basis. 20 pages of language description, full modularity, garbage collection and static compilation. Instead of introducing high-level or dangerous black-box-like things, such approach postulates the opacity of compilation and all abstractions. But that's my vision and explorations, which do not affect other people work and do not force the traditional developers.

Era makes it easy to write bindings and provides the following means for that:

-) RegisterHandler (Handler, EventName). The routine allows handling all ERM and Era events. The full list of events is located in "Era II\Tools\Era\SDK\triggers.txt"

Quote:
; WOG

FU    "OnErmFunction " + N
TM    "OnErmTimer " + N
HE    "OnHeroInteraction " + N
BA1   "OnAfterBattle"
BR    "OnBattleRound"
BG0   "OnBeforeBattleAction"
BG1   "OnAfterBattleAction"
...

Example: "OnErmTimer 1".

The example of simple C++ plugin which uses events can be found at "Era II\Tools\Era\SDK\exampleplugin.cpp"

Quote:
...
void __stdcall OnAdventureMapLeftMouseClick (TEvent* Event)
{
 ExecErmCmd("CM:I?y1 F?y2 S?y3;");
 if ((y[1] == ADV_MAP) && (y[2] == CTRL_LMB) && (y[3] == LMB_PUSH))
 {
   ExecErmCmd("CM:R0 P?y1/?y2/?y3;");
   ExecErmCmd("UN:Ey1/y2/y3;");
   if (f[1])
   {
     ExecErmCmd("UN:Oy1/y2/y3/1;");
     ExecErmCmd("IF:L^{~red}Object was deleted!{~}^;");
   }
 }
}
...
RegisterHandler(OnAdventureMapLeftMouseClick, "OnAdventureMapLeftMouseClick");


-) ExecErmCmd (Str) allows executing unconditional ERM commands on-the-fly. The commands are complied and cached by their string representation in associative array.

-) FireEvent (EventName, EventData, DataSize) allows to generate new events which can be handled by all Era plugins.

-) FireErmEvent calls the appropriate ERM function and serves as a bridge to ERM world. SaveEventParams and RestoreEventParams allow each new event to have custom SN:X parameters, write them before triggering ERM and read after.

-) WriteStrToIni, ReadStrFromIni for working with settings. These functions deal with memory cached files and access to values is implemented again using associative array (binary tree, not hash table).

-) WriteSavegameSection and ReadSavegameSection allow easy saving/loading data in save games without any worries about breaking save format. Each plugin can use infinite number of uniquely named sections.

To sum up, all the necessary means to write bindings to any scripting language exist, if only those scripting languages are flexible enough to satisfy the developer's requirements.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
majaczek
majaczek


Famous Hero
Work at Magic Dimmension
posted April 15, 2012 05:05 PM

Thanks Bersy!
I actually read test plugin code, and I should know most of this, but I didn't remember

So only problem left, which is not trivial is serialization of code and data. Serialization of code becomes easy if you store script as (compressed) source code, but it can increase Loading Time, since parsing need to run every game load or newgame. Faster would be storing PYC files (cached bytecode) but it may be not enough portable (but we may assume the machine is PC with windows which is some easement but really dirty solution), and I don't want to use any decompiler in plugin, so using only embedded PYC files for deserialization would mean we are unable to deserialize fully (to source code), so it would need to store both PY (source code) and PYC (cached precompiled bytecode) in savegame which will increase it size. I guess storing source code only is most elegant solution, since it is easy to do, clear working, and portable. For serializing data I would be lazy and use Python library named Pickle (allow to store any data structure, whenever high or low level, from Python Enviroment, if code of program is well written). Since I don't want to include more complexity than it is needed, there will be one data structure member (a dictionary to be more precise) which would be saved/loaded with all it's members (it is easy to add any member at runtime and member could be dictionary also), once game save/load (newgame could prepare "empty"/default dictionary, or read data from separate pickled data - which would ease adding modules to map editor - of course code in maps would work same as in erm - sourcecode embedded in global event). All other data is assumed temporary (not needed at data load) or have to be forced to serialize (Plugins talking with Python Support Plugin have to save all important data which they do not place in the saved data tree, if plugin/script place data in python enviroment out of saved tree it won't be automatically saved, but it can be forced to save, as it can be pickled and pickled data are already serialized, so only left saving pickle via savegamedatasection).

Under this assumpions it is not such hard to implement Python support (all really hard tasks is already done by ERA core, Python libraries or Python language itself). I should also perhaps allow loading any python library without embedding it in map or savegame (it will be external code), and since we have Pickle library assumpted as neccessary it would be integral part of plugin, and the plugin would also allow saving external settings/data via pickle mechanism - this would allow doing mapmaker modules (since data doesn't have to be saved inside map, so we need only modify mapmaker GUI and provide pickle file as integral part of map, but separate file) or saving settings with almost any level of complexity (ini files are already low level of complexity as for text file). In case you want to be able to use medium complexity datafiles without depending on Python Support Plugin, and datafiles to be text files (which is not the case with Pickled data) I propose you to look at JSON format (easy to parse, much more readable than XML, allow making data trees with almost unlimited levels, and VCMI engine already use this common format for its own config files), and may even help you porting it to ERA core. The only thing left to consider to implement for scripters to be happy is adding !!PY receiver to ERM, which I would need your help to implement. It would be allowing calling Python code from inside ERM script (we already have ERM execute for plugins which function can be easily proxied to python, so to beeing complete it would need to be make working it another side). It would have to have several commands (at least: execute Python code from ERM/SN:W string both global and indpendent as separate commmands, calculate expression from such string and save it in ERM variable (integer, float or string), call function existing in Python script with parameters, exchange between SN:M tables and raw data chunks in Python, exchange between such table and complex python data structure assuming the SN:M table contain Pickle file data as is). The !!PY receiver would be a lot of work and I would consider to start implementing this, once all other features from Python support will be implemented. It need both hooking ERM interpreter/compiler (because it's new ERM receiver) and exporting many functions from ERA core (because it depends on internals of new ERA commands for ERM) - and both would make me require your help.

SO even without !!PY receiver it would need some amount of time so I plan to work at this no sooner than summer holidays. I also do not want to waste your time, so I'll ask for help with !!PY receiver once I will have substantial and working part of Python support.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Responsible
Supreme Hero
posted April 15, 2012 05:42 PM
Edited by Bersy at 17:58, 16 Apr 2012.

When I was thinking about storing scripts in save games, I came to the conclusion, that there should be two modes: without storing (default) and storing (for sending a save game to another person). Thus we reach two goals: save game size, easy way to debug scripts (they are recompiled on map start/load).

About maps and scripts. I suggest to treat "MapName" folder in maps as mod container with settings, script files and so on. Thus you won't need to write scripts in map editor global events.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
SpeedMaster95
SpeedMaster95

Tavern Dweller
posted April 16, 2012 03:45 PM

So Era II means i can add my modified Data Molder of Heroes 3 Wog in mods folder and launch it as a mod in Era II or do I need to put in pacs and than put it in Mods folder ? IF ! I need to know how to create pacs
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Responsible
Supreme Hero
posted April 16, 2012 05:57 PM

1) Create your mod folder in Mods, ex. Mods\My Mod\Data
2) Using Tools\MMArchive create new lod, put all new defs/pcx/txt here, rename lod to *.pac and put in Mods\My Mod\Data

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
SpeedMaster95
SpeedMaster95

Tavern Dweller
posted April 17, 2012 11:33 AM

Thx IŽll rename my Lod out of normal data to pac hope it works

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Emiren
Emiren


Hired Hero
posted April 19, 2012 05:16 PM

the new chest scripts arent working properly, when you get the option to choose a skill to study for a week, you master it the next day.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Responsible
Supreme Hero
posted April 19, 2012 05:23 PM

This thing was introduced by Jim Vogan and is mentioned in the Mods\WoG\Data\s\Info folder.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Emiren
Emiren


Hired Hero
posted April 19, 2012 05:32 PM

aha. think ill read those files then

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Honorable
Undefeatable Hero
posted April 19, 2012 05:44 PM

Yes, JimV added new ert line which does not display anymore the 7 days delay. You get it next day.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
SpeedMaster95
SpeedMaster95

Tavern Dweller
posted April 19, 2012 05:48 PM

got a question about potrait manager plugin how does it works I mean on my it doesn t work for lods how does it work for Era II pacs ?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Responsible
Supreme Hero
posted April 19, 2012 05:53 PM

If you installed "Portraits Manager" mod, click on hero portrait in hero screen to call the dialog.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
SpeedMaster95
SpeedMaster95

Tavern Dweller
posted April 19, 2012 06:25 PM
Edited by speedmaster95 at 18:26, 19 Apr 2012.

I dont get it
Now Era II doesnt start no idea why

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Honorable
Undefeatable Hero
posted April 19, 2012 06:28 PM

1) Install ERA 2
2) Install portraits manager mod from ERA mods thread

Click on hero portrait to enable feature. Are you building a custom map or?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
[ This thread is 107 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (17) 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 ] < Prev Thread . . . Next Thread >
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.1581 seconds