Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 64 65 [66] 67 68 ... 711

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1731671 times)

Alfalfa

  • Lieutenant
  • **
  • Posts: 99
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #975 on: October 10, 2013, 09:04:20 PM »

So I somehow failed to notice the array of is[ShipClass]() boolean methods  :-X, so I switched over to those and things were working much better.  Also, I found a logical error in a loop break I had which was causing inappropriate and erratic behaviour (the most infuriating to debug).  So I think I've got everything sorted out now, thanks again for all your replies.  Obviously I need to clean up my code a bit.

...

I did not know what an Enumerator was before today, but now I hate them oh so very, very, much.  I came up with the solution in about 10 minutes, and have now spent hours attempting to use this Enumerator to perform an incredibly simple task, one I could have accomplished within 40 seconds had the classes been represented with integers.

...

This is how I felt about most java features before I started using an IDE. Java is insanely picky about usages - it completely crippled my programming for the first 10 ish hours I used it because things that I know work in several other languages would fail for no 'good' reason. Being able to do rapid experimentation in an IDE (I use netbeans) and get instant feedback as to when I make a syntax error was key to me learning the rules.

I certainly find Java to be picky to the point of being pedantic.  I am in fact using an IDE, Eclipse, though I suspect I haven't set up many soul-preserving features.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24159
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #976 on: October 10, 2013, 11:46:52 PM »

What sort of things have a heavy impact on framerate in the campaign? I'm getting 50+ FPS on average with 0-10% CPU idle, which is quite bad considering I'm running an FX 8350. It seems that viewing large fleets just annihilates my framerate. Don't ever remember that sort of thing happening before. I've only got 5 systems total--most of which have nothing happening in them at all, with the exception of the main one.

I've also got an every frame campaign script running every 2.5 seconds, but it's just a small wall of "if" statements that shouldn't put any sort of strain on the game. Removing this doesn't yield any notable increase in framerate either, so it's pretty much irrelevant.

Any thoughts on what I could do to increase framerates, short of stripping the systems of the majority of their fleets?

Just how many fleets have you got, and how large are they? Even a large fleet will still only display up to 20 of the various ships in it. One possibility is if you've got really, really high numbers of engine glows on some of the hulls - that could possibly drag things down. Might be worth making sure you're actually running the game using the main graphics card and not something integrated. Also: what kind of frame rate are you getting in vanilla, when a few large fleets (such as the SDF) are on screen, and how do those compare to the modded fleets?
Logged

TimeDiver

  • Captain
  • ****
  • Posts: 355
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #977 on: October 11, 2013, 06:00:16 AM »

Is there any method of creating a hullmod to allow/prevent character aptitude/skill/perk bonuses from being applied to a specific ship only when equipped?

Or, taken from the opposite perspective, how to modify those aforementioned entries to only apply their effects when a specific hullmod is/isn't installed?
« Last Edit: October 11, 2013, 06:07:47 AM by TimeDiver »
Logged

Psiyon

  • Admiral
  • *****
  • Posts: 772
  • Trippy
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #978 on: October 11, 2013, 09:34:40 AM »

Just how many fleets have you got, and how large are they? Even a large fleet will still only display up to 20 of the various ships in it. One possibility is if you've got really, really high numbers of engine glows on some of the hulls - that could possibly drag things down. Might be worth making sure you're actually running the game using the main graphics card and not something integrated. Also: what kind of frame rate are you getting in vanilla, when a few large fleets (such as the SDF) are on screen, and how do those compare to the modded fleets?
There are still quite a lot of fleets--probably around 50 when every spawn point is maxed out. That number used to be like 75. As for engine glows, I don't think that's the case--the vanilla game uses far more engine glows than I do. I'm running the game on a 6950, which is a mid-range graphics card. Don't have any other graphics devices, so there can't be any mix-up there. Regarding the framerates in vanilla, it stays at a stable 60 FPS with minimal stuttering. The CPU idle will sometimes dip pretty low (if I'm around a lot of fleets, or large fleets), but usually it hovers around 20-40%. However, when I'm viewing a large / many fleets in Obsidian Void, the framerate starts to suffer.
Logged

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #979 on: October 11, 2013, 10:32:02 AM »

Quote
Can't, that's hardcoded in the MIRV AI. You could write a custom missile AI to get around the issue.
how? is there something i can base it on?
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24159
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #980 on: October 11, 2013, 12:02:19 PM »

@TimeDiver: Hmm. Nothing immediately comes to mind, though you could probably do *something* creative to get around that.

Or, taken from the opposite perspective, how to modify those aforementioned entries to only apply their effects when a specific hullmod is/isn't installed?

That's probably the more promising approach, but, again, not entirely sure you could get it to work cleanly.


@Psiyon: Hmm. I suppose it's possible that's just running up against some bottleneck on your graphics card. Do you happen to have lots of ring systems? (Like in Askonia) What about the resolution of the background?


Quote
Can't, that's hardcoded in the MIRV AI. You could write a custom missile AI to get around the issue.
how? is there something i can base it on?

Take a look at ModPlugin.pickMissileAI() and MissileAPI.giveCommand().
http://fractalsoftworks.com/starfarer.api/index.html?com/fs/starfarer/api/ModPlugin.html

This trivial missile AI makes all missiles launched from the 3-shot harpoon rack accelerate and constantly turn right:
Code: java
public PluginPick<MissileAIPlugin> pickMissileAI(final MissileAPI missile, final ShipAPI launchingShip) {
if (missile.getWeapon() != null && missile.getWeapon().getId().equals("harpoon")) {
return new PluginPick<MissileAIPlugin>(new MissileAIPlugin() {
public void advance(float amount) {
missile.giveCommand(ShipCommand.TURN_RIGHT);
missile.giveCommand(ShipCommand.ACCELERATE);
}
}, PickPriority.MOD_GENERAL);
}
return null;
}

(Edit: man, I love the syntax highlighting plugin. So nice. Thanks, Trylobot!)
Logged

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #981 on: October 11, 2013, 01:00:54 PM »

thanks, :D

Spoiler
you do know you just game an insane person candy!!!

the BISO will now have even weirder weapons, weapons so illogical they will simply shatter the minds of the enemy crew by their mere presence!

and yes I will use the BISO as my playground and lore friendly excuse to make weapons that are totaly non-vanila, infact they will be so non-vanilla they will be chocolate! chocolate coated strobery flavoured serbet!
we put crazy people in padded cells
[close]
Quote
http://fractalsoftworks.com/starfarer.api/index.html?com/fs/starfarer/api/ModPlugin.html
oooo shiny!!!!
stickypost a link to this in the moding and modding resources forum, this is super shiny and usefull to nabs like me who want to become less nab
« Last Edit: October 11, 2013, 03:04:08 PM by dmaiski »
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #982 on: October 11, 2013, 03:07:07 PM »

This trivial missile AI makes all missiles launched from the 3-shot harpoon rack accelerate and constantly turn right:
Code: java
public PluginPick<MissileAIPlugin> pickMissileAI(final MissileAPI missile, final ShipAPI launchingShip) {
if (missile.getWeapon() != null && missile.getWeapon().getId().equals("harpoon")) {
return new PluginPick<MissileAIPlugin>(new MissileAIPlugin() {
public void advance(float amount) {
missile.giveCommand(ShipCommand.TURN_RIGHT);
missile.giveCommand(ShipCommand.ACCELERATE);
}
}, PickPriority.MOD_GENERAL);
}
return null;
}

humm where do i put this? i tried placing it inside ModPlugin like so
Spoiler
Code: java
package data.scripts;

import com.fs.starfarer.api.BaseModPlugin;
import com.fs.starfarer.api.Global;

import data.scripts.world.BISOGen;


public class BISOModPlugin extends BaseModPlugin
{
    private static void initBISO()
    {
new BISOGen().generate(Global.getSector());
    }

public PluginPick<MissileAIPlugin> pickMissileAI(final MissileAPI missile, final ShipAPI launchingShip) {  
       if (missile.getWeapon() != null && missile.getWeapon().getId().equals("harpoon")) {  
          return new PluginPick<MissileAIPlugin>(new MissileAIPlugin() {  
             public void advance(float amount) {  
                missile.giveCommand(ShipCommand.TURN_RIGHT);  
                missile.giveCommand(ShipCommand.ACCELERATE);  
             }  
          }, PickPriority.MOD_GENERAL);  
       }  
       return null;  
    }  

    @Override
    public void onNewGame()
    {
        initBISO();
    }

// the following code doesn't work right now, but it will in 0.6.1a!
// its stuff that will let you add it to existing saved games, rather than just new games

    // @Override
    // public void onEnabled(boolean wasEnabledBefore)
    // {
        // if (!wasEnabledBefore)
        // {
           // // Calling a separate method avoids duplicate code with onNewGame()
           // initBISO();
        // }
    // }
}
[close]
but it dosent like that, sorry i know I am a noob, but I am learning slowly
« Last Edit: October 11, 2013, 03:09:14 PM by dmaiski »
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24159
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #983 on: October 11, 2013, 05:41:58 PM »

@dmaiski: That should work. Are you perhaps expecting it to work on Harpoon Pods or the single-shot Harpoon launchers? That'll only work for 3-shot Harpoon racks, the ones with the weapon id "harpoon".

Aha - I'm not sure Janino actually supports anonymous classes, that might be it. You may need to extract the missile AI implementation into its own class.
Logged

Psiyon

  • Admiral
  • *****
  • Posts: 772
  • Trippy
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #984 on: October 11, 2013, 06:27:10 PM »

@Psiyon: Hmm. I suppose it's possible that's just running up against some bottleneck on your graphics card. Do you happen to have lots of ring systems? (Like in Askonia) What about the resolution of the background?
Nope, I've got one system that uses rings, and it's only like 3 or 4 bands. The only other use of rings is around jump points, but they have a very small radius. The background images are 2048x2048 JPG.
Logged

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #985 on: October 12, 2013, 05:15:44 AM »

Code: json
	"burstjetfire":{
"sounds":[
{"file":"sounds/BR/fx/systems/burstjetfire.ogg","pitch":0.91,"volume":0.75},    # index:  1
{"file":"sounds/BR/fx/systems/burstjetfire.ogg","pitch":0.9,"volume":0.75}, # index:  2
{"file":"sounds/BR/fx/systems/burstjetfire.ogg","pitch":0.92,"volume":0.74},    # index:  3
],

"BLACKROCKHULL":{"sounds":[1,2,3], "pitch":1, "volume":1},
"FIGHTER":{"sounds":[1,2,3], "pitch":1.2, "volume":0.85},
"FRIGATE":{"sounds":[1,2,3], "pitch":1.14, "volume":0.96},
"DESTROYER":{"sounds":[1,2,3], "pitch":1.0, "volume":0.98},
"CRUISER":{"sounds":[1,2,3], "pitch":0.96, "volume":1.00},
"CAPITAL_SHIP":{"sounds":[1,2,3], "pitch":0.90, "volume":1.00},
},

This returns a Fatal: Index 3, Size 3 out of bounds error on game start. Is engine sounds and shield sounds the only thing you can use this type of sound entry for, or am I doing something wrong? It's for a ship system.
Logged

dmaiski

  • Captain
  • ****
  • Posts: 422
  • resistance is futile
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #986 on: October 12, 2013, 05:57:59 AM »

I must admit I am not entirely sure how to do this

i tried
Spoiler
Code: java
package data.scripts;

import com.fs.starfarer.api.BaseModPlugin;
import com.fs.starfarer.api.Global;

import data.scripts.world.BISOGen;

public class BISOModPlugin extends BaseModPlugin
{
    private static void initBISO()
    {
        // Create an instance of every generator here and call its generate() method
new BISOGen().generate(Global.getSector());
new MissileAI()
    }



    @Override
    public void onNewGame()
    {
        // Calling a separate method avoids duplicate code with onEnabled()
        initBISO();
    }

// the following code doesn't work right now, but it will in 0.6.1a!
// its stuff that will let you add it to existing saved games, rather than just new games

    // @Override
    // public void onEnabled(boolean wasEnabledBefore)
    // {
        // if (!wasEnabledBefore)
        // {
           // // Calling a separate method avoids duplicate code with onNewGame()
           // initBISO();
        // }
    // }
}

public class BISOpickMissileAI extends pickMissileAI
{
public PluginPick<MissileAIPlugin> pickMissileAI(final MissileAPI missile, final ShipAPI launchingShip) { 
       if (missile.getWeapon() != null && missile.getWeapon().getId().equals("harpoon")) { 
          return new PluginPick<MissileAIPlugin>(new MissileAIPlugin() { 
             public void advance(float amount) { 
                missile.giveCommand(ShipCommand.TURN_RIGHT); 
                missile.giveCommand(ShipCommand.ACCELERATE); 
             } 
          }, PickPriority.MOD_GENERAL); 
       } 
       return null; 
}
}
[close]
and a few other things like extends BaseModPlugin ect.
but it is still throwing errors

help me please :'(
Logged
BISO
(WIP) lots of shiny new weapons ( :-[ i have more weapons then sprites :-[ )

i got a cat pad
its like a mouse pad but better!

Psiyon

  • Admiral
  • *****
  • Posts: 772
  • Trippy
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #987 on: October 12, 2013, 09:32:32 AM »

Code: json
	"burstjetfire":{
"sounds":[
{"file":"sounds/BR/fx/systems/burstjetfire.ogg","pitch":0.91,"volume":0.75},    # index:  1
{"file":"sounds/BR/fx/systems/burstjetfire.ogg","pitch":0.9,"volume":0.75}, # index:  2
{"file":"sounds/BR/fx/systems/burstjetfire.ogg","pitch":0.92,"volume":0.74},    # index:  3
],

"BLACKROCKHULL":{"sounds":[1,2,3], "pitch":1, "volume":1},
"FIGHTER":{"sounds":[1,2,3], "pitch":1.2, "volume":0.85},
"FRIGATE":{"sounds":[1,2,3], "pitch":1.14, "volume":0.96},
"DESTROYER":{"sounds":[1,2,3], "pitch":1.0, "volume":0.98},
"CRUISER":{"sounds":[1,2,3], "pitch":0.96, "volume":1.00},
"CAPITAL_SHIP":{"sounds":[1,2,3], "pitch":0.90, "volume":1.00},
},

This returns a Fatal: Index 3, Size 3 out of bounds error on game start. Is engine sounds and shield sounds the only thing you can use this type of sound entry for, or am I doing something wrong? It's for a ship system.
Pretty sure indexes for sounds start at 0, not 1. So you'd have to change all those indexes to [0,1,2].
Logged

Cycerin

  • Admiral
  • *****
  • Posts: 1665
  • beyond the infinite void
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #988 on: October 12, 2013, 10:33:01 AM »

Groan, how dense of me. Oh well, it doesn't crash the game now, but there seems to be zero different in pitch between hull sizes. Hmmmm.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24159
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #989 on: October 12, 2013, 10:48:12 AM »

@Psiyon: I suppose it's just having trouble handling that many fleets, then. From what you're saying, doesn't sound like there's a sudden performance drop, it seems to follow more fleets -> lower performance.

@dmaiski: I'd suggest a separate thread for this. Also, I'd suggest reading up on Java a bit :) Also, general note: saying that something is causing errors without specifying what the errors are isn't very useful.

@Cycerin: That scheme only works for the sounds that are set up like that in the vanilla sounds.json. I'd suggest setting up multiple copies of the system if you want to get different sounds.
Logged
Pages: 1 ... 64 65 [66] 67 68 ... 711