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

Minor optimisations and tweaks #6087

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

fluffyfreak
Copy link
Contributor

@fluffyfreak fluffyfreak commented Mar 5, 2025

Optimisations parts:

  • Inlined methods and added a Normalise-in-place to vector3d
  • Batched generating heights, avoid calling GetHeight 1225 times and instead request all heights at once
  • Forced override of GetHeight in BaseSphere since it always is anyway
  • m_entropy[12] is only used in 2 places and only ever used the first value but refreshed it hundreds of times every Terrain Ctor

Tweak:

  • Display the Height and Color fractal names used for a terrain in ObjectViewerView (Ctrl+F10)

These changes probably do affect the terrain generation though I haven't noticed massive changes in testing. Unsure if we'll need a savegame bump

EDIT: Can confirm that this will require a savegame bump

@Bodasey
Copy link

Bodasey commented Mar 13, 2025

First test results:

Fuel scoop: nothing has changed
Flying from one surface starport to another on the same planet: improvement (allows sometimes 100x acceleration)
load saved games: incompatible to own format? (Test game was originally from master, saved with this branch, was not able to load the game again)
Log for the failed load process:

`(gdb) run
Starting program: /home/romaschw/pioneer-minor-optimisations/build/pioneer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Info: ver 20250203 on: Linux
Info: System Name: Linux
Host Name: localhost.localdomain
Release(Kernel) Version: 6.13.1-1-default
Kernel Build Timestamp: #1 SMP PREEMPT_DYNAMIC Mon Feb 3 05:33:25 UTC 2025 (1918d13)
Machine Arch: x86_64
Domain Name: (none)
Info: Loaded mods:
Info: --------------------
Info: SDL Version (build) 2.32.0
Info: SDL Version (dynamic) 2.32.0
Info: SDL Versions match
Info: SDL_image Version (build): 2.8.4
Info: SDL_image Version (dynamic): 2.8.4
Info: SDL_image Versions match
Info: Assimp Version: 5.4.0
Info: FreeType Version: 2.13.2
Info: GLEW dynamic version: 2.0.0
Info: --------------------
Info:
[New Thread 0x7fffebcb46c0 (LWP 12474)]
[New Thread 0x7fffeb3726c0 (LWP 12475)]
Info: SDL video driver used: x11
Info: Initialized OpenGL 3.1, with extensions, renderer
Info: Created shader vtxColor (address=0xb7edb0)
Info: Initializing joystick subsystem.
Info: Loaded PiGui fonts from disk:
Info: font console:0
Info: - Inpionata.ttf 1
Info: - DejaVuSansMono.ttf 1.2
Info: - wqy-microhei.ttc 1
Info: - icons/icons.svg 16x21
Info: font icons:0
Info: - PionilliumText22L-Medium.ttf 1
Info: - icons/icons.svg 16x21
Info: font orbiteer:0
Info: - Orbiteer-Bold.ttf 1
Info: - DejaVuSans.ttf 1.2
Info: - wqy-microhei.ttc 1
Info: - icons/icons.svg 16x21
Info: font pionillium:0
Info: - PionilliumText22L-Medium.ttf 1
Info: - DejaVuSans.ttf 0.9285714
Info: - wqy-microhei.ttc 1
Info: - icons/icons.svg 16x21
Info: Created shader ui (address=0xaf3460)
Info: Created shader gen_gas_giant_colour (address=0xaf1850)
Warning: Commodity rubbish has invalid producing economy ALL
Info: Loaded economy info: 3 economies, 31 commodities (10 consumable)
[New Thread 0x7fffea8706c0 (LWP 12478)]
Info: started 1 worker threads in 0.68ms
Info:

Engine startup took 10048.02ms
Info: StartupScreen::Start()
Info: ShipType::Init()
Info: Lua::Init()
Info: Lua 5.2
Warning: No SVG data available to rasterize icon font icons/icons.svg
Info: Loading [00%]: Sound::Init started
[New Thread 0x7fffe98646c0 (LWP 12479)]
[New Thread 0x7fffe90636c0 (LWP 12480)]
[New Thread 0x7fffe88626c0 (LWP 12481)]
Info: Loading [00%]: Sound::Init took 2259.81ms
Info: Loading [08%]: Lua::InitModules() started
Info: Loading [08%]: Lua::InitModules() took 2212.55ms
Info: Loading [17%]: GalaxyGenerator::Init() started
Info: Creating new galaxy generator 'legacy' version 1
Info: Warning: 'mass' is 0.000000 for body 'Themisto'
Info: Warning: 'averageTemp' is 0 for body 'Uluru'
Info: Warning: 'averageTemp' is 0 for body 'Francesca'
Info: Warning: 'averageTemp' is 0 for body 'Penny'
Info: Warning: 'averageTemp' is 0 for body 'Beth'
Info: Warning: 'averageTemp' is 0 for body 'Kata Tjuta'
Info: Warning: 'averageTemp' is 0 for body 'Sagittarius A*'
Info: Warning: 'averageTemp' is 0 for body 'Terminus'
Info: Warning: 'mass' is 0.000000 for body 'Lucksmall'
Info: Number of factions added: 103
Info: StarSystemCache: misses: 0, slave hits: 0, master hits: 0
Info: SectorCache: misses: 101, slave hits: 0, master hits: 2
Info: Loading [17%]: GalaxyGenerator::Init() took 661.53ms
Info: Loading [25%]: FaceParts::Init() started
Info: Face Generation source images loaded.
Info: Loading [25%]: FaceParts::Init() took 61.04ms
Info: Loading [33%]: new ModelCache started
Info: Loading [33%]: new ModelCache took 0.00ms
Info: Loading [42%]: Shields::Init started
Info: Created shader shield (address=0x24d44d0)
Info: Loading [42%]: Shields::Init took 56.25ms
Info: Loading [50%]: BaseSphere::Init started
Info: GenerateIndices: triangles count = 648, mid indexes = 1728, hi edges = 54
Info: Loading [50%]: BaseSphere::Init took 151.63ms
Info: Loading [58%]: CityOnPlanet::Init started
Info: Loading city definition file 'configs/buildings/default.json'
Info: Created shader multi (address=0x244f7a0)
Info: CreateCollisionMesh for : (Dome1)
Info: CreateCollisionMesh for : (Dome2)
Info: CreateCollisionMesh for : (Library)
Info: CreateCollisionMesh for : (Mall)
Info: CreateCollisionMesh for : (Tower1)
Info: CreateCollisionMesh for : (Tower2)
Info: CreateCollisionMesh for : (kbuilding01)
Info: CreateCollisionMesh for : (kbuilding02)
Info: CreateCollisionMesh for : (kbuilding03)
Info: CreateCollisionMesh for : (newbuilding1)
Info: CreateCollisionMesh for : (newbuilding10)
Info: CreateCollisionMesh for : (newbuilding11)
Info: CreateCollisionMesh for : (newbuilding2)
Info: CreateCollisionMesh for : (newbuilding3)
Info: CreateCollisionMesh for : (newbuilding4)
Info: CreateCollisionMesh for : (newbuilding5)
Info: CreateCollisionMesh for : (newbuilding6)
Info: CreateCollisionMesh for : (newbuilding7)
Info: CreateCollisionMesh for : (newbuilding8)
Info: CreateCollisionMesh for : (newbuilding9)
Info: Created city definition flavour #1
Info: Loading [58%]: CityOnPlanet::Init took 8853.16ms
Info: Loading [67%]: SpaceStation::Init started
Info: Created shader label (address=0x3225a70)
Info: CreateCollisionMesh for : (ground_station)
Info: ground_station has:
14 entrances,
14 pads,
0 exits
Info: CreateCollisionMesh for : (new_ground)
Info: new_ground has:
6 entrances,
6 pads,
0 exits
Info: CreateCollisionMesh for : (orbital_station_2-10k)
Info: orbital_station_2-10k has:
7 entrances,
64 pads,
7 exits
Info: CreateCollisionMesh for : (orbital_station_2-2k)
Info: orbital_station_2-2k has:
6 entrances,
18 pads,
6 exits
Info: CreateCollisionMesh for : (orbital_station_2-5k)
Info: orbital_station_2-5k has:
7 entrances,
64 pads,
7 exits
Info: CreateCollisionMesh for : (orbital_station_2-5k10k)
Info: orbital_station_2-5k10k has:
7 entrances,
64 pads,
7 exits
Info: Loading [67%]: SpaceStation::Init took 10443.04ms
Info: Loading [75%]: NavLights::Init started
Info: Created shader billboards (address=0xac001d0)
Info: Loading [75%]: NavLights::Init took 14.95ms
Info: Loading [83%]: Sfx::Init started
Info: Loading [83%]: Sfx::Init took 35.69ms
Info: Loading [92%]: PostLoad started
Info: Loading [92%]: PostLoad took 0.06ms
Info:

Pioneer loading took 24977.31ms
Info: Creating new galaxy generator 'legacy' version 1
Info: Clearing and re-using previous Galaxy object
Info: StarSystemCache: misses: 0, slave hits: 0, master hits: 0
Info: SectorCache: misses: 101, slave hits: 0, master hits: 1
Info: Created shader starfield (address=0x3c17f10)
Info: Created shader skybox (address=0xabff720)
Info: Stars picked from galaxy: 41200
Info: Generating 83800 random stars
Info: Final stars number: 125000
Info: Created shader unlit (address=0xa3b6490)
Info: CreateCollisionMesh for : (ac33)
Info: CreateCollisionMesh for : (bluenose)
Info: CreateCollisionMesh for : (bowfin)
Info: CreateCollisionMesh for : (coronatrix)
Info: CreateCollisionMesh for : (deneb)
Info: CreateCollisionMesh for : (dsminer)
Info: CreateCollisionMesh for : (kanara_civ)
Info: CreateCollisionMesh for : (lodos)
Info: CreateCollisionMesh for : (lunarshuttle)
Info: CreateCollisionMesh for : (malabar)
Info: CreateCollisionMesh for : (molamola)
Info: CreateCollisionMesh for : (molaramsayi)
Info: CreateCollisionMesh for : (natrix)
Info: CreateCollisionMesh for : (nerodia)
Info: CreateCollisionMesh for : (pumpkinseed)
Info: CreateCollisionMesh for : (sinonatrix)
Info: CreateCollisionMesh for : (skipjack)
Info: CreateCollisionMesh for : (storeria)
Info: CreateCollisionMesh for : (varada)
Info: CreateCollisionMesh for : (vatakara)
Info: CreateCollisionMesh for : (venturestar)
Info: CreateCollisionMesh for : (wave)
Info: CreateCollisionMesh for : (xylophis)
Info: Creating new galaxy generator 'legacy' version 1
Info: Clearing and re-using previous Galaxy object
Info: StarSystemCache: misses: 0, slave hits: 0, master hits: 0
Info: SectorCache: misses: 0, slave hits: 0, master hits: 0
Info: Stars picked from galaxy: 41200
Info: Generating 83800 random stars
Info: Final stars number: 125000
Info: validation INFO [ships/xylophis.json]: Slot hyperdrive has no default hyperdrive equipment and will not have a hyperdrive when purchased.
Info: SaveGameManager::LoadGame('2025-Test-surface')
Info: savefile version: 91
Info: Creating new galaxy generator 'legacy' version 1
Info: Clearing and re-using previous Galaxy object
Info: StarSystemCache: misses: 0, slave hits: 0, master hits: 0
Info: SectorCache: misses: 0, slave hits: 0, master hits: 0
Info: Stars picked from galaxy: 41200
Info: Generating 83800 random stars
Info: Final stars number: 125000
Info: CreateCollisionMesh for : (coronatrix_shield)
Info: CreateCollisionMesh for : (skipjack_shield)
Info: CreateCollisionMesh for : (bowfin_shield)
Info: CreateCollisionMesh for : (lodos_shield)
Info: CreateCollisionMesh for : (deneb_shield)
Info: CreateCollisionMesh for : (wave_shield)
Info: CreateCollisionMesh for : (coronatrix_police)
Info: CreateCollisionMesh for : (storeria_shield)
Info: CreateCollisionMesh for : (dsminer_shield)
Info: CreateCollisionMesh for : (nerodia_shield)
Info: CreateCollisionMesh for : (venturestar_shield)
Info: CreateCollisionMesh for : (molaramsayi_shield)
Info: CreateCollisionMesh for : (malabar_shield)
Info: CreateCollisionMesh for : (molamola_shield)
Info: CreateCollisionMesh for : (natrix_shield)
Info: CreateCollisionMesh for : (ac33_shield)
Info: CreateCollisionMesh for : (lunarshuttle_shield)
Info: CreateCollisionMesh for : (sinonatrix_shield)
Info: CreateCollisionMesh for : (sinonatrix_police)
Info: CreateCollisionMesh for : (bluenose_shield)
Info: CreateCollisionMesh for : (pumpkinseed_shield)
Info: Warning: Lua custom Systems definition: Surface starport has been automatically relocated. This is in order to place it on flatter ground to reduce the chance of landing pads being buried. This is not an error as such and you may attempt to move the starport to another location by changing latitude and longitude fields.
Surface starport name: Cydonia, Body name: Mars, In sector: x = 0, y = 0, z = 0.
Info: Warning: Lua custom Systems definition: Surface starport has been automatically relocated. This is in order to place it on flatter ground to reduce the chance of landing pads being buried. This is not an error as such and you may attempt to move the starport to another location by changing latitude and longitude fields.
Surface starport name: Phobos Base, Body name: Phobos, In sector: x = 0, y = 0, z = 0.
Info: Warning: Lua custom Systems definition: Surface starport has been automatically relocated. This is in order to place it on flatter ground to reduce the chance of landing pads being buried. This is not an error as such and you may attempt to move the starport to another location by changing latitude and longitude fields.
Surface starport name: Tomm's Sanctuary, Body name: Deimos, In sector: x = 0, y = 0, z = 0.
Info: Warning: Lua custom Systems definition: Surface starport has been automatically relocated. This is in order to place it on flatter ground to reduce the chance of landing pads being buried. This is not an error as such and you may attempt to move the starport to another location by changing latitude and longitude fields.
Surface starport name: Thebe Gas Refinery, Body name: Thebe, In sector: x = 0, y = 0, z = 0.
Info: Warning: Lua custom Systems definition: Surface starport has been automatically relocated. This is in order to place it on flatter ground to reduce the chance of landing pads being buried. This is not an error as such and you may attempt to move the starport to another location by changing latitude and longitude fields.
Surface starport name: Port Makenzie, Body name: Titan, In sector: x = 0, y = 0, z = 0.
Info: Warning: Lua custom Systems definition: Surface starport has been automatically relocated. This is in order to place it on flatter ground to reduce the chance of landing pads being buried. This is not an error as such and you may attempt to move the starport to another location by changing latitude and longitude fields.
Surface starport name: Pluto Research Base, Body name: Pluto, In sector: x = 0, y = 0, z = 0.
Info: Created shader sphereimpostor (address=0x12b2bce0)
Info: Listening for headtracking packets on 127.0.0.1:4242
Info: Pi shutting down.
[Thread 0x7fffe88626c0 (LWP 12481) exited]
Info: StarSystemCache: misses: 1, slave hits: 0, master hits: 0
Info: SectorCache: misses: 1, slave hits: 0, master hits: 4
[Thread 0x7fffeb3726c0 (LWP 12475) exited]
[Thread 0x7fffebcb46c0 (LWP 12474) exited]
[Thread 0x7fffea8706c0 (LWP 12478) exited]
[Thread 0x7fffe90636c0 (LWP 12480) exited]
[Thread 0x7fffe98646c0 (LWP 12479) exited]
[Inferior 1 (process 12468) exited normally]
(gdb)
`

@Bodasey
Copy link

Bodasey commented Mar 13, 2025

load saved games: incompatible to own format? (Test game was originally from master, saved with this branch, was not able to load the game again)

happens also with games fresh started in this branch

@fluffyfreak
Copy link
Contributor Author

I haven't seen the issues with save game loading you're seeing bodasey. Can you give me some reproducation steps, like where you started, and what you did?

It does seem to change generation enough that there would need to be a savegame bump, but I've had no issues with saving a loading save generated by this branch.

@Bodasey
Copy link

Bodasey commented Mar 15, 2025

This happened during game play, just after the program start - whatever has been saved with this branch could not be loaded again and terminated pioneer. I'll upload my saves here when my pioneer special computer is on again, do you upload yours, please?

@Bodasey
Copy link

Bodasey commented Mar 15, 2025

Maybe related to #6047 and #6064

@Bodasey
Copy link

Bodasey commented Mar 18, 2025

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

Successfully merging this pull request may close these issues.

2 participants