Skip to content

Empire editor#1649

Open
Johannes-callidus wants to merge 146 commits intoKeriew:masterfrom
Johannes-callidus:empire-editor
Open

Empire editor#1649
Johannes-callidus wants to merge 146 commits intoKeriew:masterfrom
Johannes-callidus:empire-editor

Conversation

@Johannes-callidus
Copy link
Collaborator

@Johannes-callidus Johannes-callidus commented Jan 9, 2026

This is a PR which allows people to create their own empire inside of augustus.
It was never tested on any mobile device but I suspect it will look very squeezed on it.
It provides many fixes to how empires are drawn generally for example trade routes are drawn again in the editor and not every city has a trade icon.
Also it adds a new xml attribute to the <city> tag icon_after it determines the icon of a future trade city after being converted to a trade city.
And it adds a new icon res_sea and a new ornament The Temple.

General

The core of the editor are the so called empire tools.
There are 13 different tools:

  • Our City
  • Trade City
  • Roman City
  • Vulnerable City
  • Future Trade City
  • Distant City
  • Border edge
  • Battle icon
  • Distant Battle Enemy
  • Distant Battle Legion
  • Land trade route
  • Sea trade route
  • Selection tool

Each tool basically does what it says on left click on the map.
To delete an object you can either select it with the selection tool and then click Delete Object in the bottom menu or you can bind a hotkey for it then hover over the object and press the hotkey to delete it.
To move an object select it and click Move Object in the bottom menu.
All empire tools can be accessed with hotkeys or in the bottom left where there was previously the preview image button. Left click cycles forward, right click backwards.

Cities

You can rename cities by clicking on the edit city name button which shows a pencil.
When the city is your own city, a trade city, or a future trade city you can add resources with the add resource button (A plus button). Note that you can only add to selling on your own city.
To remove a resource right click on it.
To change the qouta of the resource left click on it.
Obviously editing quota is also not possible on your own city.
When the city is a trade city or a future trade city you can redraw it's trade route by clicking on the Redraw route button.
The type of the trade route (sea/land) can be changed by clicking on the button left the preview image.
You can change a city's icon by clicking on the button which says Current empire tool.
It'll change it's text to Current city icon and the preview image button will then change the icon of the selected city.
The icon of a future trade city after it's conversion can be changed by pressing the button in the second row at the very left of the right side.

Objects in order

This PR reworks the ordering of objects to no longer rely on for example border edges to have ids next to each other and behind their parent.
Now they have an order_index and a parent_object_id.
This change applies to border edges and trade waypoints.
You can change the order_index of an object in order by selecting it and pressing one of the arrow buttons it'll exchange the order index with the next one or the one before.
Although Battles aren't objects in order their invasion_years can also be adjusted with these arrow buttons.
Also you can set the index by right clicking on the arrow buttons. This will shift all the objects in order between the current index and the new set one. It either shifts them down if the set value is higher then the current else it shifts them up.

Invasions

Battles are always placed with invasion_year being one more than the latest battle in the current path and invasion_path_id being the current path.
Distant battles aren't actually waypoints in code so they can be placed freely as if they were distant cities.
Their distant_battle_travel_months are always one more than the ones of the latest distant battle of the same type (enemy/roman).

Bottom buttons

OK exits out of the empire screen
Toggle invasions makes battles and distant battle un-/visible
Toggle edges makes trade points and border edges un-/visible
Refresh (F5) resets the empire to the state last exported or imported from xml
Export Empire exports the current empire as xml
Import Empire imports an empire from xml as usual
Empire Properties shows the empire properties window explained underneath

Empire properties

In the empire properties you can change the empire background image by clicking on select empire image or reset by clicking Default image.
Also you can add ornaments and default cities as well as Ireland but only if it's the normal background.
And you can access empire settings and hotkeys.

Missing features

  • When bugs are discovered: Bugfixes

This also fixes #1643 by reworking trade routes so they seperate buying and selling.

@Johannes-callidus Johannes-callidus marked this pull request as ready for review February 18, 2026 13:26
Copy link
Collaborator

@crudelios crudelios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All in all, code-wise, this is extremely well done. It is also a very welcome addition to the game.

I mostly have nitpicks for changes, as well as one or two slightly more complicated requests.

I haven't yet built/checked for warnings/debugged anything. That will come later 😉

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to @Areldir regarding these icons: I believe the backgroud box and foreground icon can be separated to save a little bit of space. But not a lot anyway.

Comment on lines +1422 to +1427
<image src="Plus_Button_Idle" id="Plus_Button_Idle"/>
<image src="Plus_Button_Idle"/>
<image src="Plus_Button_Click"/>
<image src="Edit_Button_Idle" id="Edit_Button_Idle"/>
<image src="Edit_Button_Idle"/>
<image src="Edit_Button_Click"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't the Plus_Button_Idle and the Edit_Button_Idle being duplicated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need this because of how the image button handles the image offsets. +0 is idle; +1 is focused +2; is clicked. But honestly I just copied the image UI xml from the pause button.

Copy link
Collaborator

@crudelios crudelios Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can save a bit of VRAM by using the following git the repeated image:

<image group="this" image="Plus_Button_Idle"/>

If that doesn't work, use this instead:

<image>
  <layer group="this" image="Plus_Button_Idle"/>
</image>

That will prevent loading the same image twice.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I do that for the pause button as well. Or would that shift the image ids?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't shift the IDs because there's still both images.

The only difference is that they'll both use the same spot from the atlas texture, this saving memory.

if (data.type != FILE_TYPE_EMPIRE && data.type != FILE_TYPE_EMPIRE_IMAGE) {
return;
}
char *filename = (char *)dir_get_file_at_location(data.selected_file, data.file_data->location);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant this be const char *?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make it const char but then I can no longer assign it. So I would have to create a new if and a new variable. Up to you whether thats worth it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'd prefer that if possible. const stuff should not be changed.

@crudelios
Copy link
Collaborator

That was fast.

The only thing I'm not sure about are the city names. I'm pretty certain they are in the translation files, so they can probably be used directly as ti avoid string duplication (and respect eventual name changes on some translations).

Apart from that, this feels ready for proper testing.

Maybe provide a binary for users like Fairbuy and Comissar so they can try it out before merging?

@Johannes-callidus
Copy link
Collaborator Author

I let eugenkius test it and the names are wrong in russian. So I'll change the names to name ids

@Johannes-callidus
Copy link
Collaborator Author

Also there is a binary public on mareks discord server.

@crudelios
Copy link
Collaborator

I think that's everything.

It's only missing testing, correct?

@Johannes-callidus
Copy link
Collaborator Author

Yes, correct.

@crudelios crudelios self-requested a review March 1, 2026 10:06
Copy link
Collaborator

@crudelios crudelios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me.

Since you're handling testing, I'll let you merge the PR when you feel it's ready.

Remember to use "squash and merge" to add everything as a single commit please.

@eugenikus8
Copy link

The "Import Empire" button's focus is shifted about 10 pixels to the left.

@Johannes-callidus
Copy link
Collaborator Author

It was probably reintroduced by the changes I did in review with changing the buttons hidden state.
I'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RC-Campaign Massilia Trade Bug

3 participants