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

Implement Drive and Afterburner #896

Merged
merged 32 commits into from
Nov 24, 2024
Merged

Implement Drive and Afterburner #896

merged 32 commits into from
Nov 24, 2024

Conversation

royfalk
Copy link
Contributor

@royfalk royfalk commented Oct 21, 2024

  • Also DriveUpgrade and AfterburnerUpgrade. These are dedicated components to upgrade the drive and afterburner.
  • Move limits from Computer to Drive and Afterburner
  • Get rid of fuzzy numbers. MJ is exactly x100 game numbers in ship info.
  • Modify fuel efficiency in both ways to reduce tons on ship and increase actual usage.

A note on clamps in movable.cpp: these essentially check something is within min/max. With the resource class, most of these are now redundant.

Issues:

  • Ship damage model is very severe on drives.
  • Jumping sometimes damages ship. This is actually in the code but I haven't found it recently to figure out if this is expected or not under current parameters. Fixed.
  • SPEC drive malfunctions. Fixed in Periodic Housekeeping PR 1 #895.
  • Ship view crashes on the python side because now we provide some stats in the format of x/y/z instead of x. Requires a change on the asset side.

Please answer the following:

Code Changes:

Remove warp bleed factor. Report actual cost in computer.
Keep removing (unused) functionality from Energetic class.
Fix typo in Benjamen's name
- Remove VS_PI and replace with standard M_PI
- Fuel tank is integrated (can't upgrade). Remove options in base_computer.
- Use standard ftl_energy.MaxLevel() instead of getWarpEnergy and warpCapData.
- Remove support for additive and multiplicative capacitors and reactor.
- Make unit_csv load reactor and capacitors the standard way using Load.
- Remove WCfuelhack in unit_csv. Make energy source a configuration item. Game doesn't need to compute this every loop.
- Remove vsfilesystem reference in unit_csv_factory. Breaks testing.
- Remove reference to Unit in Cloak. Improves encapsulation.
- Merge EnergyType enum into ComponentType.
- Move GetUpgradeType to component_utils.
- Remove Component::Describe. We'll do this in python along with the rest of the text in base_computer.
- Make component query manifest for price, volume and description.
- Add a whole bunch of getters to component.
- Add support for infinite energy source. Useful for WC drive and reactor.
- Move factors to configuration. You can now control utilization of drive and other components using the config file.
- Add resiliency to Graphics2 and Manifest loading. Does not crash game if missing.

Issues:
- Jump causes damage. Unclear if this is new. There is code to do this in the engine.
Also DriveUpgrade and AfterburnerUpgrade
Move limits from Computer to Drive and Afterburner
Get rid of fuzzy numbers. MJ is exactly x100 game numbers in ship info.
Modify fuel efficiency in both ways to reduce tons on ship and increase actual usage.

A note on clamps in movable.cpp: these essentially check something is within min/max. With the resource class, most of these are now redundant.

Issues:
- Ship damage model is very severe on drives.
@royfalk royfalk self-assigned this Oct 21, 2024
engine/src/cmd/ai/aggressive.cpp Fixed Show resolved Hide resolved
engine/src/cmd/ai/navigation.cpp Fixed Show fixed Hide fixed
engine/src/cmd/ai/script.cpp Fixed Show fixed Hide fixed
@evertvorster
Copy link
Contributor

I built this branch, and patched it with #897
When starting a new campaign, it is possible to purchase a jump drive, so that solves an issue I had with just applying #897 to master.

Saving a game, and then restarting VS and then loading the save game gives you no flight control when launching the ship. This is with and without buying a jump drive and the basic repair and refuel.
So, something is getting messed up with the loading of the Llama.
I loaded another save game where I am flying a Vendetta, and that has normal flight controls, confirming the issue is with the Llama.

Just starting a new campaign without saving and reloading the game works better:
You have all flight controls, and they seem to work normally. Fuel seems to burn at a more normal rate now.

SPEC is till messed up.
SPEC still drains the drives, but it takes about 4 seconds to do so now. Looking at the numbers that makes sense, as the SPEC drive takes a massive 12000 MJ/s, and the SPEC capacitors have 32000MJ.
The starting reactor produces 3000MJ/s, ie: not enough to run the SPEC drive continuously.

I think the idea behind the shields being disabled was to put more power the SPEC drive to enable it to run continuously. Unfortunately the shield only draws 43MJ/s, so it's contribution is not that much.

Since the start of VegaStrike it was always possible to run the SPEC continuously, and arguably the game is unplayable without this ability. The easiest way out of this quandary is to only draw the 12000MJ for a second or two when the SPEC is enabled, as a sort of "Start up charge" which would show a nice dip in the drives bar, and then allow it to build back up. The energy required to stay in SPEC should be less than what a standard reactor provides, and so that part becomes largely academical.

In fact, the entire SPEC energy cost and its special Capacitor seems to add useless complexity to the game. The fact is that you need SPEC to cross the distances in between the bodies in the game in a timely fashion. Why there needs to be two components to accomplish this is beyond me.

What would make more sense is to have SPEC as a function of the Shields of a ship. IE: your shields ARE in some way the SPEC drive.
I bet if I think about this long enough I could come up with a theory where if you can generate an electromagnetic field strong enough to deflect laser beams you can also use that to propel you faster than light, but not both at the same time.

It would neatly fit into the current way of playing Vega Strike where when you enable SPEC it disables your shields. You could even make it so that you can't enable SPEC if you don't have full shields. Now staying in SPEC is using the same amount of energy than keeping the shields up.

The advantages from a coding perspective is that you don't need to have a SPEC drive and capacitor for it, and so you don't have to keep track of those variables.

Maybe this could be a topic of discussion with the other developers.

@royfalk
Copy link
Contributor Author

royfalk commented Oct 22, 2024

First, I'd like to thank you Evert for diligently play testing these. This is very appreciated.

Obviously, this PR comes with a complementing assets PR (today or tomorrow).

###Jump drive issue

When starting a new campaign, it is possible to purchase a jump drive

I had an issue with buying a jump drive which I think got dragged from a previous merge. It is not related to save game issue. I fixed it in this PR on the way.

###Llama save issue

Saving a game, and then restarting VS and then loading the save game gives you no flight control when launching the ship.

This sounds like #865 . Note that the fix is for saving, not loading. Already corrupt save games need to be patched manually by deleting the comma in the description. Please confirm this is the issue.

###Balancing
Somewhere along the way, the current game balance, an arbitrary position, was changed. Despite my efforts, this was inevitable. I have made several changes to fix this:

  • Units in ship view are now consistent. Before, SPEC units were multiplied by Wconv. See base_computer.cpp:4635. Something like x8. If you tried figuring out how much energy you needed, the math never worked out.
  • Now, if reactor=10, spec_capacitor=100, jump=10 and spec=2, you should be fine.
  • Note however, there are multiple things using energy (shields, ecm, life support, radar...). The ship needs to produce energy for all in order for SPEC to work properly. Which is why reactor=10 and spec=10 won't work and you'll see SPEC being drained after a few seconds.
  • I've made additions to configuration for players and asset maintainers to play around with.

Fuel seems to burn at a more normal rate now.

These things are now configurable in the configuration file. Take a look at configuration.cpp:148 and configuration.h:189. You can now play with all these parameters. I think they should be pretty clear but let me know if more info is needed.

###Llama.begin issues

SPEC is till messed up.
The starting reactor produces 3000MJ/s, ie: not enough to run the SPEC drive continuously.

You're absolutely right. However, the right solution is simply to give it a reactor03 instead. It doesn't make sense for a freighter, even a small one to have the reactor of a fighter. It's a big, heavy ship.

Similarly, Llama.begin is inconsistent with Llama. It's slower. It's faster. SPEC capacitor is 325 instead of 400. It'll take a bit of time but all of this will go away. Ship templates will have either an integrated component (non upgradeable) or take the values from the component installed.

###World Building
I'm not in the business (yet) of world building. I just rewrite the engine and give tools for others.

In fact, the entire SPEC energy cost and its special Capacitor seems to add useless complexity to the game.

You can make change it for yourself or others by changing the source int the config file. However, note that the game cockpit supports them. Dropping SPEC from the game will require tinkering with a whole bunch of other things.

Finally, I apologise again for the SPEC thing. I know it bugged you and it bugged me too. But I wanted to fix this the right way and that took a long time.

@evertvorster
Copy link
Contributor

Hi there!

##Obviously, this PR comes with a complementing assets PR (today or tomorrow).
--I'm looking forward to testing that, but I am not seeing any PR yet. Which branch are you working on? Maybe I can just test that?

###Llama save issue

#Saving a game, and then restarting VS and then loading the save game gives you no flight control when #launching the ship.

This sounds like #865 . Note that the fix is for saving, not loading. Already corrupt save games need to be patched manually by deleting the comma in the description. Please confirm this is the issue.

--It feels different. Previously when starting a new campaign, and saving the game, exiting vs and then restarting it, you would lose only yaw controls. Now, following the same steps you lose yaw and pitch. Honestly I have not tested roll.
Also, I have to note that each time I start a new campaign to test the saving. So, the save file gets overwritten on each test.

###Llama.begin issues

SPEC is till messed up.
The starting reactor produces 3000MJ/s, ie: not enough to run the SPEC drive continuously.

You're absolutely right. However, the right solution is simply to give it a reactor03 instead. It doesn't make sense for a freighter, even a small one to have the reactor of a fighter. It's a big, heavy ship.

--Yeah, but when you are starting out on a new campaign, you just don't have the cash to buy that reactor.
Getting over to Atlantis with full SPEC is already taking a long time, I shudder to think how long it would take without it.
To your point of the size difference affecting SPEC... This is why I'm thinking to call the shield generator the SPEC drive and be done with it. Larger ships need larger shield generators, which would in turn require larger reactors. Calling the shield generator the SPEC drive would also remove the incongruity that we have now where a tiny SPEC drive can sling a fully loaded mule to 100 times the speed of light with no issues.

###World Building
I'm not in the business (yet) of world building. I just rewrite the engine and give tools for others.

In fact, the entire SPEC energy cost and its special Capacitor seems to add useless complexity to the game.

You can make change it for yourself or others by changing the source int the config file. However, note that the game cockpit supports them. Dropping SPEC from the game will require tinkering with a whole bunch of other things.

--Ah, I am not suggesting removing the SPEC ability.
As I said before, the game is pretty messed up without it.

I'm just thinking that if we remove the SPEC drive and capacitor completely from the game and configuration files, and just assume that SPEC works when you have full shields it would make the code simpler and not affect game play at all.

It would also explain why your shields are down when you enable SPEC. (Because you are using the shield "field" to twist or compress space so your apparent speed exceeds light speed)

Stated another way, your shield generator IS your SPEC drive.
If you don't have a shield generator, you can't enable SPEC at all. If you do have a shield generator, then just wait till the shields are fully charged and then you can enable SPEC. This would also add a little element of danger to the game, as you can't use SPEC to run from a fight, as your shields might be a little depleted, making a proper afterburner more useful to get away.

As this is a change in how the game works, we should maybe get a some input from the other guys.

###Finally, I apologise again for the SPEC thing. I know it bugged you and it bugged me too. But I wanted to fix this the right way and that took a long time.
--We might be talking about different aspects of SPEC here. The effect of enabling SPEC in the game engine is a different subject to me. Is this what you are talking about?

@royfalk
Copy link
Contributor Author

royfalk commented Oct 24, 2024

Obviously, this PR comes with a complementing assets PR (today or tomorrow).

I'm looking forward to testing that, but I am not seeing any PR yet. Which branch are you working on? Maybe I can just test that?

Sorry. I got swamped by stuff. It's a holiday here.

It feels different. Previously when starting a new campaign, and saving the game, exiting vs and then restarting it, you would lose only yaw controls. Now, following the same steps you lose yaw and pitch. Honestly I have not tested roll.

I'll add that to the list.

Yeah, but when you are starting out on a new campaign, you just don't have the cash to buy that reactor.

You misunderstood me. We would edit Llama.begin in the assets so it would have reactor03 instead of reactor02. You would not need to do any hacking for every game. There's no law that says your starting ship needs reactor02.

To your point of the size difference affecting SPEC... This is why I'm thinking to call the shield generator the SPEC drive and be done with it...

It's an interesting idea. However, this comes with a wide range of issues in the engine. What happens if I remove the shield generator from the ship? What if it gets damaged. The C++ engine needs to account for such things.

As for the SPEC drive, note that it comes integrated into the ship. It's only the capacitors that are upgradeable. I'm not wild about the whole setup as it is right now. However, I don't plan on touching it while I'm refactoring. It's hard enough as it is not to break something.

Ah, I am not suggesting removing the SPEC ability.
As I said before, the game is pretty messed up without it.

You can drop SPEC and keep FTL. WC does that by simply transferring the ship to the target location when you press 'a'. Same as the original WC.

I'm just thinking that if we remove the SPEC drive and capacitor completely from the game and configuration files, and just assume that SPEC works when you have full shields it would make the code simpler and not affect game play at all.

See above why this isn't as simple as you think. One more example - can you SPEC while cloaked?

We might be talking about different aspects of SPEC here. The effect of enabling SPEC in the game engine is a different subject to me. Is this what you are talking about?

We are talking about the same thing from different view points. As the one implementing changes to the engine, such ideas can fall in one of three areas - C++, python or configuration. A simple change such as infinite SPEC is easy to implement with a few lines in C++ and a configuration entry. SPEC=Shields requires a redesign of the engine. It may also break WC.

@BenjamenMeyer
Copy link
Member

FYI - MSVC doesn't seem to have M_PI defined from one of the Windows builder:

D:\a\Vega-Strike-Engine-Source\Vega-Strike-Engine-Source\engine\src\components\drive.cpp(106,37): error C2065: 'M_PI': undeclared identifier [D:\a\Vega-Strike-Engine-Source\Vega-Strike-Engine-Source\build\VS2019Win64-pie-enabled-release\vegastrike-testing.vcxproj]

@royfalk
Copy link
Contributor Author

royfalk commented Oct 28, 2024

FYI - MSVC doesn't seem to have M_PI defined from one of the Windows builder

And here I thought I dodged the issue in the other branch :)

The linux checks fail on a single test with double free detected in tcache 2. This would be a great time to test those docker facilities. Are they ready and can you give a 1 minute primer on where to find the docs or how to run it?

- Multiplication warnings due to move from float to double.
- M_PI errors on MSVC.
- A minor bug in drive test.
Disable some of the unit test to pin point error.
Diagnose drive_tests crash using primitive lion algorithm.
that always causes damage during jump.
Attempt to fix drive test.
@evertvorster
Copy link
Contributor

Hi there!

Just play tested it, the damage while jumping is now gone, which is good.
The other issues that I saw is fixed in the periodic housekeeping branch, right?

In my mind the quickest way of getting most of the issues in master resolved is to merge this PR to master, and then back into the periodic housekeeping branch which will hopefully be able to be merged soon after.

@BenjamenMeyer
Copy link
Member

Hopefully https://clocksmind.blogspot.com/2024/11/vega-strike-image-testing.html will help with using the new tool

Copy link
Contributor

@evertvorster evertvorster left a comment

Choose a reason for hiding this comment

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

I play tested this branch quite a bit, and it solves some problems that are apparent in master.
Entering SPEC in the initial Llama drains the drives, but this has been fixed in another branch. The changes here do add a lot to the game, and should be merged so that the other branches can pick up these fixes.

@royfalk
Copy link
Contributor Author

royfalk commented Nov 2, 2024

The changes here do add a lot to the game, and should be merged so that the other branches can pick up these fixes.

There's a potentially serious issue with the test code. It's not so much the code failing as the potential for some memory leak that isn't evident but will crash the game. Better to find it now than try to figure out later.

I've separated #900 into a separate PR (#901). I believe the rest can wait unless I missed something else here?

@royfalk royfalk merged commit a7c8bb7 into master Nov 24, 2024
43 checks passed
@royfalk royfalk deleted the task_real_drive_comp branch November 24, 2024 15:10
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.

3 participants