[OPEN SOURCE] Multiplayer 3D RPG Using Colyseus

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 :frowning:

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.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;
                        case "fair":
                            value = 0.25;
                        case "serious":
                            value = 0.5;
                        case "critical":
                            value = 1;
        return {
            id: name,
            getData: () => value,
            dispose: () => wrapper.dispose(),
1 Like

That works and does remove the error, thanks @Evgeni_Popov I can finally use the performance tab on this computer :slight_smile:

Good news!

So, here’s the PR that will fix the problem in Babylon:


Great, thanks! :slight_smile:

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).

1 Like

So I’ve also managed to use instances with my items (including the ones attached to the player).

  1. load all items in the background on scene load and keep an array available for use later on
  2. 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.
  3. 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

1 Like

Doesn’t matter. I can’t read them anyway :stuck_out_tongue_winking_eye:. I guess I would either remove this possibility or show only one type/category at the time. Of course, my opinion only.

1 Like

Haha :stuck_out_tongue:

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.

1 Like

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 :grin: want ALL the loot (at least I do :smiley:). 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 :thinking: Meanwhile, have a great day :sunglasses:

1 Like

@mawa some good ideas there, thanks for the input :slight_smile:

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.

1 Like

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 :open_mouth:

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
1 Like

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.

  1. added a pickup item animation
  2. spawned entities can now have equipped items too
  3. player will now spawn with the correct texture selected (chosen on player creation)
  4. database is now correctly saving all player data ( I’ve stated that before :slight_smile: )
  5. ability spells now travel correctly on the y axis to the target


Yeah, I hate these kinds of lingering bugs, too :rage: 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 :slight_smile:

@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 :slight_smile: