Defold 3D playground sample

Hi!

It’s a giving time and we have a little present for you: :wrapped_gift: a 3D third person playground sample where you can go around, collect gold and store it - it comes with a character controller, physics, virtual gamepad, and shadow mapping!

The credit goes to @sergeysinyavsky for preparing this example and Kay, Kenney and Mesh2Motion for the assets! :orange_heart:

P.S. We will add a little bit of a manual/documentation for it and it will be added to the Samples in Defold welcome screen in the next release (after 1.12.0).

31 Likes

Wow, that’s an Amazing Super Asset for the community! Merry Christmas and Happy New Year!!! :christmas_tree: :heart:

2 Likes

That is awesome

1 Like

This looks great! I can’t wait to try it out.

1 Like

It’s a very simple example, but it’s for a good start - we will be adding more and more such tiny samples in the next year :wink:

2 Likes

Would it be possible to upload an html build and link to it from the repo? I think it would be cool to be able to quickly try out the examples.

7 Likes

Thanks, like the style. Perfect to learn

2 Likes

You’re right! Here we go:

1 Like

Awesome! It runs very smoothly on my phone.

All of the objects are kinda jittery where they meet the ground though, when you move around. As if the objects and the ground are fighting over which one should be visible.

Edit: actually it’s not just near the ground. Check this video. The plants, the strap on the wood, the bottom of the rock, etc, are all jittery.

Try testing increasing the precision in the shaders? highp instead of lowp/medp you can see high versions of the shaders in the materials folder of the repo.

This is additionally available from 1.12.2 in the Editor:

7 Likes

I love the example. It have almost everything I need for my new game prototype. However for some reason it does not render properly with Defold 1.12.3 (works correctly with Defold 1.12.1 and 1.12.2!).

I described this in details with screenshots here: Graphics are broken in Defold 1.12.3 · Issue #4 · defold/sample-third-person-playground · GitHub

Do you have any idea what may be the issue and how to resolve it?

1 Like

No idea now :confused: We’ll take a look!

1 Like

There looks to have been a tweak to 1.12.3, which probably fixes this (normals messed up by the look of it). Download 1.12.3 again to get 0ad9c86

2 Likes

You are right! It works with most recent version of 1.12.3, many thanks!

1 Like

The sample is now updated and we’ve:

  • :video_game: added gamepad support
  • :joystick: added new controls mode, and current steering mode is changed to the new “screen-fixed”, which means clicking up always get the character to the top side of the screen, etc. - in opposite to the previous mode that was used e.g. in old RE games, “tank-like”, where moving up moved the character forward to its direction (you can still use it by setting the go.property is_controls_screen_fixed to false).
  • :musical_notes: added audio (sounds for picking and depositing items, collisions with balls and barrels and footstep sounds with an audio Lua module)
  • :bust_in_silhouette: improved shadowmapping (refactoring code, local instancing, larger shadow buffer for high tier, reduced draw calls, removed color buffer during depth pass for shadows)
  • :broom: refactored shadowmapping.lua module to not use anymore deprecated APIs and constants that will be removed in the Defold 1.13.0
  • :scroll: enhanced documentation explaining the project structure and how it works, including shadowmapping description
12 Likes

Great job Paweł and others involved!

I was really impressed by the README, I also really liked the new control scheme and sounds, but honestly, the biggest difference for me is performance. I had no issues with the previous version, but just out of curiosity I compared both version’s FPS with Vsync off for and I’m blown away!

Previous version:

  • HIGH: 130
  • MID: 220
  • LOW: ~1450

New version:

  • HIGH: 1190
  • MID: 1260
  • LOW: ~1500 - 1600

and after my tweaks:

  • VERY HIGH: 1180 – Just 4k shadow buffer :wink: 8k does not improve quality, but starts to affect FPS.
  • ULTRA: 850 – 4k shadow buffer and 5x5 diffuse kernel.

Soooo… On high settings, new version not only works literally almost 10x faster but also looks better (prev. version had 1k buffer in high). Excellent job! I will include it in my game ASAP :smiley: Many thanks!

I observed only one issue, had it too with previous version… on my Ubuntu virtual machine ground shadows seems to not work (but you can see shadows on planks) and character is not animated).

Edit: After including new rendering to my proto, my FPS went up by factor of 2 (when running 2 instances, one in VM, so large overhead) and by factor of 6 when running just 1 instance natively!
Also problems were caused by Virtual Machine - everything works fine on old laptop with Debian.

4 Likes

I’m very happy that it’s helpful in you game!

Utilising instancing and cleaning materials allowed to reduce draw calls from over 100 to 29 on mid/high, and 17 on low with shadows off (afaik this includes 1 draw call for profiler ui drawing)

Yeah, in PC games you can safely double the size of the textures, I took into account also mobile and web games, and all other settings regarding shadows can be adjusted arbitrarly.

I’m developing on Ubuntu 24.04 (and testing also sometimes on Windows 10) and everything works there. I know there were some issues in the past, especially regarding animations, but those are now fixed for Linux, so might be something specific for the VM.

4 Likes