Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: boggled on December 30, 2019, 04:27:30 PM

Title: [0.9.1a] Player Gate Construction
Post by: boggled on December 30, 2019, 04:27:30 PM
[0.9.1a] Player Gate Construction

This mod has been integrated into Terraforming and Station Construction.

This thread can be locked/deleted. Thank you.

https://fractalsoftworks.com/forum/index.php?topic=17094.0 (https://fractalsoftworks.com/forum/index.php?topic=17094.0)
Title: Re: [0.9.1a] Player Gate Construction (v0.8.0)
Post by: MesoTroniK on December 30, 2019, 05:05:27 PM
Interesting mod Boggled, but I have a request for you so it doesn't harm some extant and also planned mod content :)

A mergeable .csv or .json file that can make it so that your active gate does not replace an inactive one when desired in X star system IDs or Tags. This is important for hidden content and such discoverable things where it should be for story and gameplay reasons hard to reach them.
Title: Re: [0.9.1a] Player Gate Construction (v0.8.0)
Post by: Harmful Mechanic on December 30, 2019, 08:16:50 PM
Probably the most elegant option is to make the gates use Stable Locations. Then, even without tags or other complex methods, there's a simple mechanism for blocking gate access to some systems; no Stable Locations, no gate. We also don't know what inactive gates are going to do in the future vanilla game, so you may have to change this mechanic anyway; might as well get ahead of it now.

I'd make gate use a flat activation cost; a couple hundred Fuel + 5-10 Rare Metals would work. Make it high enough that it's impractical for short distances but attractive for long ones; then, it still makes sense to fly around hyperspace normally, but strategic gate placement and use can still cut down your travel times. Plus, now gates are competing for Stable Locations with things like Nav Buoys, Sensor Arrays, and Comm Relays; scrapping and replacing your built gates seems like a natural progression.

(As far as a gate sprite goes; yeah, I think changing it is a good idea. If nothing else, centering the warp-bubble on the spin axis of the gate would be nice).
Title: Re: [0.9.1a] Player Gate Construction (v0.8.0)
Post by: Wispborne on January 02, 2020, 12:28:17 PM
Having a market in the gate station causes ships to appear and disappear from it like any other market. If I remove the market, is there any way to create a realistic appearance of other fleets using the gates?

By appear and disappear, you mean that ships fly to/from there, right? And they'd hover over the gate, trading, then leave again?

Toast and Wispborne - I copied a very small portion of their code relating to performing the actual jump.

Thanks for the credit, especially since what you copied is indeed very small.


Any idea how this mod plays with Gates Awakened? Perusing the code, seems like there would be no interaction, since it is all driven using abilities, not dialog. Looks like you can replace a GA-active gate with a Boggled gate, and cannot jump to a GA-active gate from a Boggled gate (or vice-versa).
I believe that Gates Awakened will detect, on game load, if a gate has been cannibalized by Boggled and will refund the player an activation code.

Right now the gates replace existing inactive gates because it was very easy to implement this (due to orbits, etc.) and sort of makes sense. Should I make the gates buildable anywhere?
Probably the most elegant option is to make the gates use Stable Locations.

I had the same thought about using Stable Locations for the part of Gates Awakened where you can create a gate, but lore-wise, the stable locations are stable in hyperspace, like where it's easier to access hyperspace, rather than "stable orbit" locations. So, I ended up letting the player build anywhere, with restrictions (not too close to planets). PGC is already lore-unfriendly (having the entire sector aware that gates can be built would have huge implications, which is why I sidestepped it in GA), so that might not be an issue.
Code to drop a gate at the location of a given entity: https://github.com/davidwhitman/Gates-Awakened/blob/master/src/main/kotlin/org/wisp/gatesawakened/Common.kt#L88
Title: Re: [0.9.1a] Player Gate Construction (v0.8.0)
Post by: boggled on January 03, 2020, 04:27:56 PM
Interesting mod Boggled, but I have a request for you so it doesn't harm some extant and also planned mod content :)

A mergeable .csv or .json file that can make it so that your active gate does not replace an inactive one when desired in X star system IDs or Tags. This is important for hidden content and such discoverable things where it should be for story and gameplay reasons hard to reach them.

Yeah, this is a valid concern. I think I'm going to rework constructing the gates to avoid deleting content of vanilla/other mods. Thanks for your feedback!

Probably the most elegant option is to make the gates use Stable Locations. Then, even without tags or other complex methods, there's a simple mechanism for blocking gate access to some systems; no Stable Locations, no gate. We also don't know what inactive gates are going to do in the future vanilla game, so you may have to change this mechanic anyway; might as well get ahead of it now.

I'd make gate use a flat activation cost; a couple hundred Fuel + 5-10 Rare Metals would work. Make it high enough that it's impractical for short distances but attractive for long ones; then, it still makes sense to fly around hyperspace normally, but strategic gate placement and use can still cut down your travel times. Plus, now gates are competing for Stable Locations with things like Nav Buoys, Sensor Arrays, and Comm Relays; scrapping and replacing your built gates seems like a natural progression.

(As far as a gate sprite goes; yeah, I think changing it is a good idea. If nothing else, centering the warp-bubble on the spin axis of the gate would be nice).

I think you're right. I'll make it a flat cost and remove the market from it to reduce complexity. I think I'm just going to use the default game sprite but with the warp bubble inside it. Thanks for the ideas!

Having a market in the gate station causes ships to appear and disappear from it like any other market. If I remove the market, is there any way to create a realistic appearance of other fleets using the gates?

By appear and disappear, you mean that ships fly to/from there, right? And they'd hover over the gate, trading, then leave again?

Toast and Wispborne - I copied a very small portion of their code relating to performing the actual jump.

Thanks for the credit, especially since what you copied is indeed very small.


Any idea how this mod plays with Gates Awakened? Perusing the code, seems like there would be no interaction, since it is all driven using abilities, not dialog. Looks like you can replace a GA-active gate with a Boggled gate, and cannot jump to a GA-active gate from a Boggled gate (or vice-versa).
I believe that Gates Awakened will detect, on game load, if a gate has been cannibalized by Boggled and will refund the player an activation code.

Right now the gates replace existing inactive gates because it was very easy to implement this (due to orbits, etc.) and sort of makes sense. Should I make the gates buildable anywhere?
Probably the most elegant option is to make the gates use Stable Locations.

I had the same thought about using Stable Locations for the part of Gates Awakened where you can create a gate, but lore-wise, the stable locations are stable in hyperspace, like where it's easier to access hyperspace, rather than "stable orbit" locations. So, I ended up letting the player build anywhere, with restrictions (not too close to planets). PGC is already lore-unfriendly (having the entire sector aware that gates can be built would have huge implications, which is why I sidestepped it in GA), so that might not be an issue.
Code to drop a gate at the location of a given entity: https://github.com/davidwhitman/Gates-Awakened/blob/master/src/main/kotlin/org/wisp/gatesawakened/Common.kt#L88

Yes, with regard to the market. Ships just sort of appear and disappear from planets/stations when trading which would make it look like they were using the gate.

I think you're correct about the interaction with Gates Awakened. In light of feedback received here, I'm going to change the mechanism for where the gates can be built. I'm thinking it would be ideal to make them buildable in higher orbit around planets, which will avoid any issues of conflicting with other mods by deleting content or taking up stable location slots.

I took a look at the code you linked regarding placing an entity. As far as I'm aware, the orbital period of an object is entirely dependent on the mass of the focus and the distance from the focus. The orbit period calculation in that code includes a random element, so you could easily end up with the gate having the same radius but a different period than a nearby object. Maybe I've played too much Kerbal Space Program but this would bother me enough that I think putting it in orbit around a planet is a better idea. Your code is much cleaner than mine though; I'm guessing you're a professional programmer!
Title: Re: [0.9.1a] Player Gate Construction (v0.8.0)
Post by: Wispborne on January 03, 2020, 04:40:36 PM

I took a look at the code you linked regarding placing an entity. As far as I'm aware, the orbital period of an object is entirely dependent on the mass of the focus and the distance from the focus. The orbit period calculation in that code includes a random element, so you could easily end up with the gate having the same radius but a different period than a nearby object. Maybe I've played too much Kerbal Space Program but this would bother me enough that I think putting it in orbit around a planet is a better idea. Your code is much cleaner than mine though; I'm guessing you're a professional programmer!

Good catch; I copied+modified the code from vanilla, I believe, which included the random element. I hadn't at all thought about how a stable orbit requires a certain velocity for the object's mass + distance, obvious now that you point it out. And yeah, I get paid to code, which technically means I'm a professional ;)

Just to be sure MesoTroniK's point wasn't missed, he probably wants modders to be able to blacklist whole systems from having working gates in them. He made the same request of me for Gates Awakened; the player is simply unable to activate a gate in a blacklisted system (although I never really tested it...) and randomly activated gates won't ever get placed in a blacklisted system. I simply replaced anywhere that I called getSector().getStarSystems() with my own call, which filters out the blacklisted systems.
Title: Re: [0.9.1a] Player Gate Construction (v0.8.0)
Post by: MesoTroniK on January 03, 2020, 06:13:28 PM
Yea, just I know I have some plans for literally "gated" content. Where there will be things like blockades, and disconnected from hyperspace systems and other story related things where mods such as this would totally ruin them heh.

So, being able to block mods like this from doing things to X star system IDs for handmade ones, and Y star system Tags for ones that might be proc genned is very important! And you can be sure other modders have plans for similar story related things and would thus benefit from the same stuff I requested for the same reasons.
Title: Re: [0.9.1a] Player Gate Construction (v0.8.0)
Post by: boggled on January 04, 2020, 09:05:19 AM
Yea, just I know I have some plans for literally "gated" content. Where there will be things like blockades, and disconnected from hyperspace systems and other story related things where mods such as this would totally ruin them heh.

So, being able to block mods like this from doing things to X star system IDs for handmade ones, and Y star system Tags for ones that might be proc genned is very important! And you can be sure other modders have plans for similar story related things and would thus benefit from the same stuff I requested for the same reasons.

Ok, I will make sure the 1.0 release allows certain systems to be blacklisted. Those blockaded systems sound very cool!
Title: Re: [0.9.1a] Player Gate Construction (v0.9.0)
Post by: Wispborne on January 07, 2020, 11:56:49 AM
FYI I've made it possible (https://github.com/davidwhitman/Gates-Awakened/commit/9e175e89091f2384bae00196e0b4e87ad13df154) for players to jump from a Gates Awakened gate to one of your player-constructed gates. I'm not expecting the same, totally fine if you don't, but just in case, I tag all activated gates with
Code
GatesAwakened__gate_activated
(double underscore because I screwed up and am too lazy to fix it).
Title: Re: [0.9.1a] Player Gate Construction (v0.9.0)
Post by: boggled on January 07, 2020, 01:38:31 PM
FYI I've made it possible (https://github.com/davidwhitman/Gates-Awakened/commit/9e175e89091f2384bae00196e0b4e87ad13df154) for players to jump from a Gates Awakened gate to one of your player-constructed gates. I'm not expecting the same, totally fine if you don't, but just in case, I tag all activated gates with
Code
GatesAwakened__gate_activated
(double underscore because I screwed up and am too lazy to fix it).

I just added support for active gates. The next update will include the changes. Thanks for your help!
Title: Re: [0.9.1a] Player Gate Construction (v0.9.0)
Post by: Wispborne on January 07, 2020, 02:15:28 PM
FYI I've made it possible (https://github.com/davidwhitman/Gates-Awakened/commit/9e175e89091f2384bae00196e0b4e87ad13df154) for players to jump from a Gates Awakened gate to one of your player-constructed gates. I'm not expecting the same, totally fine if you don't, but just in case, I tag all activated gates with
Code
GatesAwakened__gate_activated
(double underscore because I screwed up and am too lazy to fix it).

I just added support for active gates. The next update will include the changes. Thanks for your help!

Cool, thank you!

And small correction, my mod is Gates Awakened, which is a fork of Active Gates - I know, the names are way too similar.
Active Gates uses the tag "gate_activated" (no prefix) for its active gates.
Title: Re: [0.9.1a] Player Gate Construction (v0.9.0)
Post by: boggled on January 07, 2020, 02:25:09 PM
FYI I've made it possible (https://github.com/davidwhitman/Gates-Awakened/commit/9e175e89091f2384bae00196e0b4e87ad13df154) for players to jump from a Gates Awakened gate to one of your player-constructed gates. I'm not expecting the same, totally fine if you don't, but just in case, I tag all activated gates with
Code
GatesAwakened__gate_activated
(double underscore because I screwed up and am too lazy to fix it).

I just added support for active gates. The next update will include the changes. Thanks for your help!



Cool, thank you!

And small correction, my mod is Gates Awakened, which is a fork of Active Gates - I know, the names are way too similar.
Active Gates uses the tag "gate_activated" (no prefix) for its active gates.

I know your mod is Gates Awakened! I wrote "active gates" because that's the name of the tokens for your gates!

Gates Awakened basically superseded Active Gates right? So there's not much point adding support for the Active Gates mod because everyone has moved to yours?
Title: Re: [0.9.1a] Player Gate Construction (v0.9.0)
Post by: Wispborne on January 07, 2020, 02:39:51 PM
FYI I've made it possible (https://github.com/davidwhitman/Gates-Awakened/commit/9e175e89091f2384bae00196e0b4e87ad13df154) for players to jump from a Gates Awakened gate to one of your player-constructed gates. I'm not expecting the same, totally fine if you don't, but just in case, I tag all activated gates with
Code
GatesAwakened__gate_activated
(double underscore because I screwed up and am too lazy to fix it).

I just added support for active gates. The next update will include the changes. Thanks for your help!



Cool, thank you!

And small correction, my mod is Gates Awakened, which is a fork of Active Gates - I know, the names are way too similar.
Active Gates uses the tag "gate_activated" (no prefix) for its active gates.

I know your mod is Gates Awakened! I wrote "active gates" because that's the name of the tokens for your gates!

Gates Awakened basically superseded Active Gates right? So there's not much point adding support for the Active Gates mod because everyone has moved to yours?

People seem to prefer mine and recommend it over Active Gates, but there's no way for me to tell, really. If the player wants to be able to activate a lot of gates (without editing my config files), they'd want to keep using Active Gates.
I added support for Active Gates just because it was fairly easy to do - once you have the code to support another mod, adding one more is generally straightforward.
Title: Re: [0.9.1a] Player Gate Construction (v1.0.1)
Post by: Chewzie on January 18, 2020, 11:37:37 PM
I've just noticed a drop in FPS while skillbar with PGC skills is active.
Title: Re: [0.9.1a] Player Gate Construction (v1.0.1)
Post by: boggled on January 19, 2020, 06:25:13 AM
I've just noticed a drop in FPS while skillbar with PGC skills is active.

It is expected that there will be some level of performance impact, as with any mod that adds significant content. How bad is the FPS drop? What are your computer specs?
Title: Re: [0.9.1a] Player Gate Construction (v1.0.1)
Post by: TFrenchCanadian on February 02, 2020, 08:42:42 AM
I am not the same person but also get a massive fps hit when i have the 3 gate usage abilities (gate switch and use/activate not the build one) on my 3rd bar, i get from 30-40 fps to 1-3 fps when my ability bar with the 3 abilities is on switching to my 1st bar stop the fps hit. my device specification:

Processor : Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz 3.80 Ghz
Installed RAM : 8.00 GB
System type 64-bit operating system, X64-based processor
Graphics Card : GeForce GTX 670
Title: Re: [0.9.1a] Player Gate Construction (v1.0.1)
Post by: boggled on February 02, 2020, 11:06:48 AM
I am not the same person but also get a massive fps hit when i have the 3 gate usage abilities (gate switch and use/activate not the build one) on my 3rd bar, i get from 30-40 fps to 1-3 fps when my ability bar with the 3 abilities is on switching to my 1st bar stop the fps hit. my device specification:

Processor : Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz 3.80 Ghz
Installed RAM : 8.00 GB
System type 64-bit operating system, X64-based processor
Graphics Card : GeForce GTX 670

That's a pretty significant drop. I'll try to rewrite some of the code to improve performance, but no promises. Are you running a large amount of other mods? Despite how old it is, your computer is still relatively fast. Is Starsector installed on a HDD or a SSD?
Title: Re: [0.9.1a] Player Gate Construction (v1.0.1)
Post by: TFrenchCanadian on February 02, 2020, 04:35:26 PM
got 84 mods activated almost all of them faction mods ((including vayra sector and nexerelin) gonna put my a link to my enabled mod) as for my hard drive it is a hdd.

the link : https://drive.google.com/open?id=1rtbE0OFbBqX-IYWo1m_60BcTv3l6GMtS

EDIT: also here a recording i did to show you : https://drive.google.com/open?id=1xY1bRe_z2WsSfFOYCtjOVBwUgDsh1XKT
Title: Re: [0.9.1a] Player Gate Construction (v1.0.1)
Post by: boggled on February 03, 2020, 04:59:22 PM
got 84 mods activated almost all of them faction mods ((including vayra sector and nexerelin) gonna put my a link to my enabled mod) as for my hard drive it is a hdd.

the link : https://drive.google.com/open?id=1rtbE0OFbBqX-IYWo1m_60BcTv3l6GMtS

EDIT: also here a recording i did to show you : https://drive.google.com/open?id=1xY1bRe_z2WsSfFOYCtjOVBwUgDsh1XKT

I think the performance problem you're experiencing is definitely caused by my mod. When you have my gate abilities on the active bar, they have functions that fire every frame which evidently can cause a significant performance impact. I'm working on rewriting some of the code, but ultimately there's going to be some level of impact on slower computers. Thanks for your help with troubleshooting this!
Title: Re: [0.9.1a] Player Gate Construction (v1.0.1)
Post by: TFrenchCanadian on February 04, 2020, 12:15:01 PM
I appreciate it, thank you for you time (and the mod), looking forward the update.
p.s sorry if i am hard to read, i'm francophone.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: boggled on February 05, 2020, 05:50:45 PM
I appreciate it, thank you for you time (and the mod), looking forward the update.
p.s sorry if i am hard to read, i'm francophone.

Your English is great!

I've optimized the part of the code I believe is responsible for your performance problems, and I added a low performance mode that should completely resolve your performance issues. Please let me know if it works for you!
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: TFrenchCanadian on February 05, 2020, 08:00:10 PM
Forget that, i'm a dumbass who forgot to read the low setting instruction, it work.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: boggled on February 06, 2020, 02:28:05 PM
I tried the update, while it didn't resolve the fps hit, it did change from 1-3 to 9-10 fps so definitely an improvement ;D.
I do not know how your mod work, but does the gate selection ability scan for a gate in the galaxies because if it does I would recommend doing like the Gates Awakened (https://fractalsoftworks.com/forum/index.php?topic=16562.0) mod and add an option to only allow the gate that the player activated then again I am not a modder.

Did you use the settings file to enable low performance mode? What's the FPS with low performance mode on, and with it off?

My mod works differently than Gates Awakened. GA only allows a maximum of five active gates that the player can't choose, while my mod allows a theoretically unlimited number built anywhere the player wants. This means I have to use a different search algorithm.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: Wispborne on February 07, 2020, 01:50:13 PM
I tried the update, while it didn't resolve the fps hit, it did change from 1-3 to 9-10 fps so definitely an improvement ;D.
I do not know how your mod work, but does the gate selection ability scan for a gate in the galaxies because if it does I would recommend doing like the Gates Awakened (https://fractalsoftworks.com/forum/index.php?topic=16562.0) mod and add an option to only allow the gate that the player activated then again I am not a modder.

Did you use the settings file to enable low performance mode? What's the FPS with low performance mode on, and with it off?

My mod works differently than Gates Awakened. GA only allows a maximum of five active gates that the player can't choose, while my mod allows a theoretically unlimited number built anywhere the player wants. This means I have to use a different search algorithm.

GA allows the player to choose all of their gates. The first two are assigned for them, but they can (after the second quest) "move" the active status to any other gate. So they can have x active at any given time, deactivating and activating others at their leisure.

https://github.com/davidwhitman/Gates-Awakened/blob/master/src/main/kotlin/org/wisp/gatesawakened/Common.kt#L41

I get all systems, then use `system.getEntitiesWithTag(Tags.TAG_GATE)` to get all gates, then filter on the results of that to get gates activated by GA. This little algorithm is independent of the number of gates activated by GA.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: boggled on February 07, 2020, 02:46:02 PM
I tried the update, while it didn't resolve the fps hit, it did change from 1-3 to 9-10 fps so definitely an improvement ;D.
I do not know how your mod work, but does the gate selection ability scan for a gate in the galaxies because if it does I would recommend doing like the Gates Awakened (https://fractalsoftworks.com/forum/index.php?topic=16562.0) mod and add an option to only allow the gate that the player activated then again I am not a modder.

Did you use the settings file to enable low performance mode? What's the FPS with low performance mode on, and with it off?

My mod works differently than Gates Awakened. GA only allows a maximum of five active gates that the player can't choose, while my mod allows a theoretically unlimited number built anywhere the player wants. This means I have to use a different search algorithm.

GA allows the player to choose all of their gates. The first two are assigned for them, but they can (after the second quest) "move" the active status to any other gate. So they can have x active at any given time, deactivating and activating others at their leisure.

https://github.com/davidwhitman/Gates-Awakened/blob/master/src/main/kotlin/org/wisp/gatesawakened/Common.kt#L41

I get all systems, then use `system.getEntitiesWithTag(Tags.TAG_GATE)` to get all gates, then filter on the results of that to get gates activated by GA. This little algorithm is independent of the number of gates activated by GA.

My mistake. We actually seem to use a fairly similar method to get a list of active gates - I imagine you don't scan for updates to which gates are active every single frame though, which is where the performance problems appear to come in for people with slower computers.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: Wispborne on February 07, 2020, 02:49:17 PM
I tried the update, while it didn't resolve the fps hit, it did change from 1-3 to 9-10 fps so definitely an improvement ;D.
I do not know how your mod work, but does the gate selection ability scan for a gate in the galaxies because if it does I would recommend doing like the Gates Awakened (https://fractalsoftworks.com/forum/index.php?topic=16562.0) mod and add an option to only allow the gate that the player activated then again I am not a modder.

Did you use the settings file to enable low performance mode? What's the FPS with low performance mode on, and with it off?

My mod works differently than Gates Awakened. GA only allows a maximum of five active gates that the player can't choose, while my mod allows a theoretically unlimited number built anywhere the player wants. This means I have to use a different search algorithm.

GA allows the player to choose all of their gates. The first two are assigned for them, but they can (after the second quest) "move" the active status to any other gate. So they can have x active at any given time, deactivating and activating others at their leisure.

https://github.com/davidwhitman/Gates-Awakened/blob/master/src/main/kotlin/org/wisp/gatesawakened/Common.kt#L41

I get all systems, then use `system.getEntitiesWithTag(Tags.TAG_GATE)` to get all gates, then filter on the results of that to get gates activated by GA. This little algorithm is independent of the number of gates activated by GA.

My mistake. We actually seem to use a fairly similar method to get a list of active gates - I imagine you don't scan for updates to which gates are active every single frame though, which is where the performance problems appear to come in for people with slower computers.

Right, only when they interact with a gate and the dialog is shown.

Why do you need to do it on each frame? Couldn't it be done whenever the player uses one of the abilities?
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: boggled on February 07, 2020, 02:55:39 PM
I tried the update, while it didn't resolve the fps hit, it did change from 1-3 to 9-10 fps so definitely an improvement ;D.
I do not know how your mod work, but does the gate selection ability scan for a gate in the galaxies because if it does I would recommend doing like the Gates Awakened (https://fractalsoftworks.com/forum/index.php?topic=16562.0) mod and add an option to only allow the gate that the player activated then again I am not a modder.

Did you use the settings file to enable low performance mode? What's the FPS with low performance mode on, and with it off?

My mod works differently than Gates Awakened. GA only allows a maximum of five active gates that the player can't choose, while my mod allows a theoretically unlimited number built anywhere the player wants. This means I have to use a different search algorithm.

GA allows the player to choose all of their gates. The first two are assigned for them, but they can (after the second quest) "move" the active status to any other gate. So they can have x active at any given time, deactivating and activating others at their leisure.

https://github.com/davidwhitman/Gates-Awakened/blob/master/src/main/kotlin/org/wisp/gatesawakened/Common.kt#L41

I get all systems, then use `system.getEntitiesWithTag(Tags.TAG_GATE)` to get all gates, then filter on the results of that to get gates activated by GA. This little algorithm is independent of the number of gates activated by GA.

My mistake. We actually seem to use a fairly similar method to get a list of active gates - I imagine you don't scan for updates to which gates are active every single frame though, which is where the performance problems appear to come in for people with slower computers.

Right, only when they interact with a gate and the dialog is shown.

Why do you need to do it on each frame? Couldn't it be done whenever the player uses one of the abilities?

I update the list every frame to ensure the tooltips and usability are always accurate, as the tooltips have info about the destination gate and the number of gates in the Sector. The low performance mode simply updates the list of gates every in-game day rather than every frame.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: Wispborne on February 07, 2020, 03:44:45 PM
Gotcha. If I may be so bold, I'd suggest making the "performance mode" the default; once people get the idea in their head that a mod causes performance problems, it's *very* hard to change the collective's mind. People remember and repeat bad things but if it's fixed, or there's a workaround, most won't hear about it and will just avoid it without researching.
Just my two cents.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: boggled on February 08, 2020, 09:05:55 AM
Gotcha. If I may be so bold, I'd suggest making the "performance mode" the default; once people get the idea in their head that a mod causes performance problems, it's *very* hard to change the collective's mind. People remember and repeat bad things but if it's fixed, or there's a workaround, most won't hear about it and will just avoid it without researching.
Just my two cents.

You're entirely correct about this. I wanted to get some feedback first on the performance mode to see if it actually works and if it causes bugs or problems. If nobody reports any issues I will make it the default. It seems to have worked for AimedCanada, so that's a good sign.

Thanks for your help and advice! I appreciate it, especially considering my mod is "competing" with yours.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: Wispborne on February 08, 2020, 09:14:54 AM
Gotcha. If I may be so bold, I'd suggest making the "performance mode" the default; once people get the idea in their head that a mod causes performance problems, it's *very* hard to change the collective's mind. People remember and repeat bad things but if it's fixed, or there's a workaround, most won't hear about it and will just avoid it without researching.
Just my two cents.

You're entirely correct about this. I wanted to get some feedback first on the performance mode to see if it actually works and if it causes bugs or problems. If nobody reports any issues I will make it the default. It seems to have worked for AimedCanada, so that's a good sign.

Thanks for your help and advice! I appreciate it, especially considering my mod is "competing" with yours.

Good plan, makes sense. Competition is good, helps keep me from getting too lax haha. Plus, we have different visions and implementations, so to a large extent it's a preference thing on which mod is "better". I just like seeing good mods in the Starsector modiverse.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: Gitsum on February 14, 2020, 09:36:20 AM
I have huge FPS drops when I change between the "Colony Info" and "Resources" tabs when inside one of my colonies. When turning on Performance Mode it fixes the issue. Just wanted to mention that. Love the mod by the way.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: boggled on February 14, 2020, 02:20:42 PM
I have huge FPS drops when I change between the "Colony Info" and "Resources" tabs when inside one of my colonies. When turning on Performance Mode it fixes the issue. Just wanted to mention that. Love the mod by the way.


If you don't mind, could you post your PC specs? Thank you for your feedback and I'm glad you're enjoying my mod!
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: Algester on March 11, 2020, 08:21:31 AM
also this is the first time I'll be reporting a crashing bug I have been experiencing for some time related to using some of the skills from this mod namely gate "channel" surfing and using the actual gate

[attachment deleted by admin]
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: boggled on March 11, 2020, 03:03:28 PM
also this is the first time I'll be reporting a crashing bug I have been experiencing for some time related to using some of the skills from this mod namely gate "channel" surfing and using the actual gate

I think I know what's causing this and I'm going to issue a patch to attempt to fix it. Is there a crash every time you activate one of the abilities from this mod, or does the crash only happen intermittently? Is there any particular event or circumstance that always or usually precedes the crash? Thanks for letting me know about this and hopefully I can get it fixed for you!
Title: Re: [0.9.1a] Player Gate Construction (v1.1.0)
Post by: Algester on March 11, 2020, 07:09:59 PM
also this is the first time I'll be reporting a crashing bug I have been experiencing for some time related to using some of the skills from this mod namely gate "channel" surfing and using the actual gate

I think I know what's causing this and I'm going to issue a patch to attempt to fix it. Is there a crash every time you activate one of the abilities from this mod, or does the crash only happen intermittently? Is there any particular event or circumstance that always or usually precedes the crash? Thanks for letting me know about this and hopefully I can get it fixed for you!
it happens intermittently sometimes it works sometimes it just flat out fails either using the gate or "surfing" the channels of the gates, as for replicability I can't give other additional info other than I'm being spammed by my comms relay about stuff that needs to be hunted down and or procurement quests
Title: Re: [0.9.1a] Player Gate Construction (v1.1.1)
Post by: boggled on March 12, 2020, 04:10:04 PM
also this is the first time I'll be reporting a crashing bug I have been experiencing for some time related to using some of the skills from this mod namely gate "channel" surfing and using the actual gate

I think I know what's causing this and I'm going to issue a patch to attempt to fix it. Is there a crash every time you activate one of the abilities from this mod, or does the crash only happen intermittently? Is there any particular event or circumstance that always or usually precedes the crash? Thanks for letting me know about this and hopefully I can get it fixed for you!
it happens intermittently sometimes it works sometimes it just flat out fails either using the gate or "surfing" the channels of the gates, as for replicability I can't give other additional info other than I'm being spammed by my comms relay about stuff that needs to be hunted down and or procurement quests

I've posted an update that I hope will resolve the crashing you're experiencing. Please let me know what effect, if any, it has. If this doesn't solve the problem, I'll download all the mods on your list and attempt to reproduce it. Thank you for your continued patience!
Title: Re: [0.9.1a] Player Gate Construction (v1.1.1)
Post by: Algester on March 12, 2020, 10:31:30 PM
so far no issues yet
Title: Re: [0.9.1a] Player Gate Construction (v1.1.1)
Post by: Mondaymonkey on March 25, 2020, 12:28:10 AM
Tested a little bit.

Suggestions (non radical one):

-Astral gate should be an industry, not structure. IMO.
-Astral gate should consume large amount of some kind of resources. Heavy machinery, fuel, crew, volatiles, transplutonics... pick any.
-It is weird, you can build any structure/industry on gatekeeper station. Isn't it should be specialized? Orbital works (NF) + fuel production (ST) + light industry + all demands supplied in faction, makes station profitable even without  AI cores. Using AI cores makes it a money river, not a sinkhole it should be. Suggestion to forbid building all the industries except commerce and military base. Alternative, that industries can have some kind of penalty to production/income not to be over-profitable.
-Gatekeeper station should have a colony condition that decrease stability and population growth. It is dangerous place to live.

Bug: you can abandon gatekeeper station, but gate still active and you can use it for free. No monthly upkeep.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.1)
Post by: boggled on March 25, 2020, 07:59:19 AM
-Astral gate should be an industry, not structure. IMO.

Typically industries in Starsector produce a commodity. Even the military base produces crew. That is inconsistent with making the astral gate an industry,as it does not produce a commodity.

-Astral gate should consume large amount of some kind of resources. Heavy machinery, fuel, crew, volatiles, transplutonics... pick any.

I'm currently working on a new industry that can only be built on planets with ruins on them. It will produce "Domain-Era Artifacts" corresponding with the size of the ruins on the planet. Ultimately I'm going to have the astral gate, Kletka simulator, and all my terraforming structures demand that commodity (optionally of course in case the player doesn't want to use that industry/commodity). The astral gate will demand an enormous amount of them, forcing the player to find a vast ruins planet to colonize before they can profitably run an astral gate network.

-It is weird, you can build any structure/industry on gatekeeper station. Isn't it should be specialized? Orbital works (NF) + fuel production (ST) + light industry + all demands supplied in faction, makes station profitable even without  AI cores. Using AI cores makes it a money river, not a sinkhole it should be. Suggestion to forbid building all the industries except commerce and military base. Alternative, that industries can have some kind of penalty to production/income not to be over-profitable.

Unfortunately it's not possible for me forbid construction of vanilla structures like I can with my own modded ones. I agree that there is a balance issue with the high revenue that can be generated by the gatekeeper station, but in my upcoming patch I hope this will be counterbalanced by the need to complete a quest to unlock the astral gates and the need to have a vast ruins colony with 100%+ accessibility. This should prevent the player from generating huge revenues from the gatekeeper station until they reach the late game, in which case they will have almost unlimited money anyway.

In addition, I think many players use the "Cramped Quarters" option to effectively limit the size of station markets. The astral gate has the same upkeep regardless of market size, while profit-generating vanilla industries will be less able to counteract the astral gate upkeep if they aren't producing much due to cramped quarters keeping the gatekeeper station market population low.

Something I'm going to look at is increasing astral gate upkeep based on the amount of exports and/or market share the gatekeeper station has. That way the huge income will be "taxed" down to a more reasonable level. I do want to maintain some level of profitability for the gatekeeper station market, as access to a pseudo-gate network would be extremely valuable economically and people would rush to start businesses/industries nearby to gates.

-Gatekeeper station should have a colony condition that decrease stability and population growth. It is dangerous place to live.

This is resolved by enabling the cramped quarters option in the settings. I hope that vanilla/Nex get a similar feature, because the only reason cramped quarters isn't the default setting is because I want to maintain consistency with vanilla/Nex station behavior.

Bug: you can abandon gatekeeper station, but gate still active and you can use it for free. No monthly upkeep.

Thanks for bringing this to my attention. I'll correct this in the next patch.
Title: Re: [0.9.1a] Player Gate Construction (v1.1.1)
Post by: Mondaymonkey on March 25, 2020, 08:13:05 AM
I'm currently working on a new industry that can only be built on planets with ruins on them. It will produce "Domain-Era Artifacts" corresponding with the size of the ruins on the planet. Ultimately I'm going to have the astral gate, Kletka simulator, and all my terraforming structures demand that commodity (optionally of course in case the player doesn't want to use that industry/commodity). The astral gate will demand an enormous amount of them, forcing the player to find a vast ruins planet to colonize before they can profitably run an astral gate network.
Spoiler
(https://i.imgur.com/dzZ1d11.png)
[close]
Title: Re: [0.9.1a] Player Gate Construction (v1.1.1)
Post by: Mondaymonkey on March 30, 2020, 01:58:48 AM
The astral gate will demand an enormous amount of them, forcing the player to find a vast ruins planet to colonize before they can profitably run an astral gate network.

I just found a really great system for initial colony. Will it be enough one "extensive ruins" and one "widespread ruins" planets? If using all the Alpha core spam and administrators? Or I better look more for vast ruins?

UPD: will tech-mining industry deterioration affect "Domain-Era Artifacts" industry? I mean, shall I build tech-mining and wipe it's potential before building your industry, or I better don't?
Title: Re: [0.9.1a] Player Gate Construction (v1.1.1)
Post by: boggled on March 30, 2020, 04:56:50 AM
My plan is to have the Astral gate require 8 domain-era artifacts, and for the four ruin sizes to produce 1/2/4/8 artifacts. With an AI core admin and an AI core on the industry, extensive ruins will produce 6 artifacts, which will greatly reduce the cost of the gate, but will still be 2 short of completely removing the deficit cost.

I anticipate that my latest update will not be backwards compatible with previous versions of this mod. I'm folding this gate mod into my station mod, with the option to disable all the gate features if the player wishes. This is so the station mod features like cramped quarters and lights overlays can be supported with the gatekeeper station. If you're already using the current version of the gate mod on a particular save, there's a high probably you will encounter bugs if you try to update to the new version when I release it. Sorry!
Title: Re: [0.9.1a] Player Gate Construction (v1.1.1)
Post by: Mondaymonkey on March 30, 2020, 05:20:30 AM
OK. I have started a new game recently. Just will use a map seed to restart without a gate mod. I have no progress to loose.