Nez: free, open source 2D framework

The TiledMapMover isnt really made for just doing overlap checks. It works with movement and edge detection. the TiledMapComponent however gives you the option in the constructor to create regular Colliders for any given layer. You can then do standard collision checks with any Collider or directly with the SpatialHash via the Physics class.

I’m on a Mac and I’m having terrible luck getting Nez’s content importers and processors recognized in the Pipeline Tool that comes with the latest version of MonoGame (3.7). Any help would be awesome. :slight_smile:

For what it’s worth, if i use an older version of the pipeline tool they load correctly, but the older tool is quite buggy!

I am looking to add moving platforms to my game. Does nez currently have anything to support this? If not, does anyone have any tips or recommendations on accomplishing this? It seems I may have to edit the TiledMapMover to handle Moving Platform Entities in addition to tiles. Does this sound like the correct approach?

That’s more or less exactly how I would do it. Before calling TiledMapMover.move check for moving platform collisions. You can do that pretty easily using the normal Physics query system to fetch any overlapping platforms. If you get a hit, truncate your movement vector before passing it to the TiledMapMover.

What is the normal Physics query system? But generally what you are saying makes sense! Thanks!

The Physics class has methods for querying for Colliders. See any of the collision methods or the Mover class for examples.

Had the same issue! This is a bug in the 3.7 pipeline tool. You can download a 3.8 development build that has this fixed.

What’s a recommended way to create a level? Can I add child-elements to an entity?

A Nez Scene would be analogous to a level. You can nest Entities via their Transform as deep as you want.

1 Like

Thanks! Another question: how does the camera work? And the zoom? I can’t find relevant hints in this thread, the samples, the wiki and the source.

Edit: Nevermind, I crawled through a couple of github repositories and found it

I’m experiencing a strange behavior when adding child elements to an entity. It seems like the children don’t move to their position unless their parent has a position that is not 0,0. It might be noted that their parent is itself a child to the main entity of the scene. Is this a known issue or expected behavior? Should I try to create an example to debug this? Thanks! Edit: “Solved” it (Don’t understand why the issue was closed though)

Hey guys / gals, I’m having a weird micro lagging issue with follow camera in Nez that I can’t figure out for the life of me. It seems that there is micro lag of camera following a player each frame. Have any of you had a similar issue ?
Here’s a video:
Laggy camera
And source code:
Bitbucket
Any help or suggestions will be greatly appreciated!

Yeah I’ve got that or a similar kind of stutter in my project too? Enabling debug rendering shows why, I think.

@prime31 Furthermore, I’ve wrote a little xml level loader (with a filesystemwatcher that automatically removes the level and it’s chrildren from the scene when the file gets changed) because placing objects by hand kept annoying me and restarting all the time was time consuming. Now I’ve got problems controlling the render order back to front / z-coordinate / render layer. How can I control this? Thanks. Edit: Understood it

Which repositories did you go through @0x25b3? I am trying to figure out the DesignResolution and the Screen size and the CameraBounds and a FollowCamera and I can’t seem to get things working just right. Without the Camera stuff I can get my 40x10 tiled map showing how I want but as soon as I add the CameraBounds and FollowCamera the map isn’t corner to corner and there are dead areas scroll as I move around.

Sorry, didn’t see anything regarding those things. I just searched github for ie. nez and camera to figure out how the followcamera is set up

After finally circling back to this issue and spending another hour with FollowCamera, deadzone, lerp, trying to round the player position, etc. and noticing that the Ninja example also stutters, I’ve started to write my own FollowCamera,… which has the same stutter. I think it’s due to the time when the camera get’s updated, seems to lag behind a little. So my player now directly updates the camera and the problem is gone.

1 Like

Same thing, I’ve using FollowCamera with the same problem and tried tweaking deadzone, lerp, trying to round the player position, etc. And I’ve also tried updating the camera directly but I still see the stuttering problem.

public void update()
        {
            var moveDir = Vector2.Zero;

            if (Input.isKeyDown(_inputs.Up))
                moveDir.Y = -1f;
            else if (Input.isKeyDown(_inputs.Down))
                moveDir.Y = 1f;

            if (Input.isKeyDown(_inputs.Left))
                moveDir.X = -1f;
            else if (Input.isKeyDown(_inputs.Right))
                moveDir.X = 1f;

            var deltaMovement = moveDir * speed * Time.deltaTime;
            var nextPosition = entity.position + deltaMovement;

            entity.transform.setPosition(nextPosition);
            _camera.transform.setPosition(nextPosition);
        }

Could you share your repo that solves this issue? Thanks.

Manage to smooth the jitter making sure that the updated position is rounded.

var deltaMovement = moveDir * speed * Time.deltaTime;
var nextPosition = entity.position + deltaMovement; // updating with this position now, will cause jitter

nextPosition = nextPosition + _overflowVector; // sum previous remainder
_overflowVector = new Vector2(nextPosition.X % 1.0f, nextPosition.Y % 1.0f); // get new remainder
nextPosition = new Vector2(nextPosition.X - _overflowVector.X, nextPosition.Y - _overflowVector.Y); // round

entity.transform.setPosition(nextPosition);
entity.scene.camera.setPosition(nextPosition);

I ran into this issue as well.

I believe this is happening because scene objects (which is where the camera lives) are updated before entities. It was causing horrible stutter for me when my design resolution was set to something low (480x360)

I scaled everything up 3x and am now running at a higher design resolution of 1920x1080 and the stuttering is gone.

I’m not sure how to fix the stutter in row resolution without serious modification to the way Nez does rendering internally. I’m not sure if the above solution of rounding the position up will work well on a tiled map following a character who is moving via the tiledmap function… but if someone gets that (or anything) fully working I’d love to read about it.