Sure, I’ve added the inspector to the demo: https://t5c.onrender.com is that enough?
I’m not sure how to open it?
You can use CTRL + SHIFT + ALT + I to open inspector.
EDIT: ok forget it, it only does it on a specific computer… must be some sort of system thing, sorry for wasting your time
I don’t reproduce on my side…
Shot in the dark: can you try to put this code in your project and see if that fixes it?
BABYLON.PerfCollectionStrategy._PressureStrategy = function(name, factor) {
factor = factor ?? null;
return () => {
let value = 0;
const wrapper = new BABYLON.PressureObserverWrapper();
wrapper.observe("cpu");
wrapper.onPressureChanged.add((update) => {
for (const record of update) {
if ((factor && record.factors.includes(factor)) || (!factor && (record.factors?.length ?? 0) === 0)) {
// Let s consider each step being 25% of the total pressure.
switch (record.state) {
case "nominal":
value = 0;
break;
case "fair":
value = 0.25;
break;
case "serious":
value = 0.5;
break;
case "critical":
value = 1;
break;
}
}
}
});
return {
id: name,
getData: () => value,
dispose: () => wrapper.dispose(),
};
};
}
That works and does remove the error, thanks @Evgeni_Popov I can finally use the performance tab on this computer
Good news!
So, here’s the PR that will fix the problem in Babylon:
Great, thanks!
I have finally got the click to move working seamlessly with the standard movement (turns out it was much harder to implement than it looks like).
So I’ve also managed to use instances with my items (including the ones attached to the player).
- load all items in the background on scene load and keep an array available for use later on
- add an action manager to each item, on hover, hide the instance mesh, create a clone with an overlay color, and on hover out, delete clone, and dehide instance.
- It’s not perfect, as if I hover out too quickly, the hover event never actually triggers, but the performance is amazing.
Over 2000+ items
Showing the items label does bring dowm the FPS by 30+ but that’s understandable
Doesn’t matter. I can’t read them anyway . I guess I would either remove this possibility or show only one type/category at the time. Of course, my opinion only.
Haha
I was thinking to only display only the item label in a radius around a player, also that radius could be smaller the more items are in the map. Not sure how expensive this would be however.
I believe it would be better to select from category. IE: melee weapons, ranged weapons, ammo, gold, armor, amulets, etc… Usually, the player might be looking for a specific type of item. Although indeed, I guess we players/addicts want ALL the loot (at least I do
). But the highlight from category makes sense to me. I saw it in a variety of RPGs. Recently replayed Gothic II. There’s an amulet called ‘the will of Wisps’ which you can train to find items from a given category. Food for thoughts may be
Meanwhile, have a great day
@mawa some good ideas there, thanks for the input
On the project side, After a week of work, I’ve just completed (another one) full refactoring to better decouple the server and the client. Additionally, all the game data (abilities, items, etc…) is now all coming direct from the server api, so in the future, it would be very easy to put all that info into a database instead of the current json structure.
All this data must then be fed to all the client classes, so I had to create a gameController to hold all this data including player data (like user data, character data, etc…) and allow it to to pass down to every relevant children class without making it too messy.
I also tidied up all the types into one types.ts file so it can be easily access and updated when needed (only when a type could be used by multiple classes, else I just left it in the relevant class).
I’m quite happy with the current result, I know refactoring is boring stuff, but it is critical to keep a project tidy.
I’m getting a small issue on my clone item materials…
It looks like once the camera come into view with the same cloned item, it shows the equipped one black? And it reverts to normal once out of view. Weird thing is it doesnt do it for the items on the ground though.
All the items (equipped and on the ground) are a clone ( using the mesh.clone() ) from a pre-instantiated & merged item.
I’m sure I’ll solve it eventually, but just in case it is something obvious?
I’ve added the inspector to the demo link if that can help ( CTRL + ALT + SHIFT + I to open it)
Video of the issue:
I can see black items (swords, shields) on the ground
I noticed one thing: I sampled the player helmet. It has a multi-material attached. Does the bug occur if you make it a single material? I remember having lots of visual glitches with multi-materials which went away when switching to single ones.
Other than that I have seen black /darkened meshes if sth was wrong with
- wrong UV slot (see Texture.coordinatesIndex or so)
- messed up UVs
- flipped normals
I agree the multimaterial might be worth exploring further.
@oriongu Might also be that there’s something with whatever performance improvement you implemented. I would check on freeze and block dirty. If implemented, try remove it to check if the problem remains.
@mawa thanks, i’ve removed my basic LOD I added, no difference
@Joe_Kerr thanks, i’ve tried creating a standard material and applying to all my items, but it still flickers from black to normal sometimes:
let texture = this._scene.getTextureByName("knight_texture (Base Color)");
let material = new StandardMaterial(k);
material.diffuseTexture = texture;
material.backFaceCulling = false;
mergedMesh.material = material;
Hi all,
Still have not manage to resolve that black item issue, and put that to the side for the moment.
- added a pickup item animation
- spawned entities can now have equipped items too
- player will now spawn with the correct texture selected (chosen on player creation)
- database is now correctly saving all player data ( I’ve stated that before
)
- ability spells now travel correctly on the y axis to the target
Yeah, I hate these kinds of lingering bugs, too Only other thing I can think of: Do you set Texture.level somewhere? If it is zero (or maybe nan, null, undefined), the mesh will become black. (https://playground.babylonjs.com/#WLDCUC#213)
If you have a repro of the black item issue I can try to have a look
@Joe_Kerr Thanks, yes, they’re painful especially when you cannot reproduce the error 100%. anyway I’m sure it’s a simple thing in the end. It’s like I just fixed another lingering issue, movement was stuttering on my online demo, turns out my movement was fine, it’s to do with the camera trying to keep up with the movement that was causing the stutter, tricky
@sebavan Thanks, but I cannot reproduce the error, so do not know how to make the repro. If I disable the equipping mesh function (https://github.com/orion3dgames/t5c/blob/main/src/client/Entities/Entity/EntityMesh.ts line 224-268) it seems like the issue disappears but I do not think it is the root of the problem.
I’ll take a break and get back to it later