Commit Graph

11202 Commits (master)

Author SHA1 Message Date
Trung Lê 0cc652e72e Add constexpr to PiRngWrapper min() and max()
Fixes #5170
2021-05-07 00:45:58 -04:00
Andrew Copland 18b4d487e2 Warn about loading dead bodies, but handle safely. 2021-05-02 17:27:00 -04:00
Gliese852 6081f3e29a Fix some bugs appeared
- Move the drawing of the system map pigui to a separate handler to
  ensure that it will always be drawn strictly after the SystemView object
- Fix the setting of the m_colliding parameter of the ship during
  deserialization
2021-05-02 17:25:57 -04:00
Gliese852 20551ae2ea Improve Tradeships.lua
- Preparations:

Add method Ship:GetCargo
Add method Ship:GetDurationForDistance
Add method Ship:Create
Add method ui.treeNode & ui.treePop
Add method LuaObject::CreateInLua
Add functions for convenient selection of a random array element
Add some numerical utilites
Add a tool to easily draw a table from an array
Fix ui.Format.Number
Turn off the output when the ship changes frames
Reduce the detection range of hyperspace clouds
Remove the call LuaEvent::Emit immediately after exiting hyperspace
Split Tradeships.lua into 5 modules

- Tradeships

For current system, calculate all possible routes of tradeships,
durations, flows; arrange ships in space in such equilibrium state,
as if the have been flying about their business for a long time.

Calculate the average spawn interval for new ships, and parking
intervals, so that the stations are not overcrowded or empty.

Сreate a tab in the debug window with full information on
routes, ships, stations, remote systems.
2021-05-02 17:25:57 -04:00
Gliese852 31911813f8 Add function PutShipOnRoute
Function description:

The ship rearranged from its current position to a given body in space, for a
given part of the path, as if it were flying in a straight line, consuming
fuel and changing speed. The ship's current speed is ignored and is
considered to be equal to target's.
This function changes the coordinates, the mass of fuel in the tank, and the
speed of the given ship.

This function will be used so that when the game starts, or the player
jump into the system, the NPC ships looked as if they had been moving on
their routes for a long time.
2021-05-02 17:25:57 -04:00
Gliese852 11c8dffa0e Add class for pre-calculating spaceship path
A one-dimensional case is considered, given the parameters of the ship
and the length of the path, a flight plan is calculated, which allows
determining the time, speed, and mass of the ship at any point on the
way.

Also added a simple simulator for testing purposes.
2021-05-02 17:25:57 -04:00
Webster Sheets 68cfc2e28a Clean up useless profiling calls
- Flatten the Scenegraph LoadNodes tree to avoid unneeded callgraph depth
- Remove several useless (and counterproductive) profiling points in tiny Lua bindings
- Add wall-clock time to profiler reports
- Fix bug in debug-compilation of Frame.cpp
2021-05-01 17:50:24 -04:00
Webster Sheets f8eaffb304 Only update wheel animations when needed
Animation::Interpolate was getting called for all ships, and was
responsible for 1/3rd of the frame with 2500 ships.
Also stop profiling Frame::GetFrame, as the function is an order of
magnitude faster than the profiling overhead.
2021-05-01 17:50:24 -04:00
Webster Sheets 35dcbecac3 Add profiling points, optimize Ship::StaticUpdate
Add better profiling to identify frame slowdowns we have lots of ships (2000+)
Cache equipment capabilities between ship equipment updates
Improve Ship::StaticUpdate from 70mc to 40mc with 2500 ships
2021-05-01 17:50:24 -04:00
Webster Sheets f5a9a64436 Add profiling, refactor Model animation ticking
Only tick animations that are marked active.
More work needs to be done in Ship.cpp to support this,
but it should enable us to have far more ships in one system.
2021-05-01 17:50:24 -04:00
WKFO bdfe6ef873 Implement map view music, add tracks 2021-04-29 15:46:43 -04:00
Webster Sheets 4432e4594f Add new debug / editor colorscheme
Pretty much copied from the Limit Theory editor's colorscheme.
Some support is added to PiGui::Instance to allow swapping style objects on the fly.
2021-04-29 15:44:38 -04:00
Karl F 0d6eff05a5 Fix some spelling in lua api 2021-04-23 13:03:33 -04:00
Webster Sheets c6adff8a29 Fix PiRngWrapper, fix starts_with and ends_with like methods. 2021-04-23 03:12:20 -04:00
Webster Sheets f08f00d334 Build with C++17, remove nonstd::string_view 2021-04-23 03:12:20 -04:00
WKFO 29a74ca88c Fix lua GetAtmosphericState() to accept any two bodies 2021-03-28 10:56:48 -04:00
WKFO 4891277b79 Fix death music not playing over tombstone screen 2021-03-28 10:55:46 -04:00
Webster Sheets 37deea46c5 Fix (and document) depth linearization 2021-03-27 00:32:41 -04:00
Webster Sheets aeb5d906bb Fix GasGiant clipping, fix bright spots on models 2021-03-26 22:42:06 -04:00
Karl F d460f65f7b Don't persist signals past destruction of object they're attached to
Fixes #5136, code as suggested by @web-eworks
2021-02-19 18:07:59 -05:00
Gliese852 b8f0572371 Move the surface starport system bodies on loading
Sometimes surface ports move when terrain is generated because it is not
suitable for their original position.  When serialized, the physical
body saves its changed position, but the system body does not.
Therefore, upon subsequent loading, the position of the system body and
the physical body may not coincide. In this commit, the same mechanism
is launched as during the initial generation of the relief, which
displaces the system bodies to the right position.
2021-02-18 12:19:27 +01:00
Gliese852 5004b09483 Improve/fix system map
- add a "static" orbit for bodies that are not moving anywhere
- now bodies in a rotating frame and also in the spaceport frame have
  such "static" orbits
- add display of the orbits of objects moving strictly to the star or
  from the star
- fix compile warning for possibly uninitiated variable in
  LuaSystemView.cpp
- fix an issue where smooth animation sometimes have a hard time
  catching up with a newly selected object

Fixes #5062
2021-02-01 02:31:24 -05:00
Webster Sheets 23772169d3 Temporarily patch word-wrapping issues
This is a bug in upstream imgui (as of v1.78), but work around sub-pixel
issues by padding with a single pixel.

Closes #5102.
2021-02-01 02:24:24 -05:00
Andrew Copland 4ad8ee16c9 Fix formatting issues. 2021-01-29 21:45:53 +00:00
Andrew Copland 6a4199da45 Update the katakana generator to new iteration 2021-01-29 21:45:53 +00:00
Andrew Copland 98985c7d8c Add more naming fragments as supplied by WKFO 2021-01-29 21:45:53 +00:00
Andrew Copland 328f57ebdc Allow upto 4 fragments for a katakana name 2021-01-29 21:45:53 +00:00
Andrew Copland 7fbb640317 Change da to de 2021-01-29 21:45:53 +00:00
Andrew Copland 2df92f15ce Add alternative naming schemes, probably needs and excluded words list 2021-01-29 21:45:53 +00:00
Armin Kretschmer 427b1c4a79 New mission: Scoop 2021-01-17 11:06:32 +01:00
Armin Kretschmer 62b8384558 Keep shape if jettisoned 2021-01-17 09:56:29 +01:00
Armin Kretschmer b9c74a8b86 New lua event onCargoDestroyed
Needed for the Scoop mission
2021-01-17 09:56:29 +01:00
Armin Kretschmer 7171b2f15b New function SpawnCargoNear()
Necessary for the Scoop mission
2021-01-17 09:56:29 +01:00
orbea 541a54f635 Fix build with the system lua. 2021-01-16 14:41:59 -05:00
Gliese852 04cf347dd3 Do not try to GetStarSystem from hyperspace
Small fix to segfault when opening the system map during a hyperjump

fixes #5096
2021-01-16 14:37:03 -05:00
Webster Sheets 3bd735e40d Fix orthographic projection
OrthoFrustum and OrthoMatrix were not properly set up for reverse-Z.
This PR fixes it by using the proper inversion of a right-handed ortho matrix.
2021-01-15 21:10:54 -05:00
Andrew Copland d1ea10b433 Change the star density range from 0.01 to 1.0 to the full 0.0 to 1.0 now that I'm lerping between min and max values 2021-01-13 16:40:06 -05:00
Andrew Copland c8d509ab1f Limit the radius searched for stars and mix it from the minimum to the desired radius depending on the star density 2021-01-13 16:40:06 -05:00
Gliese852 b8f255f8d2 Add search for the geometrically closest jumpable
In case the systembody does not have a jumpable parent.
This can happen if it revolves around several stars at once.
At the moment this situation leads to a segfault.
2021-01-13 16:34:41 -05:00
WKFO 04d2d17d3f Stop planet ambient sound once player is flying 2021-01-08 10:21:16 +01:00
Karl F 9e44b09314 Happy new year!
HAPPY MERRY 2021!
2021-01-03 19:40:16 +01:00
Webster Sheets 7c9753af16 Fix guns needing combat target, modelviewer config
Fixes #5103
Fixes #5099
2021-01-02 18:31:37 -05:00
Webster Sheets 59cfed1555 Fix leaving to menu with chat form open 2020-12-22 03:55:30 -05:00
Webster Sheets 0499ee0005 Fix camera detaching when console is open 2020-12-22 03:55:30 -05:00
Webster Sheets f708225c03 Remove CPanel and oldUI radar 2020-12-21 23:40:33 -05:00
Webster Sheets d181a8e2f9 Port planar radar to pigui 2020-12-21 23:40:33 -05:00
Webster Sheets f8c91ade0b Port NavTunnel widget to pigui 2020-12-21 23:40:33 -05:00
Webster Sheets b480e22c36 Refactor screen projection functions
Fixes issues with directions being projected as positions.
Clean up several now-unused functions.
Move screen projection functions from Body to Engine where they belong.
2020-12-21 23:40:33 -05:00
Webster Sheets 25688d06b6 Significantly slash savefile sizes
This change drops the average savefile from 2MB to 500KB.
We're smarter about what data we actually need to serialize -
MatrixTransform is only ever positioned by animations, and we don't
(yet) need to know about every space station market in the system at once.
2020-12-19 15:25:47 -05:00
Gliese852 3b76572336 Remove SetDepthRange calls from SectorView.cpp
This function was used to prevent the indicators from overlapping the
stars, Now they just move a little beyond the stars.
2020-12-19 15:22:52 -05:00