By default, DepthStencilState is set to None. Nez doesn’t use or need a depth buffer because it sorts everything itself. What you are trying to do by just rendering stuff with no specific order requires the depth buffer to be enabled. You can of course make your own Renderer that doesnt sort and enables depth testing. The “Nez way” of doing this would be to just add multiple RenderableComponents on a single Entity if they are all related. Just let Nez handle the sorting and render order for you by setting RenderableComponent.layerDepth/renderLayer.
Alright, finally got it working. I ended up using one
RenderableComponent for each layer, and have a main
Component that sends the tiles to be rendered to their corresponding layer.
Thanks for all the help (and sorry if I was kind of pushy).
After looking more into the rendering code, I found a much simpler way to fix this issue. The only reason why Nez can’t handle the depth layer is that
Material.defaultMaterial, which has its
DepthStencilState set to
So I created a custom Renderer with this line in the constructor
this.material.depthStencilState = DepthStencilState.Default;
that was enough to fix all of the issues and for the
Batcher.draw() method to accept/use the depthLayer.
I was wondering, do you want me to submit a Pull Request to add this to the DefaultRenderer? Or perhaps add a new Renderer that fixes that issue? Or maybe add it to the docs? Just think it might be useful for others in the future.
That’s exactly what I told you in my previous comment
No pull request necessary. Nez purposely does not enable the depth buffer because it does the sorting itself. The Material system is there so that you can then do whatever you want with your Materials. Likewise, Renderers are all overridable so that you can render exactly how you want to if you choose to not use Nez’s sorting.
I just started tinkering with Nez and I like what it has to offer. Unfortunately I’m having a problem getting it working in an Android project and I was hoping I could get a push in the right direction.
I’ve got a solution with a Shared Project, then a DesktopGL project and an Android project with references to the shared. I’m able to get a simple scene with a single sprite running in the desktop version, but I’m getting a runtime error while debugging the Android project, right after the MonoGame splash:
Microsoft.Xna.Framework.Content.ContentLoadException: Could not find ContentTypeReader Type. Please ensure the name of the Assembly that contains the Type matches the assembly in the full type name: Nez.BitmapFonts.BitmapFontReader, Nez, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (Nez.BitmapFonts.BitmapFontReader, Nez) occurred
Results are the same when referencing the .dll directly.
Anyone experienced something like this?
I pulled the latest commit for the follow camera, but I’m still getting the jittering issue others have reported when using it at low resolutions (480x270, 640x360) it isn’t until I get to about 960x540 that it starts to smooth itself out. The lag is still there at the higher resolutions, it’s just not nearly as noticeable
After digging into this for much of the morning, I’ve narrowed it down to being present when using TiledMapMover. Using a regular mover results in super smooth camera movement, using the TiledMapMover is very jerky. I see a commit to TiledMapMover a few days ago that was to address adding subpixel movement, but it was reverted a few days later… not sure what that’s about.
I’ve been unable to narrow down the problem further, or fix it… I’m giving up for now and hoping someone else can at least chime with with ideas.
Just wondering… Is Nez considered “completed”?
Don’t misunderstand me, I think it’s an incredibly complete and amazing framework that has a plethora of features, functions and helpers and I’m by no means implying anything is missing, lacking or in any way incomplete and it’s definitely being maintained… but I am wondering if there are plans or ideas to make it even more awesome in the future with additions, improvements or new features (not that I even know what those would be…)
The core of Nez is fairly complete. I don’t think it will ever be 100% complete, but at this point it’s pretty solid and very flexible. For example: out of the box, the renderer can be used in standard forward rendering, deferred rendering, multi-render target blends and pretty much anything else you would want to do. This was all added with no changes to Nez code.
As for Components to build on the framework itself, there are always more that can be added. Anything that is not game-specific for example would be a good candidate. Most Components are usually game-specific though so they wouldn’t work as building blocks in the engine proper.
For anyone interested, Nez now has a dedicated Discord channel. It’d be awesome to get some participation there to discuss the framework in detail, cover different implementations and problem solutions, show off work, help each other work through problems and discover some of the more “hidden” features and maybe discuss how we as a community might able to help contribute to the project.
Hello, could someone help me fix this problem I posted here ?
Hello, can XMLTemplateMaker write the data to the xml file?
It does exactly the opposite: it reads the XML into a strongly typed object at runtime.
In other words, I can’t use it to save the runtime data. If so, how do I save the data to xml using nez.
The same way you would any C# program: use any of the various XML classes in the .NET framework or a third party XML lib.
Thanks for your reply.
Hello, I have a problem about Nez.UI. I create a entity as my player and I add the CameraFollow to the player.The problem is that when my player moved and the camera followed,but Nez.ui is not working.For example, button.onclick is not working.
I got it. I change the inputpos.The button is working.But I don’t know that if so, are there other bug about nez.ui.
Does NEZ have support a on screen virtual joystick and buttons? I want to create a game for android and I need to draw a buttons and joystick on screen.
I can not find this feature in NEZ.
I don’t want to make a job that already has done by others.
Virtual joysticks and buttons are very game specific features (and not very difficult to make). If you are looking for anything that game-specific Nez isn’t for you. It is a framework meant to be built upon, not just parts you glue together randomly to make a game.
Hey @prime31, fantastic framework from what I’ve seen so far and I’m thinking of moving my current project over!
Can I just ask what would you do if you needed one entity (or entity system) to have access to another entity?
I’m struggling to see how I would write a game where entities wouldn’t need direct access to other entities at some point yet with ECS I don’t see many examples.
Two examples I did see in the Nez Samples was calling a method on the scene to launch missiles or using an Entities access to it’s parent scene as a way to then get access to another entity. Is that the preferred way or should I be looking at design pasterns that avoid this completely?