My first impressions, suggestions and a few questions....

13

Comments

  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 1,737 admin
    125. Bug: Colorpicker:
    • H behaves strangely. Typing 250 results in 249. Pushing the slider to 360 results in 300. Typing 500 gives 319.
    • Setting S to 0 or nothing resets H to 0, which makes it hard type in the fields directly. Same for V, which resets S and H
    • circle should adjust colors to current V value or have an extra colored selector for V like this(src)
    • Alpha is missing (?)
    • Support for Hex-codes
    Thanks. I made a card for these and will get to it soon.

    126. Bug: Calling World_SendMessage[ToAll]() in an Automator (before the round is started) crashes the game.
    I've fixed the crash, however the Automators cannot send messages. What are you trying to use this for?

    127. Feature Request: CollisionFilterTriggerPreset that triggers on everything but not Self. I want to add a triggerbox to a moving physics object (the box overlaps the collision model), but it is triggered by its own collision component on spawn. I need a filter presets that ensures that message.triggerId is not the same as message.otherId. Currently its only solvable by setting the collision type to hitbox, which I do not want.
    This sounds like maybe this should just be the behavior regardless of the preset. I'll chat with the rest of the team about it.

    128. Bug: Grid increase/decrease does not work with every keyboard layout (i.e. german)
    What exactly is the problem? Is it the default keys don't work, but remapping them does, or does it not work even remapped?

    129. Q: I am not supposed to add 2 directional lights, right? Only one of them casts a shadow, and which one depends on the current viewing angles.
    This is limitation of the current implementation. I'll make it so that more than 1 directional light is supported in the (near) future.

    130. Remark: Model editor does not open for standard models. Not sure if it should. Works fine for self made ones.
    This is the intended behavior since you don't have the "source" files for the other models (i.e. the fbx files). In the future I'm going to make it so they open in a "read only" mode like a model viewer.

    131. Bug: Start editor, add package, close package edit view -> crash
    Fixed.

    Max McGuire
    Technical Director, Unknown Worlds Entertainment
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    edited February 2015
    Max wrote: »
    126. Bug: Calling World_SendMessage[ToAll]() in an Automator (before the round is started) crashes the game.
    I've fixed the crash, however the Automators cannot send messages. What are you trying to use this for?
    As mentioned here, I wanted to have an automator and a script which do roughly the same thing. So to reduce code duplication my firstsecond impulse was to let the automator call the script. This was when I noticed the crash; have duplicated the code now.
    Edit: my first impulse was to add the OnSetText() event handler to the automator.
    Max wrote: »
    128. Bug: Grid increase/decrease does not work with every keyboard layout (i.e. german)
    What exactly is the problem? Is it the default keys don't work, but remapping them does, or does it not work even remapped?
    Ha, did not even see they can be remapped. Remapping works, but with the default mapping (LeftBracket/RightBracket) on a german keyboard layout, no key or key combination triggers the increase or decrease of the grid size. In particular not even pressing [ or ], which on a german keyboard are mapped to AltGr+8 and 9. Switching to US layout (where [ and ] are to the right of the P) in windows works.
    Maybe related: with a german keyboard layout enabled, everything under Options->Bindings still registers the US keys. I.e. hitting + or #, which have their own keys, registers as = and 3. Keys that don't have an equivalent like ü,ö,ä,ß don't register at all. NS2 had this right.
    Max wrote: »
    129. Q: I am not supposed to add 2 directional lights, right? Only one of them casts a shadow, and which one depends on the current viewing angles.
    This is limitation of the current implementation. I'll make it so that more than 1 directional light is supported in the (near) future.
    Don't actually need it and it's probably rare that it makes sense (i.e. 2 suns), just noticed the slight glitches.

    At last, I want to bring attention to #117
    Brute wrote: »
    117. Feature Request: A method that returns the position of the center of mass
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 1,737 admin
    Brute wrote: »
    As mentioned here, I wanted to have an automator and a script which do roughly the same thing. So to reduce code duplication my firstsecond impulse was to let the automator call the script. This was when I noticed the crash; have duplicated the code now.
    Edit: my first impulse was to add the OnSetText() event handler to the automator.
    Great, so the current build so address this problem without the need to duplicate the code.
    Brute wrote: »
    Ha, did not even see they can be remapped. Remapping works, but with the default mapping (LeftBracket/RightBracket) on a german keyboard layout, no key or key combination triggers the increase or decrease of the grid size. In particular not even pressing [ or ], which on a german keyboard are mapped to AltGr+8 and 9. Switching to US layout (where [ and ] are to the right of the P) in windows works.
    Maybe related: with a german keyboard layout enabled, everything under Options->Bindings still registers the US keys. I.e. hitting + or #, which have their own keys, registers as = and 3. Keys that don't have an equivalent like ü,ö,ä,ß don't register at all. NS2 had this right.
    It looks like some changes were made in NS2 after I forked the codebase for Future Perfect. I've integrated these now and made a new build in the "beta" branch. When you get a chance, could you check it out and see if it's working the way you'd expect?
    Brute wrote: »
    117. Feature Request: A method that returns the position of the center of mass
    We could add that, although it would have to do some computations for something like rag doll where there might be multiple bodies. What are you going to use it for?
    Max McGuire
    Technical Director, Unknown Worlds Entertainment
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    edited February 2015
    Max wrote: »

    As mentioned here, I wanted to have an automator and a script which do roughly the same thing. So to reduce code duplication my firstsecond impulse was to let the automator call the script. This was when I noticed the crash; have duplicated the code now.
    Edit: my first impulse was to add the OnSetText() event handler to the automator.

    Great, so the current build so address this problem without the need to duplicate the code.
    Could you elaborate on this? What exactly did you change? Can the automator handle OnSth() events now? Or is it now able to send messages? Only after the game started?
    Max wrote: »

    Ha, did not even see they can be remapped. Remapping works, but with the default mapping (LeftBracket/RightBracket) on a german keyboard layout, no key or key combination triggers the increase or decrease of the grid size. In particular not even pressing [ or ], which on a german keyboard are mapped to AltGr+8 and 9. Switching to US layout (where [ and ] are to the right of the P) in windows works.
    Maybe related: with a german keyboard layout enabled, everything under Options->Bindings still registers the US keys. I.e. hitting + or #, which have their own keys, registers as = and 3. Keys that don't have an equivalent like ü,ö,ä,ß don't register at all. NS2 had this right.

    It looks like some changes were made in NS2 after I forked the codebase for Future Perfect. I've integrated these now and made a new build in the "beta" branch. When you get a chance, could you check it out and see if it's working the way you'd expect?
    Reassigning key works now, similar to NS2 (that is keys like "ü" show up as "#41" but work as expected). Still "LeftBracket" and "RightBracket" cannot be triggered with the german layout.
    Max wrote: »

    117. Feature Request: A method that returns the position of the center of mass

    We could add that, although it would have to do some computations for something like rag doll where there might be multiple bodies. What are you going to use it for?
    I have only one solid object and do not care about ragdolls. I need to know the location of the center of mass, so I know where to add pairs of local forces that have point symmetry. Here, I made a video. Note that the 4 hoverpads are not symmetric around the center of mass, which causes extensive swinging.
    Post edited by Brute on
    InsaneHowserSoul_Rider
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 1,737 admin
    Brute wrote: »
    Could you elaborate on this? What exactly did you change? Can the automator handle OnSth() events now? Or is it now able to send messages? Only after the game started?
    I changed it so that calling the function won't crash the game, however the message won't go anywhere. Sending messages between automators is something that we could add, but I haven't seen a use for it yet.
    Brute wrote: »
    I have only one solid object and do not care about ragdolls. I need to know the location of the center of mass, so I know where to add pairs of local forces that have point symmetry. Here, I made a video. Note that the 4 hoverpads are not symmetric around the center of mass, which causes extensive swinging.
    Ok, that looks cool. I added the function (Collision_GetLocalCenterOfMass). It's available in the beta branch right now.
    Max McGuire
    Technical Director, Unknown Worlds Entertainment
  • InsaneInsane Anomaly Join Date: 2002-05-13 Member: 605Members, Super Administrators, Forum Admins, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, NS2 Map Tester, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 3,912 admin
    Love those hovercraft.
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue Posts: 4,269 Advanced user
    .
    Brute wrote: »
    I have only one solid object and do not care about ragdolls. I need to know the location of the center of mass, so I know where to add pairs of local forces that have point symmetry. Here, I made a video. Note that the 4 hoverpads are not symmetric around the center of mass, which causes extensive swinging.

    OK so now I want to see a Wipeout mod in FP.... :P
    Games:Subnautica Fan Game Mods: GorgeCraft & CTF & Proving Grounds Website: andysoulrider.uk
    Twitter: @AndySoulRider Twitch: Twitch.tv/SoulRider YouTube: Youtube.com/user/IamSoulRider/videos

    Capitalisation is the difference between helping your Uncle Jack off a horse and helping your uncle jack off a horse.
    Knowledge is gained through listening, Understanding is gained through discussion.
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    Max wrote: »
    I added the function (Collision_GetLocalCenterOfMass). It's available in the beta branch right now.
    Thanks. Works perfectly now.

    132. Remark: Nvidia Shadowplay screen recording autodetects the game title as "Tian Long Ba Bu". No idea why or how, but maybe that String looks familiar to someone.

    133. Bug: Checkboxes and String fields for automators don't work anymore (are constantly overwritten with previous value)

    134. Remark: messages.html: missing OnCreate, OnDestroy
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 246 admin
    132. Interesting! No idea!

    133. I noticed this myself yesterday. It has been added to our bug list. Thanks!

    134. Done!
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue Posts: 4,269 Advanced user
    edited February 2015
    132. Sounds like the norks are in your networks :P haha
    Games:Subnautica Fan Game Mods: GorgeCraft & CTF & Proving Grounds Website: andysoulrider.uk
    Twitter: @AndySoulRider Twitch: Twitch.tv/SoulRider YouTube: Youtube.com/user/IamSoulRider/videos

    Capitalisation is the difference between helping your Uncle Jack off a horse and helping your uncle jack off a horse.
    Knowledge is gained through listening, Understanding is gained through discussion.
  • HowserHowser Advanced user UK Join Date: 2010-02-08 Member: 70488Members, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer Posts: 654 Advanced user
    the builder (drag and dropping into the game window) doesn't like the file extensions for FBX files in capitals. since this varies in versions of 3ds max i assume it will also vary between other modeling programs too. Was a scratching my head over this one for a good ten minutes.
    Might also be worth noting that currently .fbx files on my system do not currently have a default program.
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 1,737 admin
    Howser wrote: »
    the builder (drag and dropping into the game window) doesn't like the file extensions for FBX files in capitals. since this varies in versions of 3ds max i assume it will also vary between other modeling programs too. Was a scratching my head over this one for a good ten minutes.
    Might also be worth noting that currently .fbx files on my system do not currently have a default program.
    This was change we made because the different captializations caused of lot of additional complexity since the engine itself is case sensitive to make other platforms work consistently. We might go back to supporting this in the future for the sake of user friendliness, but at the moment it was causing too many headaches.

    Max McGuire
    Technical Director, Unknown Worlds Entertainment
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    edited March 2015
    Regarding 132: Tian Long Ba Bu (天龙八部) is a game listed in the Games Supported by GeForce Experience list. So their detection algorithm just gets it wrong.

    135. Bug:: Automators are broken.
    • start editor
    • start game (F5)
    • stop game (shift+F5)
    • change size of floor entity -> no effect
    Edit: fixed by yesterday's update
    Post edited by Brute on
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 1,737 admin
    Brute wrote: »
    Regarding 132: Tian Long Ba Bu (天龙八部) is a game listed in the Games Supported by GeForce Experience list. So their detection algorithm just gets it wrong.

    135. Bug:: Automators are broken.
    • start editor
    • start game (F5)
    • stop game (shift+F5)
    • change size of floor entity -> no effect
    Edit: fixed by yesterday's update
    This was actually still broken (the problem was intermittent), but we just released another update which does indeed fix it.
    Max McGuire
    Technical Director, Unknown Worlds Entertainment
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue Posts: 4,269 Advanced user
    Feature Request: Midi Playback support

    I know it's a long shot and probably a low priority if it were to be done, but if you don't ask..
    Games:Subnautica Fan Game Mods: GorgeCraft & CTF & Proving Grounds Website: andysoulrider.uk
    Twitter: @AndySoulRider Twitch: Twitch.tv/SoulRider YouTube: Youtube.com/user/IamSoulRider/videos

    Capitalisation is the difference between helping your Uncle Jack off a horse and helping your uncle jack off a horse.
    Knowledge is gained through listening, Understanding is gained through discussion.
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 246 admin
    Is there any reason you can't convert the midi to wav?
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue Posts: 4,269 Advanced user
    Primarily filesize for the game and steam workshop 100mb limits. I can't make audio heavy games with those restrictions. If not midi, how about maybe adding tracker support? That seems like a good alternative to midi for the games I would like to create, and is something quite well used in the game industry.

    I have some ideas for 3d music based games I'd like to try.
    Games:Subnautica Fan Game Mods: GorgeCraft & CTF & Proving Grounds Website: andysoulrider.uk
    Twitter: @AndySoulRider Twitch: Twitch.tv/SoulRider YouTube: Youtube.com/user/IamSoulRider/videos

    Capitalisation is the difference between helping your Uncle Jack off a horse and helping your uncle jack off a horse.
    Knowledge is gained through listening, Understanding is gained through discussion.
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 246 admin
    Perhaps we can support at least some kind of compressed audio format. I wonder what would be best. Is ogg vorbis decent?

    I will add a card in Trello but it will have to be a lower priority task for now as we have some bigger things we need to get to in the short term. Thanks!
    Soul_Rider
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 1,737 admin
    I've added support for mp3.
    Max McGuire
    Technical Director, Unknown Worlds Entertainment
    Soul_Rider
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    edited April 2015
    136. Bug: single character variables like
    local a = 0 --- number
    
    do not show up in the interface

    137. Bug: World_SendMessage/World_SendMessageToAll nowhere mentioned in api.html or the rest of the docs

    138. Bug:: I noticed that a function that is bound the to mousewheel (Action.Next) is always triggered twice. Here is some example code
    upcount = 1
    function countup()
        upcount = upcount + 1
        print(upcount)
    end
    
    function OnInput(input)
        if bit.band(input.actions, Action.Next) ~= 0 then
            countup()
        end
    end
    
    Slowly turning the mousewheel will produce outputs like 2 2 then 3 3, then 4 4
    Right now I have a hard time to make sure that a function is only called once per button press.
    Until here, that seems like a minor annoyance, but I actually believe this to be a major bug, and here is why:
    When you turn your mousewheel rapidly, the output changes
    2
    2
    3
    3
    4
    4
    5
    6
    5
    7
    8
    6
    ...
    97
    83
    98
    84
    99
    100
    85
    101
    86
    102
    87
    
    When I dump _G, I actually get two dumps that differ in _G.upcount
    Tests indicate that for players connected over the network, the function is only called once.
    Making the functions and variables local does not change anything.


    139. Feature Request: "if bit.band(input.actions, Action.Next) ~= 0 then ..." is nice and all, but maybe there should be a high level function like IsPressed(Action.Next). While we are at it: when you want to query the state of a button outside of the OnInput function, you need to introduce a global variable and sync it with the input bitmask, why not have the current input state available globally at all times?

    140. Remark: Consider the following code
    function OnTest(message)
        timedfunction(message.var, 0)
    end
    
    function timedfunction(var, num)
        print(var)
        if num < 5 then
            timedcallback(1/30, function() timedfunction(var, num+1) end)
        end
    end
    
    World_SendMessageToAll("Test",{var=Vec3(1,1,1)})
    
    Output:
    Vec3(1, 1, 1)
    Vec3(2.92093e-018, 0, 0)
    Vec3(1, -2.66457e-007, 1.46211e-006)
    Vec3(2.92093e-018, 0, 0)
    Vec3(0.00226088, 0, 0)
    Vec3(0, 0, 0)
    
    If it's not immediatly clear what's happening here, I am accessing freed chunks of memory here. I am not too familiar with the internals of Lua, but I suppose that the CDATA block message.var is passed as reference and then deallocated after the OnTest function is left. timedcallback then fails to make it's own copy of the object. I can circumvent this by changing to call to timedfunction(message.var*1, 0) [or in my case timedfunction(message.targetCoords*Coords.GetIdentity(), 0)]

    141. Bug: Movement code: running diagonally agains small walls (i.e. wall_01_small or 2 crates) and spamming the jump button results in high jump altitudes


    142. Q: Is there a way to have a child entity that does not rotate with it's parent, but still moves along with it? Other by manually rotating the child in the opposite direction of the parent.

    143. Q: Is there a way to have an object that is not visible to everyone? Think of cloaked skulks of waypoint breadcrumbs.

    Additional Remarks to 123.:
    Recently I have worked alot with moving child entities, and came to the conclusion that the local version like Self_GetLocalCoords (and its pendants for angles, positions and setters and getters) are the ones you almost always want. Considering how Bone_GetCoords already returns the local coordinates, I propose that the generic function like *_GetCoords, *_SetAngles, ... work in the local reference frame and specialized ones are added to access the global/absolute coordinates.
    Post edited by Brute on
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 1,737 admin
    Apologies in advance, this is probably not going to be the most satisfying set of replies!

    136. Bug:: single character variables like

    Thanks, I fixed it.

    137. Bug: World_SendMessage/World_SendMessageToAll nowhere mentioned in api.html or the rest of the docs

    The API documentation is currently only including functions that are implemented in C++. These particular functions are implemented in Lua. We'll include them in the future though.

    138. Bug:: I noticed that a function that is bound the to mousewheel (Action.Next) is always triggered twice. Here is some example code

    This sounds like it's behaving properly and what you are seeing is the result of running the code on both the server and client. If you change it to print(World_GetName(), upcount) you should be able to see the two different sources. The same code may run on the client multiple times as well due to client side prediction, but before it runs each time it should reset upcount and thus produce the same result.

    139. Feature Request: "if bit.band(input.actions, Action.Next) ~= 0 then ..." is nice and all, but maybe there should be a high level function like IsPressed(Action.Next). While we are at it: when you want to query the state of a button outside of the OnInput function, you need to introduce a global variable and sync it with the input bitmask, why not have the current input state available globally at all times?

    This has to do with the networking. It would probably make sense to introduce some more concise way of determining of a button is pressed, but adding a global function wouldn't make sense in all contexts. For example, say you have a script on an object which is not a player; what should the functions return in that case? I will give some consideration how this could be done in a way that doesn't lead to confusing behavior.

    140. Remark: Consider the following code

    Yes you are right, this is a good catch. Another way to do it is like Coords(message.targetCoords) to make a copy of the variable. Fixing problems like this in luajit is one of the hard tasks we still have to solve. What I'd really to to do is make it so that a = b has copy semantics if b is a "structure" (i.e. a Vec3, Coords, etc.).

    141. Bug: Movement code: running diagonally agains small walls (i.e. wall_01_small or 2 crates) and spamming the jump button results in high jump altitudes

    This is caused by the logic in the movement code that gives you a little extra boost when you're running up a hill in jumping. Without the boost the jump feels very ineffective. The consequence is that jumping on a steep or nearly vertical slope gives you a big boost.

    142. Q: Is there a way to have a child entity that does not rotate with it's parent, but still moves along with it? Other by manually rotating the child in the opposite direction of the parent.

    Not at the moment, but one feature I've had in mind is make a child entity that doesn't inherit its parent's transform. This is something we could use to place the "ghost" cube for the Minecraft-like building without having the networking delay. This could be an extension to that (i.e. only inherit position, only inherit rotation, inherit full transform). What's your use case?

    143. Q: Is there a way to have an object that is not visible to everyone? Think of cloaked skulks of waypoint breadcrumbs.

    One way of doing this I've been considering is allowing the camera to include tags that affect what it renders. What do you think about that?

    Additional Remarks to 123.:
    Recently I have worked alot with moving child entities, and came to the conclusion that the local version like Self_GetLocalCoords (and its pendants for angles, positions and setters and getters) are the ones you almost always want. Considering how Bone_GetCoords already returns the local coordinates, I propose that the generic function like *_GetCoords, *_SetAngles, ... work in the local reference frame and specialized ones are added to access the global/absolute coordinates.


    I came to the opposite conclusion (at least that if you didn't have an explicit reason to get the local coordinate frame, you wanted the global one) when I named them, but I'll take your feedback into consideration.
    Max McGuire
    Technical Director, Unknown Worlds Entertainment
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    Max wrote: »
    Apologies in advance, this is probably not going to be the most satisfying set of replies!
    untrue

    Max wrote: »
    138. Bug:: I noticed that a function that is bound the to mousewheel (Action.Next) is always triggered twice. Here is some example code

    This sounds like it's behaving properly and what you are seeing is the result of running the code on both the server and client. If you change it to print(World_GetName(), upcount) you should be able to see the two different sources. The same code may run on the client multiple times as well due to client side prediction, but before it runs each time it should reset upcount and thus produce the same result.
    Ok that makes sense. I guess the proper questions is then, why the client side prediction and the server are so easily (and permanently) desynchronized even when client and server are on the same machine, and what I can do to syncronize them again.
    Predict 2
    Server 2
    Predict 3
    Server 3
    Predict 4
    Server 4
    Predict 5
    Predict 6
    Server 5
    Predict 7
    Server 6
    Predict 8
    Server 7
    Predict 9
    Server 8
    Predict 10
    Server 9
    Predict 11
    Server 10
    Predict 12
    Server 11
    Predict 13
    Predict 14
    Server 12
    Predict 15
    Predict 16
    Server 13
    Predict 17
    Server 14
    Predict 18
    Server 15
    Predict 19
    Server 16
    Predict 20
    Predict 21
    Server 17
    Predict 22
    Server 18
    Predict 23
    Server 19
    Predict 24
    Server 20
    Predict 25
    Server 21
    Predict 26
    Server 22
    Predict 27
    Server 23
    Predict 28
    Server 24
    Predict 29
    Server 25
    Predict 30
    Server 26
    Predict 31
    Predict 32
    Server 27
    Predict 33
    Server 28
    Predict 34
    Server 29
    Predict 35
    Server 30
    Predict 36
    Server 31

    Max wrote: »
    139. Feature Request: "if bit.band(input.actions, Action.Next) ~= 0 then ..." is nice and all, but maybe there should be a high level function like IsPressed(Action.Next). While we are at it: when you want to query the state of a button outside of the OnInput function, you need to introduce a global variable and sync it with the input bitmask, why not have the current input state available globally at all times?

    This has to do with the networking. It would probably make sense to introduce some more concise way of determining of a button is pressed, but adding a global function wouldn't make sense in all contexts. For example, say you have a script on an object which is not a player; what should the functions return in that case? I will give some consideration how this could be done in a way that doesn't lead to confusing behavior.
    I did in no way propose to replace the bitmask with something else. I know why it is there and why it should stay there. All I said is, that having to use logical operations on bitmasks to get a button state is unnecessary complicated, is not very readable and hence makes the game a little bit less accessible. That's why there should be some higher level mechanism that hides the underlying bitmask.

    There are multiple ways to achieve that.

    The most simple would be to have a function like
    function IsKeyPressed(inputs, action)
        return bit.band(input.actions, action) ~= 0
    end
    
    function OnInput(input)
        if IsKeyPressed(input, Action.Next) then
    ...
    

    But having to pass the input everytime, when it's the only thing you could legitimately pass to that function seems redundant, which is why I proposed to have the current keypresses in a global variable, and then have a global IsPressed(action) function. If no player is "attached" to an entity, the question if a certain key is pressed would of course always yield 'false'. If a player is attached, the global actions would be updated accordingly. However, this implies that only one player can control an entity at a time (which I assume but haven't checked yet).
    If this is too limiting, then the current button states could be a property of the player (which is already carrying some data fields), and the call could be made more explicit:
    if IsKeyPressed(playerId, Action.Next) then ... -- returns false if playerId<0
    

    Another approach would be to have a bunch of specialized functions
    function OnJumpPressed -- executed once
    ...
    end
    
    function OnJumpHeld -- executed continously
    ...
    end
    
    function OnJumpReleased
    ...
    end
    
    function OnDropPressed
    ...
    end
    

    Max wrote: »
    140. Remark: Consider the following code

    Yes you are right, this is a good catch. Another way to do it is like Coords(message.targetCoords) to make a copy of the variable. Fixing problems like this in luajit is one of the hard tasks we still have to solve. What I'd really to to do is make it so that a = b has copy semantics if b is a "structure" (i.e. a Vec3, Coords, etc.).
    I was not aware there is a copy-constructor. Now I dont have to write a copy function to eliminate that unnecessary multiplications. Thanks.

    Max wrote: »
    141. Bug: Movement code: running diagonally agains small walls (i.e. wall_01_small or 2 crates) and spamming the jump button results in high jump altitudes

    This is caused by the logic in the movement code that gives you a little extra boost when you're running up a hill in jumping. Without the boost the jump feels very ineffective. The consequence is that jumping on a steep or nearly vertical slope gives you a big boost.
    I dare to object.
    To be honest, I hadn't checked the movement code before (because I am no longer using it). If I had, I would have seen the comment in the part you have mentioned, that the jumpBoost has a potential to be exploited, and wouldn't have made a bug report.
    But while it probably has it's own problems, the jumpBoost is not the problem here!
    The problem lies few lines above:
    if jumpDesired or (now - timeLastJumpDesired) <= queuedJumpTime then
    
    The OnInput function is executed continously (btw, Why?), and the second part (and isOnFloor) is true on multiple of those calls, which causes the queued jump to be added multiple times during 'queuedJumpTime'. Easy fix would be 'timeLastJumpDesired = -1' in the 'if isOnFloor' part (around line 210)

    Max wrote: »
    142. Q: Is there a way to have a child entity that does not rotate with it's parent, but still moves along with it? Other by manually rotating the child in the opposite direction of the parent.

    Not at the moment, but one feature I've had in mind is make a child entity that doesn't inherit its parent's transform. This is something we could use to place the "ghost" cube for the Minecraft-like building without having the networking delay. This could be an extension to that (i.e. only inherit position, only inherit rotation, inherit full transform). What's your use case?
    Well, a picture is worth a thousand words. Here are 60 pictures a second:

    So I have my glider (body) and a camera (head). As the body is physics enabled, and you cannot have physics enabled child entities, the camera naturally is a child entity of the glider. Now when the body moves, the camera needs to follow. When the camera rotates, the body needs to follow. But as the camera is a child of the body, any rotation of the body also rotates the camera. As a result, the controls feel almost game-pad like. I tried to keep the camera steady by determining the current rotation of the body and that apply a counter rotation on the camera, but the results are mediocre (0:49-1:12). Ultimatly I would want the horizon line to stay fixed, which means the camera moves with the center of mass, but does not get any of the rotations.
    The hiccups in the first 20 seconds during the zooming are caused by issue 138 btw.

    Max wrote: »
    143. Q: Is there a way to have an object that is not visible to everyone? Think of cloaked skulks of waypoint breadcrumbs.

    One way of doing this I've been considering is allowing the camera to include tags that affect what it renders. What do you think about that?

    You mean like a blacklist? Dont render anything whith the following tags...? Sounds good.

    Max wrote: »
    Additional Remarks to 123.:
    Recently I have worked alot with moving child entities, and came to the conclusion that the local version like Self_GetLocalCoords (and its pendants for angles, positions and setters and getters) are the ones you almost always want. Considering how Bone_GetCoords already returns the local coordinates, I propose that the generic function like *_GetCoords, *_SetAngles, ... work in the local reference frame and specialized ones are added to access the global/absolute coordinates.


    I came to the opposite conclusion (at least that if you didn't have an explicit reason to get the local coordinate frame, you wanted the global one) when I named them, but I'll take your feedback into consideration.

    Above, you have mentioned the minecraft block placing procedure, which made me thinking. Whether you require global or local coordinates most of the time may depend strongly on your use case, and no matter how you name the functions, there is always someone who will choose the wrong one on the first try.
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    edited April 2015
    144. Feature Request: Entity_GetChildByName(entityId, name)
    Sure, I can use tags, but it feels dirty.

    145. Bug: using_player.lua:
    local highlightColor = Color(255, 0, 0, 255) --- Color
    I am aware that Hud_HighlightEntity() is currently broken, so this doesn't matter, but this should be either Color(1.00, 0, 0, 1.00) or Color.red

    146. Bug: for a physics enabled collision that is part of a player this code
    function OnThink()
        print(World_GetName(), Collision_GetLinearVelocity(collisionId):GetLength())
    end
    
    generates this output
    [...]
    Server  35.166662017959
    Predict 0
    Predict 0
    Predict 0
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 35.166772626302
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Server  0
    Server  35.166662017959
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 70.333545153775
    Predict 70.333545153775
    Predict 70.333545153775
    Predict 70.333545153775
    Predict 70.333545153775
    Predict 70.333545153775
    Predict 70.333545153775
    Server  0
    Server  35.166662017959
    Predict 70.333545153775
    Predict 70.333545153775
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Server  0
    Server  35.166662017959
    Predict 0
    Predict 0
    Predict 0
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 35.166772823974
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Predict 0
    Server  0
    Server  35.166662017959
    

    147. Remark: When i make something a child of the player by using Self_SetParent(), that triggers OnCreate() in the Predict context, which was unexpected. Similarly when i detach the parent again, the OnDestroy method is called in the Predict context.

    148. Remark: I needed a vector in the local coordinate system. The current way to do it is
    local localVec = coords:GetInverse():TransformDirection(v)
    
    which is fine. But since I only use cartesian coordinate systems, the axes are guaranteed to have length 1. So the above has some unneccessary multiplications and devisions, when effectivly I only need a simple matrix multiplication (matrix times vector):
    local localVec = Vec3(v:DotProduct(coords.xAxis), v:DotProduct(coords.yAxis), v:DotProduct(coords.zAxis))
    
    To my surprise, there was none.

    149. Remark: (possibly bug)
    When an object is inside a trigger area, changing the collision from Solid to Hitbox or Ghost to Hitbox triggers the Trigger (object leaves the area).
    This is relevant for the game bounds (when setup in a way that everything is inside and destroyed on leave), as this effectivly means that nothing can be changed to Hitbox type (after creation), as this would immediately cause the destruction of the entity.

    150. Remark:
    have changed some values while the game was live. not sure what exactly happend, but this caused some asserts at first and then the game crashed. when i tried to load my mod, the assertion errors returned (havent kept a copy). turns out the collision mesh for the object i had edited at last was no longer in the asset browser. I cleared the roaming/FuturePerfect directory to force a rebuild of the collsion mesh, but it didn't work. In the end, I had to delete to following lines in the .build_options file of the model, after that it everything was generated.
    collision=[
            {
                name=""
                convex_decomposition=false
                bodies=[
                    {
                        name=""
                        attach_point=""
                        linear_damping=0.0
                        angular_damping=0.0
                        shapes=[
                            {
                                type="Mesh"
                                radius=-1.#QNAN
                                half_height=0.0
                                half_extents=[-1.#QNAN 0.0 -1.#QNAN]
                                min_bone_weight=0.5
                                mass=0.0
                                density=1.0
                            }
                        ]
                    }
                ]
            }
    ]
    

    151. Bug: attached a player spawner to some entity, was spawned near (0,0,0) because of player_spawner.lua:
    World_SpawnBlueprint(playerBlueprint, Self_GetLocalPosition(), Self_GetLocalAngles())
    
    Should be global positions and angles.

    152. Remark: Observed multiple times now, that when someone tries to join my game while I am on the beta channel and he is not, he will download a lot of stuff (expected) but then time out. I am not too woried if betas cannot join non-betas, but maybe the timeout doesn't take ongoing downloads into account.
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 246 admin
    144. I'll talk to Max about it.

    145. I'll fix that.

    I'm looking into 146 now

    147. Is this creating a problem for you or just seems wrong? These objects are being created/destroyed in the prediction world but this should maybe be hidden from scripts.

    148. You want a Matrix type in script basically?

    149. Hmm, we will have to think about this one. That behavior is not great.

    I have fixed 150.

    151. I changed that to use global position/angles. I am not sure why I was using local there.

    152. I suspect it is because of how old the non-beta build is at this point but maybe something unintended is going on here with the timeout. I'll see what I can uncover.

    Thanks!
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 246 admin
    edited April 2015
    I have added some cards for these requests.

    https://trello.com/c/JrMy1lbI/1564-timeout-while-downloading-from-workshop

    https://trello.com/c/8UE5lWVF/1563-when-an-object-is-inside-a-trigger-area-changing-the-collision-from-solid-to-hitbox-or-ghost-to-hitbox-triggers-the-trigger-obje

    https://trello.com/c/2adM3zTH/1562-add-entity-getchildbyname-entityid-name

    We are still deciding on the name thing. It may be a can of worms as we may need to add a lot more of these types of name query functions if we add that one. Names were intended as a debugging mechanism more than anything.
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    147. Is this creating a problem for you or just seems wrong? These objects are being created/destroyed in the prediction world but this should maybe be hidden from scripts.
    No, not a problem at all. Had attached some messages to the creation/destruction events and was surprised of the addtional outputs. But all the calls stay in the predict context, so they don't matter. I make it my habit now to always print World_GetName() with everything. Helps to understand such outputs:
    print(World_GetName(), EntityId_ToString(id), Entity_GetIsValid(id)) -- id is networked
    
    Output:
    Predict    EntityId doesn't exist    true
    Server    EntityId(name: Puck, index: 933 use: 1)    true
    
    148. You want a Matrix type in script basically?
    No, I thought of either a change in the coords multiplication
    local function Multiply(v, w)
        if w.origin ~= nil then
            local result = Coords()
    
            result.xAxis.x = v.xAxis.x * w.xAxis.x + v.yAxis.x * w.xAxis.y + v.zAxis.x * w.xAxis.z
            result.xAxis.y = v.xAxis.y * w.xAxis.x + v.yAxis.y * w.xAxis.y + v.zAxis.y * w.xAxis.z
            result.xAxis.z = v.xAxis.z * w.xAxis.x + v.yAxis.z * w.xAxis.y + v.zAxis.z * w.xAxis.z
    
            result.yAxis.x = v.xAxis.x * w.yAxis.x + v.yAxis.x * w.yAxis.y + v.zAxis.x * w.yAxis.z
            result.yAxis.y = v.xAxis.y * w.yAxis.x + v.yAxis.y * w.yAxis.y + v.zAxis.y * w.yAxis.z
            result.yAxis.z = v.xAxis.z * w.yAxis.x + v.yAxis.z * w.yAxis.y + v.zAxis.z * w.yAxis.z
    
            result.zAxis.x = v.xAxis.x * w.zAxis.x + v.yAxis.x * w.zAxis.y + v.zAxis.x * w.zAxis.z
            result.zAxis.y = v.xAxis.y * w.zAxis.x + v.yAxis.y * w.zAxis.y + v.zAxis.y * w.zAxis.z
            result.zAxis.z = v.xAxis.z * w.zAxis.x + v.yAxis.z * w.zAxis.y + v.zAxis.z * w.zAxis.z
    
            result.origin.x = v.xAxis.x * w.origin.x + v.yAxis.x * w.origin.y + v.zAxis.x * w.origin.z + v.origin.x 
            result.origin.y = v.xAxis.y * w.origin.x + v.yAxis.y * w.origin.y + v.zAxis.y * w.origin.z + v.origin.y
            result.origin.z = v.xAxis.z * w.origin.x + v.yAxis.z * w.origin.y + v.zAxis.z * w.origin.z + v.origin.z
    
            return result
            
        else
            local result = Vec3()
            
            result.x = w:DotProduct(v.xAxis)
            result.y = w:DotProduct(v.yAxis)
            result.z = w:DotProduct(v.zAxis)
            
            return result
            
        end
        
    end
    
    (possibly with some better code that checks if w is of type Coords or Vec3)
    or some extra function
    local function InverseTransformDirection(self, v)
    
        local result = Vec3()
    
        result.x = v.x * self.xAxis.x + v.y * self.xAxis.y + v.z * self.xAxis.z
        result.y = v.x * self.yAxis.x + v.y * self.yAxis.y + v.z * self.yAxis.z
        result.z = v.x * self.zAxis.x + v.y * self.zAxis.y + v.z * self.zAxis.z
        
        return result
    
    end
    
    (possibly with a better name, TransformDirection already exists)

    For comparison, here is what coords:GetInverse():TransformDirection(v) calculates
        local xScale = 1.0 / (self.xAxis.x * self.xAxis.x + self.xAxis.y * self.xAxis.y + self.xAxis.z * self.xAxis.z) -- = 1
        local yScale = 1.0 / (self.yAxis.x * self.yAxis.x + self.yAxis.y * self.yAxis.y + self.yAxis.z * self.yAxis.z) -- = 1
        local zScale = 1.0 / (self.zAxis.x * self.zAxis.x + self.zAxis.y * self.zAxis.y + self.zAxis.z * self.zAxis.z) -- = 1
    
        local result = Coords()
    
        result.xAxis.x = self.xAxis.x * 1;
        result.xAxis.y = self.yAxis.x * 1;
        result.xAxis.z = self.zAxis.x * 1;
    
        result.yAxis.x = self.xAxis.y * 1;
        result.yAxis.y = self.yAxis.y * 1;
        result.yAxis.z = self.zAxis.y * 1;
    
        result.zAxis.x = self.xAxis.z * 1;
        result.zAxis.y = self.yAxis.z * 1;
        result.zAxis.z = self.zAxis.z * 1;
    
        local v = Vec3()
    
        result.origin.x = -1 * ( self.origin.x * result.xAxis.x + self.origin.y * result.yAxis.x + self.origin.z * result.zAxis.x )
        result.origin.y = -1 * (self.origin.x * result.xAxis.y + self.origin.y * result.yAxis.y + self.origin.z * result.zAxis.y )
        result.origin.z = -1 * (self.origin.x * result.xAxis.z + self.origin.y * result.yAxis.z + self.origin.z * result.zAxis.z )
        
        local result2 = Vec3()
    
        result2.x = v.x * result.xAxis.x + v.y * result.yAxis.x + v.z * result.zAxis.x
        result2.y = v.x * resultxAxis.y + v.y * result.yAxis.y + v.z * result.zAxis.y
        result2.z = v.x * result.xAxis.z + v.y * result.yAxis.z + v.z * result.zAxis.z
        
        return result2
    

    But again, such multiplication are only meaningful if the coordinate axes are normalized. As far as I see, scaled axes are used nowhere, yet.
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    edited May 2015
    153. Remark: Documentation should say that World_TestRayOverlap(origin, direction, distance, filter) assumes a normalized direction. I used the current velocity as direction and it took me some time to realize that direction * distance is used.

    154. Feature Request: Does Self_GetComponent("Camera") need to be case sensitive? Why even strings when all the componentsTypes are already listed, i.e. ComponentType.Camera?

    155. Feature Request: Entity_GetIsValid(nil) should not throw an error, so i can shorten these lines:
    if target ~= nil and Entity_GetIsValid(target) then
    
    Also, I had the special case where the argument was a valid Id in the server context, but nil in the predict context.

    156. Remark: Short time of confusion until I realised that Camera_SetFov takes radians. Maybe documentation should mention that.

    157. Remark: I want to know if I hit a "Ramp".
    As I cannot check for the name (#102, #144), I gave every ramp a tag and then checked for that
    function OnContact(message)
        print("contact with", EntityId_ToString(message.otherId), Entity_GetHasTag(message.otherId, "ramp"))
    end
    
    Result:
    contact with    EntityId(name: ramp_01_a, index: 3354 use: 1)   false
    
    ramp_01_a is a child of "Ramp", so it does not inherit it's tag. I ended up writing a function that recursivly checks all parents for tags.
    Of course I am not suggesting that children should inherit the tags of their parents, but maybe there is a more elegant solution.


    158. Bug: The World_EndGame() overlay is on top of the entity editor

    159. Bug: The only method to unset an entity field such as the "attach to" field is to drop it against the background. Kind of difficult to do from the inside of a room Edit: Backspace works fine

    160. Feature Request: on grid increase/decrease also show the snapsize for angles

    161. Bug: add script
    select script field
    type "creat"
    drop "add force on create" into the script field
    select script field
    type "creat"
    drop "create player on destroy" into the script field
    -> height of "offset distance" field is wrong
    (not always reproducable)
    CQ2l6K2s.jpg

    162. Bug: add any script to an entity. select the script field and drop "add score on activate" instead. notice how the default score is 0, although it is 1 in the script. works with any script.

    163. Bug: create_player_on_destroy.lua:
    not changing offsets, will produce errors:
    Entity position set to a non-finite value
    Entity angles set to a non-finite value
    here is why:
    local position = coords.origin - (coords.zAxis * offsetDistance)
    local lookDir = coords.origin - position
    local lookInCoords = Coords.GetLookIn(position, lookDir, Vec3(0, 1, 0))

    for offsetDistance = 0, lookdir is Vec3(0,0,0)
    this causes lookInCoords to be (Vec3(0,0,0), Vec3(0,0,0), Vec3(0,0,0), someorigin)
    which causes lookInCoords:GetAngles() to be nan

    solution:
    insert
    if lookDir == Vec3(0,0,0) then lookDir = Vec3(0,0,1) end
    after line 31, or limit the minimum offsetDistance

    164. Bug: package manager lacks destinction between local and workshop versions of the same package

    165. Bug: could publish a package that depends on other local packages without a warning

    166. Feature Request: right click to look around should work while editing an entity

    167. Bug: general_spawner.lua:
    randomDir unused
    spawnRadius unused
    spawnAngles unused (!)
    use new Entity_AddForce instead of World_SendMessage("AddForce") (although regarding the answer to 106 I am not sure why Entity_AddForce even exists, as it breaks encapsulation)
    if spawnMinForce > 0 and spawnMaxForce > 0 then
    
    should be
    if ( spawnMinForce ~= 0 or spawnMaxForce ~= 0 ) and spawnMinForce <= spawnMaxForce then
    
    same for torque
    spawnAngles.yaw = spawnAngles.yaw + math.pi * math.random()
    
    should use math.randomf(0,2*math.pi) (I think)

    168. Remark: playerspawners for two teams (in two different spawnGroups) dont handle playerJoin (a player is spawned in each spawnGroup), and therefore need to ignore playerJoin and have a central instance manage all player assignments. Maybe I misunderstand the spawnGroup concept here.
    Also on player death a "Dead Player" is spawned, that does not inherit the spawnGroup of the destroyed avatar, hence that information is lost.

    169. Q: There is OnPlayerJoin. Is there a similar call once a player leaves? I want to maintain a list of all connected players, so i can decide which team new players should be assigned to. (yes, I could check if playerIds are valid everytime i use them)

    170. Q: Action.128 = "Drop" <- for what is this field useful? Isn't Action.Drop = 128 all that is ever needed?<br>
    171. Remark: I am slowly running out of assignable actions. There are 19 actions, as far as I understand there is room for 13 (45?) more.

    172. Bug: Self_SetParent() vs client prediction
    When I catch an object, I run this code on the object:
    Collision_SetFilter(collisionId, CollisionFilterPreset.Ghost)
    Collision_SetPhysics(collisionId, false)
    Self_SetParent(message.catcher) -- message.catcher is the player
    
    This is what happens

    Note how I shoot in x-direction (world coordinates) and for ~1 frame the puck appears in x-direction in the local coordinates of the player.
    Both, the player and the puck are physics-enabled.
    Is there anything I can do to prevent this?

    173. Bug: referee/referee.fbx.build_options:9 : Syntax error: Expected '='
     8            materials={
     9                0Mat="referee/referee.material"
    10            }
    
    0Mat is the texture name that comes right out of MagicaVoxel and if leading numbers are not allowed I need to edit the fbx file, which I would like to avoid. I also believe the error is new, never noticed it before.

    174. Remark: I have an entity with 2 Scripts. One has the OnSetText() function, the other one looks like this:
    function OnTrigger(message)
            World_SendMessage("SetText", Self_GetId(), {text=""})
            World_PlaySound("pads/boost.wav", Vec3(0,0,0), SoundType.Effect, 50, 0.8, Self_GetId()) -- 1
    --         World_PlaySound("pads/boost.wav", Self_GetPosition(), SoundType.Effect, 50, 0.8)  -- 2
    end
    
    The first PlaySound() call does not emmit a sound, the second one does. If I remove the SendMessage, both do.
    The problem is this function which is called by OnSetText:
    local function DeleteChildren()
        local children = Self_GetChildren()
        for i=1,#children do
            World_DestroyEntity(children[i])
        end
    end
    
    I am not sure what happens here. It's almost as if Self_GetId() reports a wrong EntityId, but as far as I can see, it does not.

    175. Q: What is the difference between SoundType.Ambient and SoundType.Max? Both ignore the radius and position arguments of World_PlaySound() and I don't notice a difference.

    176. Remark: I have an object wich emmits a looping sound. I want to disable/enable this sound by script, which i do now by setting the volume to 0/1. Maybe there should be a start/stop function.

    177. Bug: discombobulizer and buying_station:
    Bone_GetCoords(Self_GetBoneComponent("Spawn")) * Self_GetCoords()
    
    should be
    Self_GetCoords() * Bone_GetCoords(Self_GetBoneComponent("Spawn"))
    
    doesnt matter in this case, as the bone is aligned with the local coordinate system, but should be fixed in case someone copies the code or rotates the bone.


    Regarding 140. (access of freed memory):
    local hits = World_TestRayOverlap(Vec3(0,50,0), Vec3(0,-1,0), 200, CollisionFilterQueryPreset.Bullet)
    local hit = hits[1]
    --local result,hit = World_Raycast(Vec3(0,50,0), Vec3(0,-1,0), 200, CollisionFilterQueryPreset.Bullet)
    local o = Vec3(hit.position)
    print("hit at", hit.position,"|",o)
    print(EntityId_ToString(Self_GetId()),"hit at", hit.position,"|",o)
    
    Output:
    hit at  Vec3(0, 7.08394, 0) |   Vec3(0, 7.08394, 0)
    EntityId(name: Glider, index: 3500 use: 14) hit at  Vec3(1.84687e+025, 1.48662e+022, 4.36046e+027)  |   Vec3(0, 7.08394, 0)
    
    Is EntityId_ToString doing something special? No issues if World_Raycast is used instead of World_TestRayOverlap. Should I always make a local copy if I use structs that are passed from other functions? What about this one:
    timedcallback(1, function() Unstuck(hit.entityId, 1) end)
    
    Unstuck recieves another id than the calling function was sending. Are entityIds structs? I thought they were integers interpreted as doubles?
    Post edited by Brute on
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 246 admin
    153. Added a note to the documentation.

    154. I changed it to be case insensitive. I was going to add versions of Self_GetComponents() and Self_GetComponent() that take a ComponentType but there were complications so holding off on that.

    155. This is not possible currently.

    156. Done.

    157. I think you handled this the right way. We can consider adding a helper function to check if any entity in the hierarchy has a tag.

    158. Just fixed this one yesterday. It should no longer display when in editor mode.

    I will continue on these items on Monday!
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer Posts: 246 admin
    159. You can select the field by clicking on it and then press the backspace key.

    160. Good idea. Added a card.

    161. Reproduced. Added a card. I noticed you can deselect the entity and reselect to "fix" this problem.

    162. I have noticed this type of thing myself in the past but haven't been able to figure out the repro steps. This didn't do it for me. I tried in the blueprint editor so maybe you have other steps.

    163. Fixed. Thanks!

    164. Added a card.

    165. Hmm, a tricky one! We will have to figure something out.

    166. I know what you mean. Added a card.

    167. I cleaned up that code. Entity_AddForce exists because it is a very common operation and we didn't want to require every object in the world to have a script to allow forces to be applied. It doesn't break encapsulation that much since force can already be applied to another entity by moving into it.

    168. The team spawning code is pretty old and I was never happy with it. Perhaps I should just remove it for now? It would probably be better to have a dedicated "team spawner" script rather than trying to reuse the existing one.

    169. There currently is not. I can't think why there shouldn't be so I have added a card to add OnPlayerLeave.

    170. I can't find the code right now but I believe the code that generates those automatically fills the table in reverse too. It lets you convert from the code to the name.

    171. There is a limit right now. We didn't intend to add a bunch more keys but if you can make a good argument we will of course listen.

    172. Hard to tell really what is going on here. Do you set the position of the puck at some point after the code you posted?

    173. This was recently fixed. I was using MagicaVoxel too :)

    174. The first play sound causes the sound entity to be attached to the entity. Then in your SetText message receiver you destroy all the children. So the sound entity is a child of your child and is also destroyed. You can add a delay to avoid this with timedcallback perhaps.

    175. haha, SoundType.Max is not really supposed to be exposed (not exposed in the UI for instance). It just denotes the number of items in our enum. Ambient and Effect are the only 2 types right now.

    176. This is the correct way.

    177. Fixed. Thanks!

    Entity Ids are structs since an entity can stop existing while something is holding a reference. We update the entity Ids automatically to null them out in this case.
    Howser
  • BruteBrute Fully active user Join Date: 2009-06-10 Member: 67778Members, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Posts: 138 Fully active user
    155. This is not possible currently.
    Are you absolutely sure about that?
    Seems like whatever creates server.lua only has to add a single check to the function
    function Entity_GetIsValid(entityId)
        if entityId == nil then
            entityId = EntityId_Invalid
        end
        return (GameLib.FFI_Server_Entity_GetIsValid(world, entityId))
    end
    
    The same check already exits in a bunch of other functions (World_SpawnBlueprint, World_PlaySound, World_PlayParticles)
    162. I have noticed this type of thing myself in the past but haven't been able to figure out the repro steps. This didn't do it for me. I tried in the blueprint editor so maybe you have other steps.
    That baffles me, since it always happens. Blueprint editor and world editor. Whenever a script component is reused for anther script, all values are nulled instead of their default value.

    165. Hmm, a tricky one! We will have to figure something out.
    I imagine it to be straight forward.
    For each package in packages from package.info,
      if package does not start with "steam:" and package not in {steam}\FuturePerfect\packages
        return warning message
    
    168. The team spawning code is pretty old and I was never happy with it. Perhaps I should just remove it for now? It would probably be better to have a dedicated "team spawner" script rather than trying to reuse the existing one.
    Can't tell. The team spawners are certainly not easy to use right now, but it is possible to make them work (e.g. I use them). Probably best to leave them until they get replaced.
    171. There is a limit right now. We didn't intend to add a bunch more keys but if you can make a good argument we will of course listen.
    Regarding the default keys, there are a bunch of easily reachable keys that are not bound
    Alt, Q, F (notice how G is bound), Mouse2 (mousewheel), (Mouse3, Mouse4)

    Regarding functionality, there are some functions that probably deserve their own key:
    roll left/right (for descent-like games), peek left/right (for shooters)
    sneak
    quick switch/last weapon
    map
    flashlight
    taunt
    onscreen menu/radio menu/buy menu

    Here is my situation: 2 keys left and at least 3 actions to assign
    assigned actions:
    forward,left - move
    movementModifier - turbo
    drop - drop puck
    jump - shoot puck
    next,prev - scroll through items
    primary - use item (primary mode)
    secondary - use item (secondary mode)
    jump - shoot
    crouch - look behind (hold)
    1-9 - inventory access

    free actions:
    reload
    use

    actions I want to assign a key to:
    free look/look around (modifier)
    change camera perspective (10 different ones)
    show map
    172. Hard to tell really what is going on here. Do you set the position of the puck at some point after the code you posted?
    I don't set the position (well I do, but disabled that for this video). I updated the workshop with a minimal version.

    I think it is important here that the object to catch is physics enabled and the catching entity is the player. The faulty location is the global coordinates (in the video: +16 in z direction) added relative to the player in his reference frame.
Sign In or Register to comment.