Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: [1] 2 3 ... 11

Author Topic: [0.96a] Combat Radar v3.0 (released 2023-05-05)  (Read 300365 times)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
[0.96a] Combat Radar v3.0 (released 2023-05-05)
« on: December 20, 2013, 08:07:30 PM »

Combat Radar
Download version 3.0 (mirror)
View source code and progress
Supports Version Checker

This mod requires LazyLib to function!

Spoiler

[close]

Trying to calculate direction using vanilla's system of icons around the edge of a rectangular screen can be frustrating, and forget about judging relative positions at a glance. Tired of being forced to constantly check the tactical map to obtain basic situational awareness? Ever wish that Starsector would just include a normal radar view? Then this mod is for you. It does exactly as its name implies: adds a more familiar circular radar view to your combat HUD to make keeping track of the battle map on the fly much easier. It also includes an easily-parsed combat readiness meter for the piloted ship as well as a simple overview of how the battle is going for your side.

The radar's zoom level can be changed using +/- and toggled with K, and has three zoom levels by default. These options can be changed by modifying the .json files in data/config/radar/, along with other settings such as UI/contact colors, radar sight radius, etc.

Compatibility:
The radar should work with any other mod on the forum and doesn't require a new game. As the radar is display-only and doesn't change anything in your game, you can deactivate this mod at will.

Legend:
Spoiler
  • Zoom level is shown as four small white lines perpendicular to the cardinal directions. How close they are to the radar's center depends on the current zoom level. Zoom is controlled with K.
  • Ships are drawn as polygons. Phased ships will appear faded on the radar, and your ship's current target will have a white marker drawn around it.
  • Shields will have their active arcs shown in blue.
  • Missiles are small colored dots; red for enemy missiles, green for allied ones. The brightness of the dot varies based on how much damage that missile deals, so an Atropos torpedo (2,000 damage) is much more noticeable than an Annihilator swarm (200 damage each). Missiles that are locked onto the player ship are colored orange. Missiles that have burnt out are considered enemies as they can hit either side at that point.
  • Missile lock status is displayed at the top left of the radar box. If any guided missiles are in view and locked onto the player ship, an orange missile icon will appear here. The brightness of this icon depends on the most threatening missile currently locked on.
  • Asteroids are small white dots.
  • Objectives are large hollow diamonds.
  • Retreat areas are shaded yellow.
  • Map borders are shown as red lines, with a gray void beyond to show inaccessible areas.
  • Combat readiness for the player ship is shown as a vertical bar to the right of the radar. Current CR is shown in cyan, CR lost in the current battle in dark blue, and unobtained CR in dark gray. The bar will slowly flash if you are currently losing CR and flash faster as malfunction risk rises. For ships that don't lose CR this bar will be faded to be less obtrusive. If you are playing in campaign, your ship's maximum CR given the current captain and crew is shown as a horizontal white line.
  • Battle progress is shown as a bar along the bottom of the radar. It's based on fleet points remaining on each side, so the larger the green portion is, the closer to victory you are. A side's portion of the bar will flash if they are in full retreat. The relative fleet strengths at battle start is shown as a vertical white line so you can quickly tell if you're doing better than your opponent.
[close]

All colors listed above can be customized in the radar config files.

Please let me know if you spot any issues, especially alongside other mods that use OpenGL such as GraphicsLib.

Changelog:
Spoiler
Quote
3.0 (May 05, 2023)
====================
Updated to be compatible with Starsector 0.96a
Renamed mod back to Combat Radar and removed all campaign functionality
Greatly increased the default maximum shown for all renderer plugins

 2.5b (August 28, 2020)
========================
Moved version file hosting to GitHub

 2.5 (November 16, 2018)
=========================
Updated to be compatible with Starsector 0.9a
Added the Squall to the missile lock icon exclusion list
Missile renderer changes:
 - Changed missile contact colors to make them easier to distinguish from ships
   (default dark purple for enemy and burnt out missiles, dark green for allied,
    orange for missiles that are locked onto the player ship)
 - Added "enemyMissileColor" and "friendlyMissileColor" to radar_settings.json

 2.4c (May 05, 2017)
=====================
Temporarily hide ship debris (will write a proper renderer for it later)

 2.4b (April 21, 2017)
=======================
Fixed choppy radar animations when time dilation ship systems are in effect

 2.4 (April 21, 2017
=====================
Updated to be compatible with Starsector 0.8a
Campaign radar is disabled by default now that vanilla has its own radar UI
 - Enable by setting "showCampaignRadar" to false in data/config/settings.json

 2.3b (March 16, 2017)
=======================
Switched version file hosting to Bitbucket
Combat Readiness renderer changes:
 - Fixed timer bar being misaligned by a single pixel

 2.3 (November 10, 2016)
=========================
Bumped up default radar size by 25% (was 1/5 of display height, now 1/4)
Slightly lowered default radar transparency (was 70%, now 65%)
Reversed direction of radar ring fade, now more transparent towards center
 - To use the old setting, enable "reverseRingFade" in radar_settings.json
Added "showMemoryUsage" setting to radar_settings.json (disabled by default)
Fixed SpriteBatch position issues when used with non-centered SpriteAPIs
Removed Slick2D geometry classes (now unused, see ShipRenderer changes below)
Added data/config/radar/excluded_missile_locks.csv:
 - Missiles in this file will not be drawn orange when targeting the player,
   nor will a missile lock icon be shown
Campaign nebula renderer changes:
 - Custom campaign terrain with the tag "radar_nebula" will be drawn as nebulae
 - Added slight alpha level variations to visually break up the nebula tile map
Combat asteroid renderer changes:
 - Fixed asteroids being drawn when the player flagship is destroyed
Missile renderer changes:
 - Fixed flares using the wrong settings, obeys flareContactSize setting now
Ship renderer changes:
 - Completely rewritten; now draws ships using their sprite, not collision
   bounds, for perfect accuracy - this includes fighters as well
 - Shields are now drawn underneath ships
 - Minimum render sizes for ships and fighters (independent of zoom level; by
   default a ship will never go below 8 pixels wide, nor a fighter below 6)
   This should fix small ships becoming nigh-invisible at max zoom
 - Bumped up default maxShown setting to 100 (was 60)
 - New settings:
   - "renderMode", controls whether ships/fighters are drawn using their sprites
     or as simple triangles. Valid options: SPRITES, SIMPLE_FIGHTERS, SIMPLE_ALL
   - "minShipSize", minimum size in pixels a ship will be rendered at regardless
     of current zoom level (no more invisible ships at max zoom)
   - "minFighterSize", same as above, but for fighters only
   - "simpleIcon", the sprite used when a simple render mode is used. By default
     this is the same triangle used for fleets in the campaign radar
New combat renderer: NebulaRenderer
 - Equivalent to campaign nebulae renderer

 2.2 (December 25, 2015)
=========================
Empty rows in radar CSVs are ignored correctly
Added to radar_settings.json:
 - "radarSize", determines the size of the radar as a fraction of the display
   height, defaults to 0.2 or 20% display height. Keep in mind that the radar
   adds 10% of its diameter as padding to the side/below.
 - "allyColor", the color of teammates in battle
Increased default "maxShown" settings due to optimizations to sprite rendering
Added getAlliedContactColor() to CommonRadar interface
Added isPointOnRadar() to CommonRadar interface
Added ReloadRadar console command (only if Console Commands mod is enabled)
Battle progress renderer changes:
 - Allies have their own section of the bar
Combat ship renderer changes:
 - Allied ships have their own color
New campaign renderer: NebulaRenderer
 - Handles nebula and deep hyperspace, does not show hyperspace storms yet
New optional renderer: MemoryUsageRenderer
 - Appears to the left of the radar in both campaign and combat
 - White portion of bar is fraction used of max allocatable memory
 - Gray portion of bar is fraction allocated of max allocatable memory
 - Shows heap memory on left, non-heap memory on right
   (heap is the value most users will want to keep an eye on)
 - Disabled by default, enable in the relevant CSVs in data/config/radar
New utility class: SpriteBatch
 - Aids in efficiently drawing a sprite many times in a row
Miscellaneous optimizations and improvements

 2.1 (November 19, 2015)
=========================
(thanks to MesoTroniK for spritework and extensive help testing new features)
Updated to be compatible with Starsector 0.7a
The "maxShown" setting has been enabled for all renderers, defaults increased
Added "verticesPerCircle" setting, increase this for smoother radar rings
Asteroid renderer (both campaign and combat) changes:
 - Uses a sprite now, should look much smoother
 - Scaled based on their true size, not a flat value multiplied by zoom level
Campaign fleet renderer changes:
 - Uses a sprite now, should look much smoother
 - Unknown (transponder off) contacts are shown in neutral colors
 - Fixed issue where player fleet would flash bounty colors if a faction was
   paying for kills against their enemies and was hostile towards the player
Planet renderer changes:
 - Uses vanilla map icons instead of polygons
 - Differentiates between planets and stars
Battle objective renderer changes:
 - Fixed pop-in issue when objective is at the very edge of radar
 - Added a slight tinge to the center of the objective diamond
 - Changed render order to be drawn below other combat entities
Combat readiness renderer changes:
 - Bar is dimmed until you have started losing combat readiness
 - Remaining peak CR timer is shown as a white line down the middle of the bar
Combat ship renderer changes:
 - Separated ship and shield rendering
 - Increased transparency of shields
 - Added smoothing to shields (might cause artifacts on some cards, let me know)
 - Bumped default shield segment count from 18 (?!) to 64
 - Transparency of ship contacts is based on the alpha of the actual sprite
   - Ships with custom right click ship systems won't be momentarily
     transparent on the radar when using them now (ex: Exigency Incorporated)
   - Fighters taking off or landing on a carrier should fade in/out
 - Removed "phasedShipAlphaMult" setting, added "minShipAlphaMult"
   (ships with 0 alpha will be completely invisible regardless of this setting)
 - Polygon triangulator is now a config file option, added the other Slick2D
   triangulator implementations
 - Fixed bug causing shields to have the wrong number of segments
 - Bumped default fighter contact scaling from 175% to 225% actual size
 - Use sprite size instead of collision radius for calculating fighter size
   (this should fix the issue with shield drones and their oversized radius)
 - Fixed issue where a fighter's shields weren't being scaled
Missile renderer changes:
 - Uses a sprite now, should look much smoother, sprite shows facing of missile
 - Differentiates between missiles and flares
 - Missile contacts are the same size at every zoom level
 - New settings: "missileContactSize" and "flareContactSize"

 2.0 (October 04, 2015)
========================
Radar framerate is now separate from Starsector's framerate, defaults to 20 FPS
Merged radar settings into a single file, data/config/radar/radar_settings.json
Combined campaign and combat radars into one codebase
Replaced CampaignRadar and CombatRadar with a generic CommonRadar interface
Added excluded_ships.csv, can exclude single hulls or ones with certain prefixes
Added excluded_missiles.csv, can exclude missiles by their projectile ID
Added RadarSettings class to retrieve loaded renderers and radar settings
Added getCurrentSightRadius() to CommonRadar interface
Improved icon for relays in the campaign
All renderers now support a "maxShown" setting where valid
Campaign fleet renderer changes:
 - Fleets with a bounty on their head are now shown as gold on the radar
   (faction-level bounties flash between gold and their regular color so you
    won't accidentally chase/attack a friendly faction)
Combat progress renderer changes:
 - Relative fleet balance calculation is no longer based on information that
   the player can't obtain in-game, is instead now based on the ship's fleet
   point costs (with a 75% penalty to calculated strength for civilian ships)
New combat renderer: MapBorderRenderer
 - Displays retreat zones in yellow
 - Displays gravity barrier line in red
 - Displays out of bounds in grey
New combat renderer: ShipRenderer
 - Replaces ShipSimpleRenderer and ShipPolygonRenderer
 - Draws proper polygons for ships instead of approximations like old system
 - Will fall back to approximations on ships that can't be triangulated (only
   the Paragon in vanilla and a handful of ships in existing mods)
 - To draw ships as triangles instead (like with the old ShipSimpleRenderer),
   change "simpleMode" to true in radar_settings.json under "shipRenderer"
 - Shields are drawn filled, can be reverted to the old behavior by changing
   "drawSolidShields" to false in radar_settings.json under "shipRenderer"
New utility class: DrawQueue
 - Aids in efficiently drawing many primitive shapes multiple frames in a row
 - Handles native buffer allocation/data/resizing automatically
 - Uses VBOs if the user's card supports them (hint: it does)
New utility class: ShapeUtils
 - Calculates vertices (as float arrays) for common shapes
All interfaces are now fully documented (see javadoc.zip in mod folder)
Miscellaneous optimizations and improvements

 1.1f (March 06, 2015)
=======================
Fixed a bug that caused intermittent radar corruption in the campaign
Lines and points on the radar should look much sharper now (thanks Alex)

 1.1e (February 12, 2015)
==========================
Stations and planets with the "comm_relay" tag aren't considered relays
The campaign radar won't draw anything with the tag "radar_nodraw"

 1.1d (December 09, 2014)
==========================
Hopefully fixed a bug where campaign radar components would occasionally vanish

 1.1c (December 03, 2014)
==========================
The radar is no longer drawn over menus or when the HUD is turned off
Greatly increased the speed of the battle progress bar animation
Fixed crash in ShipPolygonRenderer when rendering ships that lack bounds
Radar no longer reactivates when the player's ship is fully destroyed

 1.1b (October 23, 2014)
=========================
Campaign fleet renderer changes:
 - Fleets are only colored red if they are hostile towards the player
Battle progress bar changes:
 - Doesn't show initial relative fleet strengths in a simulation battle
 - Ignores ships still in picker in simulation battles
 - Doesn't count the reserves of a fleet in full retreat

 1.1 (October 21, 2014)
========================
Updated to support Starsector .65a
Station rendering fixed in campaign
Comm relays are now included on the campaign radar
Zooming is now done using +/-, toggling the radar on/off is still K by default
Zooming in/out is now animated
[close]
« Last Edit: May 05, 2023, 01:35:02 PM by LazyWizard »
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #1 on: December 20, 2013, 08:50:43 PM »

Brilliant!

That's something I've wanted in this game for, like, ever.  

Just my $0.02 on what we're seeing (for what it's worth, given that I am just yapping):

1.  A square presentation using the same colors as the UI would fit better visually.

2.  I'd place it in the right corner, so that it's out of the way but isn't in a zone that's too busy with other information.

3.  I'm sure a fair amount of the CPU time is spent on drawing the vector'd triangles.  

Perhaps not bothering, or depicting velocity by storing two update cycles-worth of past ship movement and drawing with less alpha (i.e., last update, 128, update 2, 64, so that it fades out and dynamically shows movement) using circle bitmaps might help save CPU while accomplishing the goal?  The other big saver would be to not show every single Fighter, but merely a symbol for the group, centered on the leader, and Drones definitely don't need a complex presentation- moving dots are totally sufficient.

4.  For the issues with menus... probably:

A.  A simple global that could be set / unset in a singleton; this would require minor touchup to the Dialog and Battle code (one-liners to set said value true false), not too scary but it'd require people to compile a .jar atm.

B.  Give users a key that can turn it on / off in any context.
« Last Edit: December 20, 2013, 08:54:06 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #2 on: December 20, 2013, 09:09:17 PM »

Just my $0.02 on what we're seeing (for what it's worth, given that I am just yapping):

1.  A square presentation using the same colors as the UI would fit better visually.
I originally tried this as a square box, but IMO rectangular radars are ugly. Definitely agree on matching the UI colors, though. Luckily that's pretty trivial to change.

Quote
2.  I'd place it in the right corner, so that it's out of the way but isn't in a zone that's too busy with other information.
It's in the lower right due to the 'rendering over menus' issue. If I moved it to the top right it'd render over a lot of the tactical map's buttons.

Quote
3.  I'm sure a fair amount of the CPU time is spent on drawing the vector'd triangles.
I wouldn't worry about the triangles, that'll be a non-issue once I optimize. :)

Quote
B.  Give users a key that can turn it on / off in any context.
That's next on my list!
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #3 on: December 20, 2013, 09:31:43 PM »

I meant squared up with the menu edge.

As for the aesthetics, the rest of the UI is angular, so it's standing out.  A box around it, perhaps, and fade the outer circles, something like this?

Spoiler
[close]
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #4 on: December 21, 2013, 08:07:38 AM »

Nicely done! I was wondering about the primitive draw methods you put in LazyLib... ;)
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #5 on: December 22, 2013, 11:16:58 AM »

Honestly this feature should become part of the main code, the current radar system...doesn't give quite a satisfactory amount of real time information. Are you able to have different size and different colour vectors as proposed by Xenoargh, that would be invaluable in larger battles.
Logged

HELMUT

  • Admiral
  • *****
  • Posts: 1363
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #6 on: December 23, 2013, 02:23:37 AM »

Damn useful indeed. I hope you'll also manage to implement the missiles detection into the radar too, i hate being surprised by Pilums lrm storms.
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #7 on: December 24, 2013, 03:16:23 PM »

Version 0.2 is up, get it here.

Changes in this update:
  • Radar positioning is still a placeholder, but I moved the radar to the absolute lower right so it wouldn't overlap the UI when using a 1024x768 resolution.
  • I upped the number of segments on the circles to make them look smoother. I also changed the colors to match what's set for the UI in settings.json ("textFriendColor" is used for the UI, "iconFriendColor"/"iconEnemyColor" for radar contacts).
  • Finally, the mod should have significantly better performance in large battles as I reduced trig calls by 60% (I told you it needed optimization).

Sorry about the lack of actual progress. I've been busy with holiday stuff.


Nicely done! I was wondering about the primitive draw methods you put in LazyLib... ;)
I actually added those methods after stumbling across a page that described drawing circles using a simple repeated rotation. At the time I didn't even know rendering in combat was possible and was planning on making a campaign-level radar. :)


I meant squared up with the menu edge.

As for the aesthetics, the rest of the UI is angular, so it's standing out.  A box around it, perhaps, and fade the outer circles, something like this?

Spoiler
[close]
Yeah, the current positioning is just an arbitrary guess until I can spend the time getting it right. I don't think the combat UI is scaled, so once I measure the existing UI getting the radar to look good will be easy. I'm considering leaving a bit of extra space for potentially implementing this suggestion, though.

Also, I really like that mock-up. You're right, with the darkened edges it matches the UI much better. Consider it added to the to-do list. :)


Honestly this feature should become part of the main code, the current radar system...doesn't give quite a satisfactory amount of real time information. Are you able to have different size and different colour vectors as proposed by Xenoargh, that would be invaluable in larger battles.
Maybe as a toggleable option, though I personally prefer the triangles. The trick is including as much information as possible without it being an indecipherable mess, and blurred points take longer to mentally process than distinct shapes. Plus, I think in most battles knowing a ship's facing is more important than their current velocity.


Damn useful indeed. I hope you'll also manage to implement the missiles detection into the radar too, i hate being surprised by Pilums lrm storms.
I'm planning on displaying ships (including phased status and a marker around your current target), missiles, asteroids, and maybe shield arcs. There will be a settings file to toggle these on/off. :)
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #8 on: December 24, 2013, 04:24:57 PM »

Because I said I would add it and then forgot, here's a quick release that adds a toggle button: download

The toggle key is set in data/config/combat_radar.json and defaults to K. The keyboard codes for the config file can be found here.
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #9 on: December 24, 2013, 11:48:17 PM »

Merry Christmas Lazy Wizard. I guess you're right, it would likely be a bit overwhelming like that. What about different zoom scales? Or perhaps a 1-pixel border of a darker shade to give a higher contrast to each object?
Logged

FasterThanSleepyfish

  • Admiral
  • *****
  • Posts: 727
  • Blub
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #10 on: December 25, 2013, 12:28:51 AM »

This is truly the work of the gods... oh wait, its lazywizard! Close enough.

'Sucuse my silliness, but all-in-all, nice work! You could call it the "LazyTweaks" mod if you combine it with other non-combat focused mods in the future. Just sayin'.
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #11 on: December 25, 2013, 07:55:44 AM »

First of all Happy Christmas for you guys,.

Second, isnt it possible using the ships bounds to create a shape of the ship instead of a triangle shape?
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #12 on: December 25, 2013, 08:18:23 AM »

Huh, I've never thought about that. Although as far as I know (which isn't much after only two weeks of OpenGL experience), concave polygons need to be broken up into multiple convex polygons to be filled properly. That would make rendering slower/more difficult.
Logged

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #13 on: December 25, 2013, 08:19:01 AM »

Or maybe assign different shapes based on different hull types?
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: [.6.1a] Combat Radar (early WIP available)
« Reply #14 on: December 25, 2013, 12:50:01 PM »

I think the simplist way to render a 1-pixel border would be to have 2 triangles per object. The first triangle is the lighter colour, and the second triangle is the darker colour. Assuming it renders the first triangle above the second, you will achieve a border?

Also as Uomoz was suggesting, different shapes based on different hull types. check the icons in http://fractalsoftworks.com/forum/index.php?topic=6906.msg112651#msg112651
Logged
Pages: [1] 2 3 ... 11