X Tutup
Skip to content

Refactor the Bulletin Board System#5312

Merged
sturnclaw merged 20 commits intopioneerspacesim:masterfrom
sturnclaw:bbs-refactor
Jan 10, 2022
Merged

Refactor the Bulletin Board System#5312
sturnclaw merged 20 commits intopioneerspacesim:masterfrom
sturnclaw:bbs-refactor

Conversation

@sturnclaw
Copy link
Member

@sturnclaw sturnclaw commented Dec 23, 2021

This PR has sitting in my development branch for a long time waiting to be rebased off of the prerequisite commits; I've finally found time (and landed enough other supporting work) to get it separated out and opened.

This essentially refactors the data that BBS advertisements provide to the bulletin board system with an eye to presenting more comprehensive information and allowing easy filtering of BBS ads by the user. Advanced filters and sorting are not currently implemented, but this PR does the difficult legwork of refactoring the various BBS modules to make that data available.

Here's an example screenshot of what the BBS looks like when making use of this data:
image
There is a noticeable amount of unused space on the right side; in the initial mockup this was to display the contents of the BBS ad, for the purposes of this PR it's left as-is and will be revisited with further work towards filtering and sorting.

This change does necessitate an extensive number of changes to language resources to provide this data; I've made a few opinionated changes of my own to slightly normalize the way mission text is presented and in general make mission titles a little more unique. This is overall minimal, just a few changes to wording and sentence structure.

As of writing, this PR covers all BBS advertisements with the exception of @impaktor's SoldOut module (as that module was developed after this work was done).

This PR branch also includes a few improvements to the UI, including a complete refactor of the way the station view screen handles drawing it's bottom "info bar" and window padding. It also contains a long-suffering bugfix for the DESCENT_RATE alarm volume - your ears are safe again!

Fixes #5076.

CalcTextSize takes an optional font parameter which overrides the currently active font.

Fix an issue with IsAnyWindowHoverered.
Expand SystemBody handling, makes getBodyIcon suitable for both world display and maps.
ui.Format routines now return a single formatted parameter.
Add -Unit suffixed functions which return two parameters.
Fix text in gauges being misaligned (don't use fudged offset value, calculate text alignment from C++).
ui.rescaleUI now implicitly assumes the base size is 1600x900.
General cleanup and fixes to ui.addFancyText.
Handle window padding and drawing the ship status in the station view file instead of duplicated and scattered across seven files.

Slightly rework the station lobby to use the full width and put the request launch button underneath the portrait.

Other minor tweaks and fixes.
Show mission due date, reward amount, as well as mission short title string.
Also fix some issues with gauge drawing and text formatting.
Bulletin board now shows in-system or inter-system distance to the target of the mission, if present.
Added titles to the DeliverPackage module. Sadly, this will require retranslation.
Update Assassination, CargoRun, Combat, SAR, Taxi modules to support new BBS information.
Templatize Graphics::ProjectToScreen.
Add zoom, tag position querying to ModelSpinner.
ModelViewer now properly loads non-SGM files.
SceneGraph::Model now displays the bounding sphere.
@impaktor
Copy link
Member

Very nice!

I'll see if I can wedge my SoldOut module into this PR, so you can focus on doing other cool stuff.

Thought for the future: Search/filter function on target direction / quadrant.

Regarding the empty space to the right, we can think of it as a step towards making Pioneer "mobile vertical mode friendly" ;)

@robothauler
Copy link
Contributor

Looks really good!

This is what I found while testing:

When I switch to the 2d radar:

Fatal: [string "[T] @pigui/modules/radar.lua"]:99: attempt to concatenate local 'd_u' (a nil value)
stack traceback:
[string "[T] @pigui/modules/radar.lua"]:99: in function 'display2DRadar'
[string "[T] @pigui/modules/radar.lua"]:211: in function 'draw'
[string "[T] @pigui/views/game.lua"]:57: in function 'callModules'
[string "[T] @pigui/views/game.lua"]:240: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:149: in function 'window'
[string "[T] @pigui/views/game.lua"]:230: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:587: in function 'withStyleColors'
[string "[T] @pigui/views/game.lua"]:229: in function <[string "[T] @pigui/views/game.lua"]:216>Fatal: Frame instance deletion outside 'DeleteFrame' [0]
free(): invalid pointer

When I land at a station and enter the lobby, the error window appears:

Warning: [string "[T] @pigui/modules/station-view/01-lobby.lua"]:174: attempt to index upvalue 'station' (a nil value)
stack traceback:
[string "[T] @pigui/modules/station-view/01-lobby.lua"]:174: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:547: in function 'withFont'
[string "[T] @pigui/modules/station-view/01-lobby.lua"]:173: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:294: in function 'child'
[string "[T] @pigui/modules/station-view/01-lobby.lua"]:285: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:620: in function 'withStyleVars'
[string "[T] @pigui/modules/station-view/01-lobby.lua"]:255: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:547: in function 'withFont'
[string "[T] @pigui/modules/station-view/01-lobby.lua"]:254: in function <[string "[T] @pigui/modules/station-view/01-lobby.lua"]:220>
...
[string "[T] @pigui/libs/wrappers.lua"]:149: in function 'window'
[string "[T] @pigui/views/tab-view.lua"]:116: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:652: in function 'withStyleColorsAndVars'
[string "[T] @pigui/views/tab-view.lua"]:113: in function 'renderTabView'
[string "[T] @pigui/views/station-view.lua"]:76: in function 'draw'
[string "[T] @pigui/views/game.lua"]:57: in function 'callModules'
[string "[T] @pigui/views/game.lua"]:240: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:149: in function 'window'
[string "[T] @pigui/views/game.lua"]:230: in function 'fun'
[string "[T] @pigui/libs/wrappers.lua"]:587: in function 'withStyleColors'
[string "[T] @pigui/views/game.lua"]:229: in function <[string "[T] @pigui/views/game.lua"]:216>

@sturnclaw
Copy link
Member Author

When I switch to the 2d radar:

Fixed.

When I land at a station and enter the lobby, the error window appears:

Fixed. This is actually caused by clicking Request Launch on the previous station's lobby menu; you just don't see the error until you land at another station.

@Bodasey
Copy link

Bodasey commented Dec 24, 2021

Looks Great!

fixes #5076? Needs a bit a longer play time to get a list long enough.

Some unexpected graphical issues in the smuggler store and the fuel trade:

Schmuggelladen

Treibstofflager

funny this is corrected when trading:

Treibstofflager_Handel

slide bar where not expected:

Schieber

traveller's advice does not fit new standard:

travellersadvice

@robothauler
Copy link
Contributor

One more thing. The additional data e.g. title, due etc. are not restored after save/load.

@Bodasey
Copy link

Bodasey commented Jan 1, 2022

I'd say #5076 is fixed with this

..but did you change something in the autopilot / landing / orbital station code? Touches (until total damage) when flying into the dock of orbital stations are unusual frequently (ca. every second fly-in!), often seen an 3d-ERROR display before death.

@sturnclaw
Copy link
Member Author

@impaktor can I ask you to handle converting the Traveller's Advice module to the new standard as well? The data format should be relatively self documenting from the diff of a changed module; most likely the bulk of the work will be separating title strings from short description.

- Add new breakpoints for Pionillium aimed at more coherent theming
- Expose new ImGui style vars to LuaPiGui
- Fix crash with ModelSpinner not having a valid model ptr
- Add trailing digit control to ui.Format.Mass
@robothauler
Copy link
Contributor

The autopilot set speed mode crashes. I guess because of the ui.Format thing.

@sturnclaw
Copy link
Member Author

Fixed in another branch, will backport the commits here when I get a chance.

@Bodasey
Copy link

Bodasey commented Jan 5, 2022

One more thing. The additional data e.g. title, due etc. are not restored after save/load.

confirmed, screenshot is from equipment screen branch, all the bulletins once displayed before the game has been saved are affected. Only display is disturbed, data are safe, click on an affected bulletin, the submenu answers all the questions.

first_line_missing

@impaktor
Copy link
Member

impaktor commented Jan 8, 2022

Have cloned it just now, will look at it soonish, I hope.

@robothauler
Copy link
Contributor

Sometimes the reward is displayed incorrectly. For example, $2,075 is displayed as $2,75 in the BBS.
Happens when a "0" follows the ",".

image

Unify initial and loading advertisement placement.
Calculate title / description at runtime to reduce amount of string data.
@sturnclaw
Copy link
Member Author

sturnclaw commented Jan 10, 2022

Fixed reward formatting. Now more robustly handles large values.

Save/load should be fixed now (with the exception of the Traveller's Advice and SoldOut modules which have not been ported to new standard). Validating this requires a new savefile (or to regenerate all missions by leaving the system) due to mission save format changes in several modules. No guarantees are made that existing saves will load correctly as we're savebumping for this release.

Going to merge this tomorrow if no major issues are found, and will handle the remaining minor cosmetic problems in a future branch. @Bodasey when this is merged, I'd appreciate it if you could open a new issue with the goods trader and refueling widget issues - I'll track those separately to this PR.

- Use semantic font sizes for BBS, cleanup rendering logic.
- Fix GoodsTrader UI issues.
- Tweak CommodityMarket fonts, add import/export icons.
@sturnclaw
Copy link
Member Author

GoodsTrader and FuelClub bugs have been resolved, no need to open an additional issue. I've also adjusted font sizes and added the economic status icon to the commodity market widget while I was there.

image

@Bodasey
Copy link

Bodasey commented Jan 10, 2022

short survey done

Fixed reward formatting.

confirmed

Some unexpected graphical issues in the smuggler store and the fuel trade:

fixed

save format:
seems to be all right

@sturnclaw sturnclaw merged commit 289a288 into pioneerspacesim:master Jan 10, 2022
@sturnclaw sturnclaw deleted the bbs-refactor branch January 10, 2022 19:39
impaktor added a commit to impaktor/pioneer that referenced this pull request Jan 27, 2022
(Needed for BBS refactor pioneerspacesim#5312, and Cultures based name gen pioneerspacesim#5223)
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.

Bulletin Board: Search results are mixed when one is chosen

4 participants

X Tutup