Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wine addon #1673

Merged
merged 85 commits into from
Aug 4, 2024
Merged

Wine addon #1673

merged 85 commits into from
Aug 4, 2024

Conversation

ottml
Copy link
Contributor

@ottml ottml commented Jun 3, 2024

Fixes #1669

Copy link
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

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

Just took a quick look for ideas and potential issues and improvements

libs/s25main/WineLoader.h Outdated Show resolved Hide resolved
libs/s25main/WineLoader.h Outdated Show resolved Hide resolved
libs/s25main/figures/nofTempleServant.cpp Outdated Show resolved Hide resolved
libs/s25main/gameData/GoodConsts.cpp Outdated Show resolved Hide resolved
libs/s25main/nodeObjs/noGrapefield.h Outdated Show resolved Hide resolved
libs/s25main/WineLoader.h Outdated Show resolved Hide resolved
libs/s25main/WineLoader.cpp Outdated Show resolved Hide resolved
libs/s25main/WineLoader.h Outdated Show resolved Hide resolved
libs/s25main/WineLoader.cpp Outdated Show resolved Hide resolved
libs/s25main/WineLoader.cpp Outdated Show resolved Hide resolved
@ottml ottml marked this pull request as ready for review June 8, 2024 23:19
@ottml
Copy link
Contributor Author

ottml commented Jun 8, 2024

I think the implementation is now feature complete. I will provide a new build in the next days for testing.
The only open task is:

just asking: If the addon is disabled, are all the icons (inventory, settings screen) hidden as well? If so, could you also implement it for the charburner as well, if not, could you implement that since using the default s2 settings should not show these icons so player can get an original feeling :)

@Flamefire
Copy link
Member

The only open task is:

just asking: If the addon is disabled, are all the icons (inventory, settings screen) hidden as well? If so, could you also implement it for the charburner as well, if not, could you implement that since using the default s2 settings should not show these icons so player can get an original feeling :)

That would have been my question too: When the addon is disabled everything should look and work as before. I guess having the wares in the internal lists such as distribution is fine as it won't affect gameplay without those wares but for inventory screen, settings screen etc. it might matter.

Copy link
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

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

Awesome work implementing this feature! Just some minor remarks but looks fine in general!

libs/s25main/GameCommand.h Outdated Show resolved Hide resolved
libs/s25main/GlobalGameSettings.cpp Show resolved Hide resolved
libs/s25main/Loader.cpp Outdated Show resolved Hide resolved
libs/s25main/Loader.cpp Outdated Show resolved Hide resolved
libs/s25main/Loader.cpp Show resolved Hide resolved
libs/s25main/figures/nofWinegrower.cpp Outdated Show resolved Hide resolved
libs/s25main/figures/nofWinegrower.cpp Outdated Show resolved Hide resolved
libs/s25main/gameTypes/TempleProductionMode.h Outdated Show resolved Hide resolved
libs/s25main/nodeObjs/noGrapefield.cpp Outdated Show resolved Hide resolved
libs/s25main/nodeObjs/noGrapefield.h Outdated Show resolved Hide resolved
@Flamefire
Copy link
Member

The failing replay test indicates you need to a) increase the gamedataversion and b) add compatibility code to allow loading older save games.

From a quick look it seems that

helpers::popContainer(sgd, transportPrio);
is the issue as you increased the transportPrio array size. Above that is an example how to handle it.

@Flamefire
Copy link
Member

Remove iwTempleBuilding completly and add stuff to iwBuilding

What was the reason for this? I think the combination of this with the previous is the best:

  • Default size parameter for iwBuilding
  • A subclass for the temple which passes the custom/larger size to iwBuilding
  • subclass adds extra controls as required
  • "Relative" coords for controls (as in the new commit)

This removes the need for the seemingly random extend parameter for the temple window.

I mean the file for the subclass is less than 50 lines with only the changes required for it which looks very clean

@ottml
Copy link
Contributor Author

ottml commented Jun 11, 2024

Remove iwTempleBuilding completly and add stuff to iwBuilding

What was the reason for this? I think the combination of this with the previous is the best:

* Default size parameter for `iwBuilding`

* A subclass for the temple which passes the custom/larger size to `iwBuilding`

* subclass adds extra controls as required

* "Relative" coords for controls (as in the new commit)

This removes the need for the seemingly random extend parameter for the temple window.

I mean the file for the subclass is less than 50 lines with only the changes required for it which looks very clean

This was a misunderstanding. I changed it accordingly :)

Copy link
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

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

This was a misunderstanding. I changed it accordingly :)

Alright. Could have been that the implementation turned out harder than I thought or blocked by something. Hence the question :)

libs/s25main/ingameWindows/iwTempleBuilding.cpp Outdated Show resolved Hide resolved
libs/s25main/ingameWindows/iwBuilding.cpp Outdated Show resolved Hide resolved
libs/s25main/Loader.cpp Outdated Show resolved Hide resolved
@ottml
Copy link
Contributor Author

ottml commented Jun 12, 2024

The failing replay test indicates you need to a) increase the gamedataversion and b) add compatibility code to allow loading older save games.

From a quick look it seems that

helpers::popContainer(sgd, transportPrio);

is the issue as you increased the transportPrio array size. Above that is an example how to handle it.

I added compatibility code for old savegames. But the replay test does not use this code. Does the replay not only record GameCommands? Is there also a possibility for compatibility for GameCommands? For example the ChangeDistribution Command fails.

@Flamefire
Copy link
Member

I added compatibility code for old savegames. But the replay test does not use this code. Does the replay not only record GameCommands? Is there also a possibility for compatibility for GameCommands? For example the ChangeDistribution Command fails.

I don't see a way to do this, the GameCommands use the basic serializer because they are used in the game where versioning doesn't make sense. While we could change that such that a version is added for those (and only those) we'd need to add the version to the replay file. And I cant see where/how without breaking backwards compatibility. Maybe we can use the lastGF entry and make it negative until raising the replay version to denote that the replay sub-version follows.
We better do that in a separate PR, I can look into that.

Otherwise we need to declare a new version rendering previous replays unusable.

@ottml
Copy link
Contributor Author

ottml commented Jun 13, 2024

I added compatibility code for old savegames. But the replay test does not use this code. Does the replay not only record GameCommands? Is there also a possibility for compatibility for GameCommands? For example the ChangeDistribution Command fails.

I don't see a way to do this, the GameCommands use the basic serializer because they are used in the game where versioning doesn't make sense. While we could change that such that a version is added for those (and only those) we'd need to add the version to the replay file. And I cant see where/how without breaking backwards compatibility. Maybe we can use the lastGF entry and make it negative until raising the replay version to denote that the replay sub-version follows. We better do that in a separate PR, I can look into that.

Otherwise we need to declare a new version rendering previous replays unusable.

If you think it's worse the effort we can do this. I think we should simply increase the version and live with the breaking loading of old replays, as lat done in 2023.

@Flamefire
Copy link
Member

If you think it's worse the effort we can do this. I think we should simply increase the version and live with the breaking loading of old replays, as lat done in 2023.

Yes I think it is worth it and I already have a good idea how to do that. One of the reasons is that there are still some open issues with replays attached which are required to reproduce the issue. Breaking compatibility will make that impossible

I'll work on it over the weekend

Copy link
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

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

Just some style improvements :)

libs/s25main/WineLoader.cpp Outdated Show resolved Hide resolved
libs/s25main/ingameWindows/iwBuildingProductivities.cpp Outdated Show resolved Hide resolved
libs/s25main/ingameWindows/iwBuildings.cpp Outdated Show resolved Hide resolved
libs/s25main/ingameWindows/iwBuildings.cpp Show resolved Hide resolved
libs/s25main/ingameWindows/iwBuildings.cpp Outdated Show resolved Hide resolved
libs/s25main/ingameWindows/iwDistribution.cpp Outdated Show resolved Hide resolved
libs/s25main/ingameWindows/iwWares.cpp Outdated Show resolved Hide resolved
libs/s25main/ingameWindows/iwWares.cpp Outdated Show resolved Hide resolved
libs/s25main/ingameWindows/iwWares.cpp Outdated Show resolved Hide resolved
@ottml
Copy link
Contributor Author

ottml commented Jun 30, 2024

If you think it's worse the effort we can do this. I think we should simply increase the version and live with the breaking loading of old replays, as lat done in 2023.

Yes I think it is worth it and I already have a good idea how to do that. One of the reasons is that there are still some open issues with replays attached which are required to reproduce the issue. Breaking compatibility will make that impossible

I'll work on it over the weekend

@Flamefire Are you working on this topic? Or do we increase the version for now and record the replays with the new version?

@ottml
Copy link
Contributor Author

ottml commented Jun 30, 2024

The implementation is finished. Only the topic in the above comment is unresolved. After this is finished i will provide a last test version to @aztimh. If everything is fine we can squash the commits into one and rebase the master.

@Flamefire
Copy link
Member

@Flamefire Are you working on this topic? Or do we increase the version for now and record the replays with the new version?

Yes and almost done testing. See #1677
I'm currently testing whether we can have your addon and old replays working. Ran into an async related to the RNG

ottml and others added 21 commits August 4, 2024 20:48
Translate comments and improve naming and comments
Only used in one place and includes costly PointQuality calculation
which needs to happen twice due to this.
Easier handling for derived classes that need to check for available
wares.
Translate comments and use `static_vector` instead of array and size
The startDirection was added to a valid direction which may result in an
invalid direction.
Use a random index instead.
Skip loop iteration if there are no people of a job.
This also avoids asyncs when adding/removing jobs and improves speed by
not calling RANDOM_RAND in that case.
We only provide backwards compatibility. So we need to reject any newer
version to avoid corrupting memory due to unexpected changes.
Co-authored-by: Alexander Grund <[email protected]>
@ottml
Copy link
Contributor Author

ottml commented Aug 4, 2024

Squash finished. We can merge it as soon as ci is through.

@Flamefire Flamefire merged commit 67e6069 into Return-To-The-Roots:master Aug 4, 2024
13 of 14 checks passed
@Flamefire
Copy link
Member

🥳 🎉

@aztimh
Copy link

aztimh commented Aug 5, 2024

Awesome work thanks so much! I'll get some screenshots and write up a news post for Spike to put on the RTTR website. I'll be sure to credit all the work you both did programming and refining the code :)

Thanks again,

  • aztimh :)

@ottml ottml deleted the wine_addon branch October 9, 2024 10:24
@sjoblomj sjoblomj mentioned this pull request Oct 9, 2024
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.

New Addon: Wine Buildings/Wares/Jobs
3 participants