AHOIMC
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Basic info for Hearts of Iron III Lua modding

Go down

Basic info for Hearts of Iron III Lua modding Empty Basic info for Hearts of Iron III Lua modding

Post  Chromos Sat Jan 30, 2016 11:39 am

As I got questions about Lua coding in HoI3 form time to time, I thought it might be good to have a place that shares some basic information about it all.

Afaik there is no real tutorila in HoI3-Lua coding. But you can get several Lua-coding tutorials.
Lua modding HoI3 is about coding and knowing the game. It is a little bit different as to mod in events or new decisions. But it also has much more potentional and is open to more ways of creating a solution to your problem/idea.

That way the best advice is to know how to code Lua and check out the Lua tutorials for that.
And to look at other mods wich changed the Lua of HoI3 to get some inspiration or reuse their code if possible.

At it is obvious that you can change and resue the Std-HoI3 code, I'll point out to info and some other mods that change the Lua code of Hearts of Iron III.

General coding Lua in HoI3.
You can track errors in the "system.log" file the main "Hearts of Iron 3" folder.
This folder is located:
C:\Users\"your windows user acc"\Documents\Paradox Interactive\Hearts of Iron III\logs

Also you will notice  lines in the code as such:
--Utils.LUA_DEBUGOUT("Country: " .. tostring(ProductionData.ministerTag))
If you uncomment them:
Utils.LUA_DEBUGOUT("Country: " .. tostring(ProductionData.ministerTag))

You will get an entry of that variables in the file "lua_output.txt" wich you can find in the Main game folder of "Hearts of Iron 3".
Look at HPP mod to see a good usage of the debugout. They made a more detailed "wrapper" to catch errors for testing.

Best things to get started would be to ask what you have in mind to change and then look for yourself in  Std-HoI3 or other mods how it looks there.
Then you can go on and change the code. And people on forums might also already give a helping answer.
Also, Lua being a well known coding language, you can ask in several coding forusm about your code aswell.

For the coding as such, you can use any text editor you like. I used notepad+ and did all my modding with it. A great text editor wich also is capable of syntax highlightning, great search and replace functions, regular expressions and you can load up 2 different ai files to make a comparison, so you get highlighted the differences in the code. Thats a good way to see the different code sections more easily. Smile
There're also free IDE's like decoda or ZeroBrane  free IDE's out there. Nice tools too.

Strat ai can't be changed directly. But indirectly. So Dr. Johnson(Initial Black ICE) was the first who showed officially that a different unit composition can lead to an ai on "steroids".
Because the strat ai acts different if it has the "right" unit mix at hand. So a good production and research ai can lead to very different gameplay!



A good site with overall info is also:
http://code.google.com/p/hoi3-ai-improvement-pack/wiki/LUAClassReference
Informations about HoI3 Lua from the AIIP project.



MODS:
For "vanilla like code", if you mostly want to look how you could change the vanilla code.


TFH 4.02 LUA optimizations by peterhoi3: make the USA count! and other repairs:
http://forum.paradoxplaza.com/forum/showthread.php?650333-TFH-4.02-LUA-optimizations-by-peterhoi3-make-the-USA-count!-and-other-repairs
Improves the TFH ai with good slight changes here and there. Best way to look how slight changes can make a big difference.

Same goes to Mechanized War/RPM/DWI and some others wich "just" changed the code/design of vanilla to improve the ai, look here:
http://forum.paradoxplaza.com/forum/forumdisplay.php?537-Other-mods-and-projects


Good source for more different solutions/code/designs then vanilla are imo (in alphabetical order):
AHOI-Mod: http://forum.paradoxplaza.com/forum/showthread.php?509632-gt-gt-AHOI-Mod-quot-A-HOI3-Treasure-Chest-quot-lt-lt-.
Complete different design how to do production and research, but keeps pretty simple Lua coding, so it should be easy to rewrite. FTM code runs also faster as vanilla even in late war with just a changed production Lua. It is also a unique design wich has a connection between player and Lua. So ingame decsions can change the production ai wich will build different stuff. Smile
It started with "Pimp my HOI -Dynamic AI-":
http://www.moddb.com/mods/pimp-my-hoi-dynamic-ai
First HoI3-ai wich was more reacting to ingame situations and gives you the possibility to interact with this AI via decisions. So you could play with AI on full auto settings and concentrate on the war-action, while still changing the ai build options in a brader sense thrugh the decsions.
So if you loose much convoys it will adjust the production rate accordingly! Even more so in war times. If you qonquered SOV you will switch to more naval units as GER and so on.

AIIP: http://forum.paradoxplaza.com/forum/forumdisplay.php?469-AI-improvement-pack
It has a far more advanced ai then vanilla. Great ideas and improvements. Sadly no longer developed, but worth a look anytime! They also did the info gathering I posted above. Great knowledgable Lua coders.

HPP: http://forum.paradoxplaza.com/forum/forumdisplay.php?531-The-Historical-Plausibility-Project
Is an overall improvement of the vanilla ai wich improves the std code by an great amount. It also has a solution for an information dumper. So you could get more detailed information about a crash.

YAIIM: http://forum.paradoxplaza.com/forum/showthread.php?558868-MOD-Yet-another-AI-Mod-for-HOI3-FTM&highlight=
The most ambitious project so far.
AI that is really aware of its diplomatic situation and reacts based on that knowledge. AI that can react based on both historical and unhistorical behaviour of other countries (human especially). No more situations like USSR swallowing its neighbours and Axis/Allies are just waiting for its hardcoded decisions. Etc..
It uses also a much more complex design/coding. This is very good if you want to dig deeper into Lua coding.


Last edited by Chromos on Sat Jan 30, 2016 7:14 pm; edited 2 times in total
Chromos
Chromos
Admin

Posts : 578
Join date : 2011-11-02

http://ahoimod.wordpress.com/

Back to top Go down

Basic info for Hearts of Iron III Lua modding Empty Old teaser from "Pimp my HoI"

Post  Chromos Sat Jan 30, 2016 11:42 am

The GER AI can already act quite well if it had some more ships like BB.
F.e. invading Norway. It would have at least some units to use.. (Together with a slighly better air force that can be enough to hold its own in its own waters. Wink )

With my production-Lua the build below is done from the ai all alone(Pimp my HOI -Dynamic AI).
Basic info for Hearts of Iron III Lua modding Army_build_up_39-01
(A note to the low numbers for land units in '39. There is a switch to land units in '39 wich will focus on land units ongoing then until SU is defeated. So GER is strong enough to take on the Frenchmen and SU later on..)


Basic info for Hearts of Iron III Lua modding Navy_build_up_39-01
(Some few BB in Production in '39, first will finish in ~'40.. Bismarck and Tirpitz will sail..)


Basic info for Hearts of Iron III Lua modding Air_build_up_39-01
(Some more air power too..)



And the result is a much more active Kriegsmarine..
Basic info for Hearts of Iron III Lua modding Scharnhorst-sunkships-01
Basic info for Hearts of Iron III Lua modding Bismarck-sunkships-01
Chromos
Chromos
Admin

Posts : 578
Join date : 2011-11-02

http://ahoimod.wordpress.com/

Back to top Go down

Basic info for Hearts of Iron III Lua modding Empty Big cauldron with different units production

Post  Chromos Sat Jan 30, 2016 11:44 am

Biggest wandering cauldron I've seen so far.
All actors AI,  one of the Testgame for AHOI-Mod(FTM) production Lua.

In the end I forgot who won.  IIRC it was one of the games were the allies managed to win in late '47 due to a huge landing in Europe(south and north simultaneously).


The germans move out for a gigantic encirclement..
Basic info for Hearts of Iron III Lua modding Encircle01



Closing in..
Basic info for Hearts of Iron III Lua modding Encircle02



CLOSED.. and over?
Basic info for Hearts of Iron III Lua modding Encircle03



Moscow holds the line!
Basic info for Hearts of Iron III Lua modding Encircle04



Thats it.. or?
Basic info for Hearts of Iron III Lua modding Encircle05



Break free comrade! We need a harbour!
Basic info for Hearts of Iron III Lua modding Encircle06



Moskow is lost, but the Russians broke finally free again..
Basic info for Hearts of Iron III Lua modding Encircle07
Chromos
Chromos
Admin

Posts : 578
Join date : 2011-11-02

http://ahoimod.wordpress.com/

Back to top Go down

Basic info for Hearts of Iron III Lua modding Empty Re: Basic info for Hearts of Iron III Lua modding

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum