First Phaser Game (3d version)

Hi,

I just created a 3d version of the first phaser game tutorial.

You can play it here and take a look at the source code here.

Hope you :heart: it!

9 Likes

Good job @yannick !!

Just one point:
Out of curiosity, I was analyzing the game’s performance, to compare 3d vs 2d, and I think there is some kind of memory leak.
I started the game with a JS heap size of 21MB and without doing anything at 20 minutes it was already 253MB. In between, the GC cleared some memory, but not enough.

Regards.

1 Like

Thanks :slight_smile:

Yes you are right. There are many leaks. This is because of ammo.js.

But, I do already know how to fix it and will do it soon.

As I promised, thanks for your exploration …

Appendix: Making Phaser 3D Games!

Refer to the following pioneers who are building 3D Phaser Games.

Just to clarify. From all the examples mentioned above, enable3d.io is the only one using “real” 3d objects and physics.

@yannick : an you make this run @ 60 FPS? I LOVE the 3D being used in Phaser 3, but it is really slow. I use NVidia GeForce 960M.

See post #27 in topic #4610.

Help me to clarify that in my books since this Appendix runs throughout 15 different books on Phaser Gaming Framework.

Neat idea tying this back to the “first” phaser tutorial. This really deserves a good 3d model of Phaser Dude.

1 Like

Great job
please make some video tutorial in udemy
I will buy it, thanks

Thanks @ansonben, please read this post.

Hey @jjcapellan, I almost forgot. I have updated the example. Can you analyze it again and compare it to your old results? Would help a lot! :slight_smile:

I have tested it for 20 minutes. All time, memory between 17MB/52MB. Now there aren’t any memory leaks. Well done!!
Maybe I use your extension enable3d in a chess game, to test it and refresh my knowledge of blender by modeling the pieces. It can definitely be interesting.
Regards.

@yannick : for some reason, not only am I only getting 30 FPS on the character controller example as well as other examples while using my NVidia GeForce 960M, the character is also shaking for some reason.

Glad to hear :smiley:

I’m happy to help if you have questions.

For a chess game you probably won’t need physics. But you will probably need the TweenManager.

Here a snippet that will help you.

// create box
const box = this.third.add.box()

// clone position
let tmp = box.position.clone()

// tween the position
this.tweens.add({
  targets: tmp,
  duration: 1000,
  x: '+=2',
  z: '+=2',
  onUpdate: () => {
    box.position.set(tmp.x, tmp.y, tmp.z)
  }
})
1 Like

You already mentioned that you have issues with your device.

Here some more reasons why it could run buggy.

  • You use a mega ultra high resolution display.
  • You should change or update your browser.
  • You have to many programs running in the background.
  • You have a bitcoin miner or any other malware installed on your system.