All Activity
- Today
-
Hello Programmers, Comrades and Modders! For years, we have been creating scenarios and events restricted to static images. We add a picture of a war, and it just sits there. A picture of a nuclear explosion? Static. But not anymore. I have been digging into the source code and I realized something crucial: Age of History 2 runs on LibGDX. Why does this matter? Because LibGDX natively supports complex animations via TextureAtlas and Animation classes. The code was always there, sleeping inside the game engine, just waiting for someone to wake it up. I have successfully implemented fully animated, looping events without breaking the original game compatibility. 🚀 What I Achieved I modified the Menu_InGame_Event.java class. The logic is simple but powerful: When the game tries to load an event picture (e.g., war.png), my code first checks if a .atlas file exists with that name (e.g., war.atlas). If it exists: It ignores the static image and loads the SpriteSheet using the Atlas, creating a smooth loop animation. If it doesn't exist: It falls back to the default code, loading the static .png or .jpg just like the vanilla game. This means you can have animated events and static events in the same scenario without any bugs! // Logic inside Menu_InGame_Event Constructor String sEventRawName = CFG.eventsManager.getEvent(EVENT_ID).getEventPicture(); String sBaseName = sEventRawName; // remove extension logic... // Check if the .atlas exists if (Gdx.files.internal("UI/events/" + sBaseName + ".atlas").exists()) { // Load the Atlas and create the Animation this.modAtlas = new TextureAtlas(Gdx.files.internal("UI/events/" + sBaseName + ".atlas")); Array<AtlasRegion> regions = this.modAtlas.findRegions(sBaseName); this.modAnimation = new Animation(0.15f, regions, Animation.PlayMode.LOOP); this.isAnimatedEvent = true; } The Rendering (The Draw Method): We use stateTime (delta time) to calculate which frame to show: In the draw() method, instead of drawing the static Image object, you use the stateTime (delta time) to get the current frame from your Animation and draw it using the SpriteBatch. // Inside the draw() method if (this.isAnimatedEvent && this.modAnimation != null) { this.stateTime += Gdx.graphics.getDeltaTime(); TextureRegion currentFrame = this.modAnimation.getKeyFrame(this.stateTime, true); // Draw the current frame oSB.draw(currentFrame, x, y, width, height); // Force the game to keep rendering (otherwise it pauses on static screens) CFG.setRender_3(true); } 📂 How to make your own Animations You don't need to be a coder to use this once the code is in the game. You just need: A SpriteSheet: A PNG containing all frames of your animation. An .atlas file: This maps the frames. You can generate this using GDX Texture Packer (Use the Legacy settings/version, this is crucial!). Place both in UI/events/. I am attaching an example (SoldierRunning.atlas and SoldierRunning.png) so you can test it yourselves. 🌟 The Future Imagine the possibilities: Events with soldiers actually marching. Nuclear explosions that animate. Flags waving in the event wind. News tickers scrolling. The engine was always capable of this; we just had to write the lines to let it speak! Although I used it for events, it's more than that and can be used in any other contexts or images! I am not releasing my file, not because I wanna lock knowledge, it's because I think it's simple to people to do, and because my code is full of nonsense (like superevents, etc) I will send a .gif file showing the use of it (what I achieved!) Download the example files below! SoldierRunning.atlas (first and last line are blank.) file: SoldierRunning.png size: 2048, 2048 format: RGBA8888 filter: Nearest, Nearest repeat: none SoldierRunning rotate: false xy: 2, 1478 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 7 SoldierRunning rotate: false xy: 2, 1109 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 14 SoldierRunning rotate: false xy: 502, 1478 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 19 SoldierRunning rotate: false xy: 2, 740 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 4 SoldierRunning rotate: false xy: 502, 1109 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 11 SoldierRunning rotate: false xy: 1002, 1478 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 9 SoldierRunning rotate: false xy: 2, 371 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 16 SoldierRunning rotate: false xy: 502, 740 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 1 SoldierRunning rotate: false xy: 1002, 1109 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 6 SoldierRunning rotate: false xy: 1502, 1478 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 13 SoldierRunning rotate: false xy: 2, 2 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 18 SoldierRunning rotate: false xy: 502, 371 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 3 SoldierRunning rotate: false xy: 1002, 740 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 10 SoldierRunning rotate: false xy: 1502, 1109 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 8 SoldierRunning rotate: false xy: 502, 2 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 15 SoldierRunning rotate: false xy: 1002, 371 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 5 SoldierRunning rotate: false xy: 1502, 740 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 12 SoldierRunning rotate: false xy: 1002, 2 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 17 SoldierRunning rotate: false xy: 1502, 371 size: 498, 367 orig: 498, 367 offset: 0, 0 index: 2 Let's modernize Age of History 2!
-
PeteFromPat reacted to a post in a topic:
Age of Elder Scrolls
-
No, you are fake.
- Yesterday
-
Thanks
- Last week
-
wdym? that's literally how you do it
-
Xjento started following Yo I'm back
-
YusufAliDE reacted to a post in a topic:
MOBILE ADDED ⭐ Historicity V1.0 ⭐ - New engine w/ anti-border gore & challenging gameplay
-
gyu reacted to a post in a topic:
Age of History 3 - Android, iOS
-
Fake
-
Druper reacted to a post in a topic:
Fatherland 1964
-
how to update a custom mod
- Earlier
-
Rework Laws Complete:
-
If you want to change to the tno interface, you should access the ''menu_cofing'' file in the UI file, then there you should have a line of code that says "main_configuration", below it is "Type": "default" and instead of "default" write "TNO" and it should be done.
-
Mr. Apple changed their profile photo
-
I have a mod that adds new culture groups among other things. When I try to open certain scenarios with my mod enabled, it sends me back to the main menu before I can select a country. Does anyone know what can cause this? It only happens when I select some scenarios and not others.
-
PeteFromPat reacted to a post in a topic:
Magna Europa
-
YouravaragebrazilianAoCfan reacted to a post in a topic:
Happy new year.
-
It would also probably take 3 decades to make all those provinces anyway. And this mod would be extremely unfun with a million provinces. Making scenarios would be a nightmare as well, and it would run like a river of cement.
-
PeteFromPat reacted to a post in a topic:
Magna Europa
-
yeah that wont work, there is a limit of 31,000 roughly as to how many provinces will work in map editor. as well as it working in game. but nonetheless would be cool to try.
-
also most updates are on my dc
- 2 replies
-
- mod
- medieval age
-
(and 1 more)
Tagged with:
-
dont be sad mod is out for aoh3 >:-]
- 124 replies
-
Apple reacted to a post in a topic:
Magna Europa
-
Yes the google drive thing is still up. I don't know if the demo is actually any good though.
- 144 replies
-
- 20000+ provinces
- western europe
-
(and 1 more)
Tagged with:
-
AoH2 TNO 1.1.1 Scars of the Scramble has been released • Huttig flavour events for SAW • Rebellion and devastation states for Huttig's Africa • More outcomes for OFN Mandates decolonisation • West African War • Vietnam War and other Indochina content • Antarctica added to the map • Improved Indonesian War • Updated Moskowien • Reworked Indian subcontinent • Updated subideologies • Probably other miscellaneous changes I'm forgetting due to how long it has been since last time Android: https://drive.google.com/file/d/1QNCzv9r-EDjon5w_PVBncbdUmIVaIefw/view?usp=drivesdk PC: https://drive.google.com/file/d/10B2Yiogz5gyMrV-ikJor9NuxGgjaXXZE/view?usp=drivesdk
-
bizacjum reacted to a post in a topic:
Happy new year.
-
Happy new year. I hope this community becomes slightly more active
-
The PC link is now an Android link
-
IIduce reacted to a post in a topic:
Magna Europa
-