Jump to content

Welcome to the Forum!

The best place to exchange builds and ideas! Vote for the best ideas and suggestions here.

Join the Avorion Discord!

Connect with other passionate players and talk about the latest news.
Discord

DLC Avorion Into the Rift Out Now!

Now available on Steam!
Steam

[Help] Limit all ships speed?


alfuken
 Share

Recommended Posts

Basically, what the subject says.

 

Is there a way to enforce the upper limit of all, both player built and NPC ships in game? Most of the balance problems in this game come from the fact that all of the ships are just flying faster that most ammunition in the game. A ship, which easily outruns fighters, torpedoes, missiles, cannon shots and even machineguns is total and utter bull-poo. So. is there a way to limit that somehow via mods?

Link to comment
Share on other sites

Dev introduced speed limitations based on difficulty and a few new modifiable entity commands but I do not know enough about LUA scripting to make use of them.

 

I also thought about turret mods which we could include a negative too speed and manueverabilty, and increase to boost cost but that doesn't do any good to control / regulate the NPCs speeds.

 

 

Link to comment
Share on other sites

Found the variables, well mention there of from patch notes:

 

Made Thrusters component available in scripts: Get / set turning speeds of entities

 

Made DirectFlightPhysics component available in scripts

vec2, vec3 and vec4 can now be constructed with a single value: vec3(1) == vec3(1, 1, 1)

 

Several improvements to passing/reading tables to/from engine

 

I don't mind learning as I have a few thousands hours probably in modding games, but LUA variables and understanding it just hasn't really clicked with me yet. Even looking at the example.mods when they came out, it was all just numbers and I had no idea what each did.  I have heard Lua is easy once one understands it, I just need to find the time to reach that point.

Link to comment
Share on other sites

Dev introduced speed limitations based on difficulty

Hm... wasn't able to find it anywhere...

Anyway, DirectFlightPhysics seems to be the thing, but I can't find a way to hook it up to ship creation event. :/ Theoretically, it looks like this: Before any ship is added to a game, get the DirectFlightPhysics component, alter maxVelocity, and put it back, but I have found no way to catch the ship creation event, and no way to check if Entity is a ship... :/

Link to comment
Share on other sites

OK, seems like it's not possible at the current level of API implementation.

 

Best option would be to just disable the boost ability for all ships, but you can't get the Engine component of an existing ship, because Entity API only allows to check if Component is present in Entity, but doesn't allow adding it, which is utter BS. You also can't add DirectFlightPhysics component for the same reason, and the only accessible property of "velocity" is dynamic, so it would require checking current ship velocity every game tick and adjusting it which is a horrible idea.

 

This topic may be closed. :(

Link to comment
Share on other sites

TESL4

 

This has been discussed with people making recommendations and providing feedback ad nauseum, but devs simply do not respond to any conversation around this.

 

I completely understand devs cannot respond to every post,  but any response relating to the subject simply does not exist. At least not on the forums that I have seen recently.  I have seen questions answered by devs before and after posts asking this question, myself included, but not answering the question once - "appearing" to outright ignore it. Not saying they are, it just appears so - I like to give people benefit of the doubt.

 

Sue responded to one post stating they slowed some ships down on lower difficulty but this has been it, and it was a post a user made out of frustration, and I have not seen any responses since then. Beyond the original fix that was used to exploit movement based on surface area, and then allowing the AI to use boost to chase players kiting with ships (which introduced other issues but I feel was a step in the right direction) this really has been it.

 

If we could get at least some communication on what the intent is, we could provide much more constructive feedback around movement.

 

Honestly if the devs would just make it so some NPC ships boost under a certain size, and others cannot, while not perfect, would at least alleviate a bit of this I feel.

 

I have even provided feedback on different options so everyone can have their own preferred play style l. I understand the devs are in a bit of a pickle on this one because you risk making a chunk of the playerbase  unhappy no matter the change. There is also the question of "Is this what the devs want?" If this is simply how they want it, then so be it, I won't bother with lumbering ships anymore (EDIT actually yes I would..lol), but we cannot get an answer from them on this.

 

It could very well be they have not quite figured out exactly how they want it, and that's ok too, but since movement has such an effect on balance for everything it effects a lot of.our feedback. Maybe they have responded to this and fools like myself simply have missed it (shrug), but usually the veterans on the forum will tell you "Hey, that's the intention or going to be addressed etc."

 

I would love to have a conversation with them around these things, the devs have done a lot of amazing things for the game, I feel movement and balance around is their last main combat gameplay hurdle.

 

(Further edit) this is why I am hoping we can mod this part of the game.

Link to comment
Share on other sites

I'm just making sure the issue gets proper exposure :D

 

A recorded Q&A with the devs involving the state on the game and questions players are asking once they launch would do great for their publicity I think.  We would be able to get some good answers hopefully and it would promote a good dev/player relationship I think. 

 

Even if they did a weekly/daily multiple choice answer poll on issues brought up that would be a great way to get actual good data on what the playerbase thinks.  The poll could be shown in the home screen game menu and players could answer it and add a comment if they wanted to further explain.

Link to comment
Share on other sites

I think I've actually found a way... kind of.

With the help of

addMultiplier(StatsBonuses.Velocity, 0.0)

you can set ship speed to zero, and then with

addAbsoluteBias(StatsBonuses.Velocity, 5.0)

you can set desired ship max speed in decametres (for some reason providing 5 there increased speed by 50m/s, and 123 - by 1230m/s.

Now the difficult part is to find out what was ship's max speed before the change, so we don't give it more speed than it had before...

Link to comment
Share on other sites

Hi Alfuken,

 

Awesome discovery!

 

At the very least, can we apply this somehow based on AI generated class or size of ship? (I really need to spend more time on figuring out how to mod this game/how lua in it works.) 

 

For example, smaller picket ships having high max speed is ok, then make it so bigger ships are forcefully slowed down?

 

 

Link to comment
Share on other sites

OK, here's what I've came up with so far:

 

File name: data/scripts/entity/init.lua

Code:

function traffic_police(entity)
    -- for some weird reason (bug?), maxVelocity is smaller that actual value,
    -- so it needs to be multiplied by 2.5; probably programmed by some murican...
    local initial_top_speed = Engine(entity).maxVelocity*2,5

    local tier = ShipSystem(entity).numSlots

    -- we start off at 600m/s max, and loose 20m/s for each system slot of the ship
    -- that means 500m/s max with 5 slots, 400m/s with 10 slots, 300m/s with 15 slots
    local max_speed = 60 - tier*2
    -- yes, speed also have to be set divided by ten, another bug?

    -- new speed shouldn't be higher than the one provided by engines
    local new_speed = math.min(initial_top_speed, max_speed)

    -- reset to zero
    entity.addMultiplier(entity, StatsBonuses.Velocity, 0.0)
    entity.addAbsoluteBias(entity, StatsBonuses.Velocity, new_speed)
    -- as you might have noticed, these two methods demand entity as first argument - contrary to what the Documentation says. 3 bugs in 1 piece of code, how bout that!?

    print(entity.name .. " - " .. Engine(entity).maxVelocity * 2.5)
end

if onServer() then
    local entity = Entity()
    if entity.isShip
        traffic_police(entity)
    end
end

 

This code is only applied when Entity is initialized, it's dirty and needs to be updated to re-apply after ship plan change, system install/remove, etc, but as a proof of concept it works.

Link to comment
Share on other sites

I'm curious then if it is possible to put a negative multiplier for mods?

 

So all the turret mods would have some sort.of negative to boost, manueverabilty, Accel?

 

Alfulen this is some amazing work, trying to wrap my head around this here:

this looks like we can apply based on slot size.

 

Going to shoot at trying to understand what is here

 

Essentially you have a function (considered an entity) called traffic police... The last part, if the entity.isShip then it's applying traffic police to any entity that is a ship.

 

Does this apply to NPCs too? I guess I never realized they also had slots and modules inside them.

Link to comment
Share on other sites

It seems like there is no limitation on the sign of the multiplier, but if you want to, for example, reduce some attribute by half, you'll have to use multiplier 0.5, so, basically, resulting value is existing value multiplied by what you'll pass as an argument to the function

addMultiplier

. Since here I'm passing 0.0, so any value multiplied by zero is zero.

 

Yes, that applies to any entity that returns

true

for the function

isShip

, including NPC. Actually, I don't know if they do have slots, that's something that needs to be checked. But since slot count depends on processing power, calculator can be changed to use processing power instead. Or volume. Or weight. Or whatever.

 

Keep in mind that this piece of code is only applied when entity is initialised/loaded in game. I don't know what will happen if you try to change your ship plan, or attach an engine booster system, etc. — this needs to be accounted for and programmed accordingly.

 

This script is just a proof of concept, an example of how speed limitation can be effectively achieved.

 

Link to comment
Share on other sites

Yeah, you can do that, of course. But system slots provide already existing scale, while for mass you'll have to come up with some arbitrary scale... although limiting velocity based on mass surely makes more sense.

Link to comment
Share on other sites

Honestly the slots fall under good enough, since in a way they themselves are tied to mass, albeit in a odd way via processing power. However this depends on whether NPCs have modules/slots.

 

Would be great to get answer from devs on this. Will try reaching out to one a bit later.

 

The benefit of the computer cores isn't large enough to worry about once ships get to the 13/14 slot stage. 

 

Really at 7 slot the benefits of computer core aren't enough.

 

However due to quadratic scaling, you could probably state that your mass really slows you down at slot 7 or higher. Or maybe move it up or down based on materials on ship, but that is probably more difficult and calling distance from Galaxy edge to help dictate in an artificial way where scaling would happen may work better.

 

However for now targeting the ability to scale on size/slots alone is first priority.

 

Alfulen you have done a lot here so thank you.

 

If/when get some time, will try figuring out how to make this into the beginning stages of a mod. I think it is something a lot of people would appreciate having.

Link to comment
Share on other sites

Honestly the slots fall under good enough, since in a way they themselves are tied to mass, albeit in a odd way via processing power.

Again, though, processing power can be artificially inflated with computer cores. I do this myself on ship designs that are only a  “little” off from the next slot up. I’d hate for my ship to have speed and maneuverability nerfs to it simply cause I put in computer cores to make the next slot.

Link to comment
Share on other sites

 

Code:

    entity.addMultiplier(entity, StatsBonuses.Velocity, 0.0)
    entity.addAbsoluteBias(entity, StatsBonuses.Velocity, new_speed)
    -- as you might have noticed, these two methods demand entity as first argument - contrary to what the Documentation says. 3 bugs in 1 piece of code, how bout that!?

 

This isn't actually a bug.  You're not using lua's "object method" syntax so you had to manually add the normally hidden first parameter.  If you'd used a ":" instead of a "." between the object and the method name, you won't have had to add the extra entity parameter.

 

e.g.

 

entity:addMultiplier(StatsBonuses.Velocity, 0.0)

 

produces the same result as:

 

entity.addMultiplier(entity, StatsBonuses.Velocity, 0.0)

 

Also, the speed being off by 10 seems to be part of how the game implemented distance.  You'll find the same off by 10 factor when measuring distance between entities.

Link to comment
Share on other sites

  • 1 year later...
On 3/4/2020 at 2:34 PM, alfuken said:

OK, here's what I've came up with so far:

 

File name: data/scripts/entity/init.lua

Code:

 


function traffic_police(entity)
    -- for some weird reason (bug?), maxVelocity is smaller that actual value,
    -- so it needs to be multiplied by 2.5; probably programmed by some murican...
    local initial_top_speed = Engine(entity).maxVelocity*2,5

    local tier = ShipSystem(entity).numSlots

    -- we start off at 600m/s max, and loose 20m/s for each system slot of the ship
    -- that means 500m/s max with 5 slots, 400m/s with 10 slots, 300m/s with 15 slots
    local max_speed = 60 - tier*2
    -- yes, speed also have to be set divided by ten, another bug?

    -- new speed shouldn't be higher than the one provided by engines
    local new_speed = math.min(initial_top_speed, max_speed)

    -- reset to zero
    entity.addMultiplier(entity, StatsBonuses.Velocity, 0.0)
    entity.addAbsoluteBias(entity, StatsBonuses.Velocity, new_speed)
    -- as you might have noticed, these two methods demand entity as first argument - contrary to what the Documentation says. 3 bugs in 1 piece of code, how bout that!?

    print(entity.name .. " - " .. Engine(entity).maxVelocity * 2.5)
end

if onServer() then
    local entity = Entity()
    if entity.isShip
        traffic_police(entity)
    end
end
 

 

 

This code is only applied when Entity is initialized, it's dirty and needs to be updated to re-apply after ship plan change, system install/remove, etc, but as a proof of concept it works.

I used this and it works like a charm but id also like to adapt this to rotation speeds, for say pitch and yaw.  Do you mind helping me with that?

 

Link to comment
Share on other sites

having no idea what im doing really I just try this and it didnt work, I think if I knew what the pitch, yaw, and roll values were labeled I could maybe try a better attempt.


 

function traffic_police(entity)
    -- for some weird reason (bug?), maxVelocity is smaller that actual value,
    -- so it needs to be multiplied by 2.5; probably programmed by some murican...
    local initial_top_speed = Engine(entity).maxVelocity*2,5

    local tier = ShipSystem(entity).numSlots

    -- we start off at 600m/s max, and loose 20m/s for each system slot of the ship
    -- that means 500m/s max with 5 slots, 400m/s with 10 slots, 300m/s with 15 slots
    local max_speed = 60 - tier*2
    local new_turningSpeed = 2.1 - tier*2
    -- yes, speed also have to be set divided by ten, another bug?

    -- new speed shouldn't be higher than the one provided by engines
    local new_speed = math.min(initial_top_speed, max_speed)

    -- reset to zero
    entity.addMultiplier(entity, StatsBonuses.Velocity, 0.0)
    entity.addAbsoluteBias(entity, StatsBonuses.Velocity, new_speed)
    entity.addMultiplier(entity, StatsBonuses.turningSpeed, 0.0)
    entity.addAbsoluteBias(entity, StatsBonuses.turningSpeed, new_turningSpeed)
    -- as you might have noticed, these two methods demand entity as first argument - contrary to what the Documentation says. 3 bugs in 1 piece of code, how bout that!?

    print(entity.name .. " - " .. Engine(entity).maxVelocity * 2.5)
end

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...