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
Incremental City Repair #1141 #1188
Conversation
Added Option to repair Buildings depending on the availability of construction Vehicles as mentioned by @FilmBoy84 in #1141. This is added as a new OpenApoc feature in the option being disabled by default. With Option Enabled to only repair when vehicles are available With the option disabled, but still only repairing one level per night |
Just merged #1217 which in changing options creates a conflict with this PR |
Only Repair one Level per Night
Rebase has been completed and Pull Request is ready to merge. I just wanted to reiterate that no research has been done yet how the OG handles Building Repairs, this is just my interpretation :D |
Greatly appreciated KGD 🍻 Quickmind and I should be testing over next few days and will let you know if we find anything - if all seems okay, we'll get it merged The last part of #1141 will need some extensive reversing of the OG to work out how building of each tile is costed and any other costs for building repair - and that will be best suited for a future PR anyway The main thing is getting city repair working again and for that I'm extremely grateful for your work |
One thing I will say is I tested using the repair debug command, and the building I tested could not be entered with a craft after the repair occurred. Interestingly enough, when the craft started off in the destroyed tiles, it would exit once the repair occurred and couldn't go back in. So, at least in the current build, debug repair solidifies the building. |
@Quickmind01 So the repair function repaired the building, but the vehicle was then blocked from entry? Interesting if that's the case - suggests that whilst the building is treated as solid, it doesn't flag the building as accessible again - did it become accessible after end of day? I wonder if it gets flagged as accessible then as it's not normal for repairs to occur in the same day something attempts to go back in |
After Night 1 of repairs, the building did construct some "floating" structures EDIT: And a save before Night 1 (made on a different run to the above to confirm the issue) |
I have managed to replicate this - saves attached CoS buildng was COLLAPSED with Ctrl-Alt-Shift-R.Click Running the game forward from the Night 1 save the building repairs - including the hangars/landing pads But i am unable to get the Hawk to enter the building in the second save Additionally, many vehicles will attempt to enter the building as the day goes on and fail - causing MASSIVE slow down in ultra speed It does appear there is an issue with both landing pads AND garages not being flagged as accessible when repaired EDIT: I have tested on a new game, this time with construction vehicle lead repair, and even when i destroy pads/hangars/garages i can use them again from the next day. This issue therefore may only affect "level based repair" or it may be map specific - further testing needed |
@Quickmind01 @FilmBoy84 Thanks for all the input so far, just keep them coming especially with the save files attached and I will have a look at the issues over the weekend 👌 |
Thanks for checking @Quickmind01 costs will have to most likely be a separate PR As to why government pays more - they cover all the "infrastructure" costs like roads into buildings, people tubes between them and other terrain types damaged during the building's destruction, whereas only the tiles related to the building and it's immediate grounds are paid for by the organisations. Thus, when a building is damaged and needs repairing both government AND the parent organisation end up paying toward it As said in my list of things to check on discord - we need some extensive reversing of the OG before costs can be worked out Otherwise, apart from the issues above, this PR seems really stable - im happy to merge pending those fixes unless anything else crops up - just having some mechanism to repair at present is very welcome |
I forgot to mention that OA appears to have buildings repair random chunks/levels. I did a real brief test prior to my OG testing, and the building wasn't rebuilding from the ground up. There was a level nearly missing completely between one level below and one above. I think I recall someone mentioning this was a known issue, but I wanted to confirm that it still exists. |
Much appreciated KGD - never any pressure from us, we're just grateful for the work I note that it is most prominent on buildings that have "rubble" or other tiles most commonly associated with the ground as part of the structure - for example, slums do this So maybe therein lies a clue? |
Great, I will definitely go down that road then, and also having a closer look into the tiles supporting other tiles relationships since that is a major part of how to sort in which order to repair them |
Reworked the Repair Code, it will now only allow Scenery to be repaired which has a valid support below it or does not need any support at all. This also leads now to correctly only reconstructing one level per night. @FilmBoy84 @Quickmind01 Please go ahead and try your best 😉 |
Many thanks for the update. I have had a play and for single level per night repair it appears really solid! It does appear however that construction vehicle lead repair has been broken - regardless of construction vehicles, each building still repairs one level per night rather than the RNG up to 20 tiles per vehicle per night |
Copy, I will have a look at that 👍 |
Many thanks Here's a video of me messing around with the build, mods and Debug today :) It's REALLY stable, even handled me putting a vehicle inside a tile that got repaired well Just the Construction Vehicle thing that seems to be outstanding - I do wonder if we should have a user set min/max RNG value for the amount per vehicle per night though - 20 seemed too high on the previous build before it broke and if there's a lot of vehicles whole buildings were restored quickly - so being able to set the min/max per vehicle would be useful I propose a default of 1-5 tiles per night, per vehicle, extendable up to the 1-99 range by user preference.... |
Perfect I will watch the Video tonight and then get to fixing the Construction Vehicles. Great Idea to have lower that value und make it adjustable. @FilmBoy84 Where do you reccon this option schould be locacted, should it remain in the more options menu? |
I'd say it definitely needs to stay in the more options menu under the cityscape list Though I can see issues with the form and entry of min/max values - so maybe they'd be better just being held in It's a difficult one, if you can find a way to put under the more options list - do that as then end users can alter things in one place But equally, with forms being problematic, don't stress too much if you have to move to placing the values in the config and referencing under a tab in the Launcher As to the video, it's mainly just me rambling ha ha ha, nothing other than a record of how i was testing this build Had a weird error relating to crashing UFOs and a self-inflicted slowing of the game with too many battlescape explosions but they are unrelated to this - most useful thing is probably the log on the left :) |
@FilmBoy84 Nice work, will have a look at the road/vehicle issue tomorrow. As of now the MaxTiles should be in the config file as MaxTileRepair with a default value of 5. Also had discussion w/ @Quickmind01 who also did an extensive Test Stream and his feeling is that with a Setting of 5 Repair seemed to be da tad Slow. One thing I would like to change is, that orgs will only help each other out w/ their Vehicles after all of their own tiles are repaired. Secondly the Orgs are billed the initial Cost of the Tile when Repaired, that is something which was already in the Code before my addition which I keep. I would suggest adding a Modifier for the Repair Cost in the config as well so tweaking/balancing/disableing can easily be done without needing to recompile the Code. Low Funds of the Organisations could also lead to the feeling of slow Repair @Quickmind01 had. |
All of the mentioned changes in the last comment have been made.
@FilmBoy84 only thing "missing" would be to make these two options (i.e. Cost Factor & Max Tiles per Vehicle) tweakable within the more options menu. Couldn't figure out an elegant solution so far. |
Brilliant, thank's KGD - i'll aim to do another test video tomorrow Regarding the cost structure - where is it calling the values per tile from? I can't see |
OpenApoc/game/state/city/city.cpp Lines 531 to 533 in 64deaf3
From where exactly the data is taken from and if it is having any effect at the Moment I would need to investigate further |
Had another great test today - it's looking really good with no major issues detected The three minor things before i can merge are as follows however (pending anything from @Quickmind01 )
Otherwise, as you will see from this video - i tried to break things in a lot of ways but was pleasantly surprised by how stable this PR is - great work @kgd192 ! It's a real game-changer, especially with me being able to bankrupt Diablo with damage to the point that they can no longer repair buildings! I also love that Debug did not allow repair when this occured so it was easy to identify the financial impact was effective. Let me know if you need the saves i made :) |
Great I will look at those things.
|
Debug Repair via SHIFT+R now again correctly repairs a single Level and adjusted the default value of the cost modifier to 10.0f. Additionaly the CostModifier and Max Tile Repair will be saved to conf file after first Night
@FilmBoy84 All Issues as mentioned above by you have been fixed so far. Unfortunately I couldn't find a clean way to get the two Options into the .config file, so now they will be in there after the first night or debug repair. To really fix this these values probably need to be in the More Options Menu, and I couldn't figure out how to get them in there cleanly, maybe this is something for @Kurtsley. The Workaround code have the options reliably in the config file is listed below and needs to be reworked once a UI solution for adjusting them exists. OpenApoc/game/state/city/city.cpp Lines 402 to 407 in 5330688
|
Have done a test of this today I shall open a Issue referencing this PR for the UI issue - at present getting the repairs in game resolves a number of issues with things like crashing road vehicles and some instances of vehicles getting stuck Thanks for your work on getting this into the game KGD192 <3 Final Testing Video |
This is the initial Entry Point for the Incremental Repair of the Cityscape as mentioned in issue #1141 going from fixing als Blocks of a Building at once per night, it will now only repair one single level per night (as per UFOPaedia) to create some sort of incremental repair effect.
Next Step will be to research the repair strategy used by the OG Game and implement it step by step plus add. further improvements as mentioned by @FilmBoy84 in #1141