Classic Entities Mod

xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
I recently published this small mod which adds some familiar entities from NS1. This is similar to Extra Entities Mod (and even designed to support maps built for it), but is more focused on a smaller core set of entities.

The code is available at https://github.com/xToken/ClassicEnts. I welcome anyone that does try this out to let me know about any bugs or issues you encounter. Included is a small demo map which shows of some of the entities and how they can be used.

The mod can also be found on the workshop at http://steamcommunity.com/sharedfiles/filedetails/?id=474696302.

Included is an editor_setup.xml file for use with the editor to allow placement of the new entities. This file also contains the entities from WaterMod, which would need to be run if you use those.

Here is also a brief overview of the new entities:
Breakable Emitter - A breakable entity that can be scaled and use models from props. Emits a signal when broken.

Controlled Button - A button that can be signaled on/off. Emits when used. Also can be scaled and use prop models, or restricted to only a specific team.

Controlled Moveable - A entity which can be given a model and scale. Will path between provided waypoints given, using initial location as first waypoint. Allows 3 object types - Gates open and close only by signals. Elevators path between multiple points before returning to original. Doors open/close automatically when players are nearby.

Controlled Timed Emitter - A entity which will emit a signal after a certain time. Can be used to chain events.

Controlled Weldable Emitter - A entity which will emit a signal when fully welded. Can use prop models and be scaled.

Controlled Dialog Listener - A entity which will show a message to local players or globally when signaled.

Function_Listener - Can be used to trigger LUA functions when signaled. Let me know if additional functions are needed (have to be added in code).

Pathing_Waypoint - Used by moveables, takes a number which indicates their position in the chain.

Comments

  • Dalin SeivewrightDalin Seivewright 0x0000221E Join Date: 2007-10-20 Member: 62685Members, Constellation
    Played around with some of these tonight and found a bug with the Controlled Moveable however.
    If you have it set to Elevator the following things will happen:
    1. Running against a wall while the Elevator is moving will allow the player to glitch off the elevator, falling through it.
    2. The Elevator can move over the player freely. For example, if the player is on bottom waypoint for an Elevator and the Elevator is currently at the top, triggering the Elevator will drop the elevator and it will pass through the player until the player is effectively on it.
    3. When the Elevator is moving any direction except up/down (diagonally, for example) and the player happens to touch geometry while it is moving, the player will end up being pulled in the direction of the elevator and will become effectively stuck unless the Elevator pushes the player back out when retuning to its original position.

    Aside from that, one nice-to-have would be to set the trigger radius on a Controlled Moveable set to the Door mode.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    I'll add the trigger radius for the doors, it annoyed me how the detection radius was overridden by most entities anyways.

    Elevators are still really buggy overall, or at least the player interaction part of them. The clipping through players I don't have a good solution for yet, I haven't decided if its best for the elevators to outright kill the blocking player, damage them a bit and bounce back, or just clip through like they do now.
  • Dalin SeivewrightDalin Seivewright 0x0000221E Join Date: 2007-10-20 Member: 62685Members, Constellation
    xDragon wrote: »
    Elevators are still really buggy overall, or at least the player interaction part of them. The clipping through players I don't have a good solution for yet, I haven't decided if its best for the elevators to outright kill the blocking player, damage them a bit and bounce back, or just clip through like they do now.

    I suggest you add a Blocking type with different options and allow it to be map configurable:
    1. Kill blocking entities.
    2. Reverse mode. If the elevator encounters a blocking entity, return to the last way point.
    3. Ignore and pass through entities.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Alright I just updated this and included a new entity, ControlledPusher. Its similar to the push_trigger from EEM, but works by adding a base velocity to the player. This should allow me to also create conveyors, if people are interested.

    I updated the moveables also which should resolve *most* of the issues with elevators and players riding. Its not perfect and there are a couple edge cases I probably need to account for, but I can fix those hopefully much easier from now on. I added a new property for them called blockedDamage, if its greater than 0 they will cause damage to blocking players. I made all of them blockable because they were causing issues for prediction when they just clipped through players, and they could get you stuck. They currently do not get blocked by structures however.

    I also added the detectionRadius for moveables that are doors.
  • McGlaspieMcGlaspie www.team156.com Join Date: 2010-07-26 Member: 73044Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Onos, WC 2013 - Gold, Subnautica Playtester
    edited July 2015
    This is quite interesting to see, especially since the CDT has been investigating issues with moving entities that move entities (i.e. elevators, trains, etc)...namely, the jittering that happens. There might be a fix in the pipeline for this, which should make mods like this much more useful. :smile:

    No promises on "When" though. Good work @xDragon! I'm all for giving mappers / modders more and better "tools" to work with.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    edited July 2015
    There's actually no jittering in this anymore, so I'm not sure I understand where that problem might be coming from.. I did have issues when having players moved on the Server.OnUpdate event, but since that doesnt run in sync with the predicted and lag compensated movement code, and probably uses values that only update on the client with the sendrate (20hz), I never figured it would work well anyways.

    Actually, I am not sure how it appears from a third person perspective - IE someone watching someone else ride the elevator.. Kinda hard to test that solo :open_mouth: .. Maybe I need to make bots that ride elevators for testing..
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    Did it look ok when running in thirdperson mode?

    Generally I found running in third person mode gave similar results to what others saw in game.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    edited July 2015
    It looks pretty smooth, there is a verryyy slight jitter though (youll have to look pretty close to notice it). It might be caused by running it on a listen server though, I generally get a lot of red plug issues when testing on listen servers anymore.

    https://youtube.com/watch?v=e3iTrMlIRr8
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    edited July 2015
    xDragon wrote: »
    There's actually no jittering in this anymore, so I'm not sure I understand where that problem might be coming from.. I did have issues when having players moved on the Server.OnUpdate event, but since that doesnt run in sync with the predicted and lag compensated movement code, and probably uses values that only update on the client with the sendrate (20hz), I never figured it would work well anyways.

    Actually, I am not sure how it appears from a third person perspective - IE someone watching someone else ride the elevator.. Kinda hard to test that solo :open_mouth: .. Maybe I need to make bots that ride elevators for testing..

    The problem with lag compensated games and moving elevators is that each player shown has its own timestamp; when you watch a player you are not seeing the player where the player is now, but where he was some time ago.

    Normally this is not much of an issue (apart from killed behind the corner thing), but when the player is standing on an elevator, you get a problem.

    The elevator and the player will have different times, so the player is standing on the elevator where the elevator was (100+latency) ms ago. So to watchers, the player will either be standing knees high in elevator (if the elevator moves up), or float half a meter up if the elevator is moving down.

    To the player standing on the platform it will look fine though (because the player is moving through a world where he is synched with the world time - it is just that it takes time to transmit his position to other players, at which time he is no longer synched).

    This is not limited to just "standing on" stuff either. If a lagged lerk flies just above (without touching) a raising elevator, to watchers the lerk will be flying straight through the elevator.

    Likewise horizontally moving things. A player standing at the rear edge of something moving horizontally will be seen as standing on thin air.

    I do have a handle on how to solve this; it involves having players check if they are in a position where they are affected by something moving, and then adjust the players reported position to be relative to the moving object. So a player standing on an elevator would have its visible position adjusted (by the server) to be relative to the elevator instead of the world origin.

    Of course this leads to transition issues when a player goes from world-origin to elevator-origin, but a bit of smoothing should help there.

    The cheap way of doing this would be to place the player as a child of the elevator (because then the player origin becomes relative to the elevator automatically), but from looking at the code, pretty much nothing would work correctly if you did; all the code assumes that if you do a player:GetOrigin(), you get a world origin offset.
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    xDragon wrote: »
    I'll add the trigger radius for the doors, it annoyed me how the detection radius was overridden by most entities anyways.

    Elevators are still really buggy overall, or at least the player interaction part of them. The clipping through players I don't have a good solution for yet, I haven't decided if its best for the elevators to outright kill the blocking player, damage them a bit and bounce back, or just clip through like they do now.

    What I have been looking at is manipulating the _velocity_ of players rather than their position. It solves the problem of elevators shifting players into geometry (because you are not changing the position of the player) and it also helps solving the issue with players jumping off a platform (they still have the velocity from the platform even when not touching it; then you can bleed off the velocity afterwards).

    Kinda tricky to get it right. Makes you wish that NS2 had proper momentum/friction based movement instead of it all being faked.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Yea I had originally experimented with elevators adding to players base velocity, but its quite difficult to consistency insure that all players get moved an expected distance with a velocity additive. I tried making it compensate by increasing the velocity if they fell behind or the reverse if they get ahead, but it never ended up being very smooth. Each class has different ground frictions and a baseline stopping friction if moving too slow, so you either need to change the base movement code there or make some careful class specific calculations. I designed conveyors to work by adding a base velocity to the player, which does work decently well.

    There's also still a lot of collision issues even if the elevators just add velocity, since you have no immediate feedback on if the player should be blocking the elevator. You can make them simulate their own collision as they move, but that quickly becomes a huge mess with vertical ones. If its moving down then you really need the players to move after like they do, but if its moving up then you will constantly collide with the players who are riding.
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    Yea, you have to modify the base move mixin to make it work. There is also a bunch of other code that interferes; there is the step-movement code that resets vertical velocity to zero when you touch the ground which leads to the player falling down on the platform, stopping, then starting to fall again etc...

    So yea, there is a bunch of things that needs rewriting.

    And you need a "OnPostProcessMove" callback from the engine which are triggered in the world timeline (ie, after the elevator platform has been reset to world time) which allows you to figure out the size of any position offsets needed to make things look good for other players.

    Was working on it when the buildmachine went active, so had to switch to focus on 275 and 276. Maybe I'll get it done for 277 (which should be this year).

  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Do you know of a good option to physically simulate the movement of the elevator for collisions? Using a box trace isn't great unless you also have the mapper create a trigger entity, since you would be at the mercy of the extents from the model. I've also run into models with offset origins which just make all of this a nightmare. I tried using the physics model but couldn't find a way to have it simulate correctly.
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    You really don't want the elevator to be the active entity; you want the player to know that stuff around him is moving and adjust his movement accordingly.

    And sorry, I don't really know of an easy way to get a generic model collision working. The player movement uses simplified models (capsules or spheres) to represent the player when you do PerformMovement. Box trace is your best bet, but how to get the accurate size of the box can be a bit ... difficult.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    edited July 2015
    Yea I wasn't using this part for player detection, I have all that handled within a mixin on the player class. This is for detecting npc entities like buildings or arcs or something that could obstruct the elevator also.

    The box trace works well enough for that part tho, just looks a bit goofy at times.
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    Mmm... yea, for AI units or structures (which are in the same timeline as the elevator), having the elevator move them is probably simplest - though I guess you can get results where the elevator pushes a structure into another structure; maybe that's what you mean by goofy.

    But right now we have no support for structure-on-structure collision; they are not supposed to move at all.

  • Legend_BossLegend_Boss UK Join Date: 2014-02-27 Member: 194394Members
    edited September 2015
    I initially made my comment on the workshop in steam but have now just come across it here, so will re-post it here being the better place. I initially made my comment on the workshop in steam but have now just come across it here, so will re-post it here being the better place.

    First comment is:
    can you add the option to make the entities, such as lift entity, invisible to commander. I added it to the commander invisible group but it didn't work.

    Second comment is:
    A commander is able to drop structures (such as armoury) on the Controlled button entity. This allows for half of structures to be placed in the wall or even block the button by the commander.
    If the entities can be made invisible to commander, then maybe this can't happen?

    Would be great if you can add the suggested feature
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    I published an update adding a flag to some entities for them to be set as commander invisible. For the blocking issue, you should be able to use the CommanderNoBuild group with geometry to prevent comms from building there.
  • .trixX..trixX. Budapest Join Date: 2007-10-11 Member: 62605Members
    Bump - is this mod still supported? Or have the recent changes messed it up?
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    I imagine some of the recent changes could have caused problems, so its likely broken at this point.
Sign In or Register to comment.