/defold-scene3d

Scene3D is a collection of scripts, materials and tools to help you to develop 3D games with the Defold game engine.

Primary LanguageLuaMIT LicenseMIT

Scene3D Cover

Scene3D - make 3D games with Defold

Scene3D is a collection of assets to help you developing 3D games with the Defold game engine. Use included prefabs to quickly prototype structures, levels, and to test game mechanics. Try out ideas quickly!

The built-in example scene is available to play online. Controls:

  • WASD to run or drive, SPACE to jump. Mouse to look. 4 to switch between character/car.
  • Special keys: 5 to reload current scene, 6 to load next scene, 0 to toggle photo mode (move the mouse to look, WASD to fly, SPACE to go up, C to go down, M to copy camera settings).
  • In the debug build: 1 to toggle physics debug, 2 to toggle profiler.

Follow further developments:

Key features

  • Car physics.
  • Character controller.
  • Controls: keyboard, mouse look with a pointer lock.
  • Frustum culling (only for 3D meshes).

Included Assets (i.e. Prefabs)

  • Camera. Options: clear color, FOV, near clip, far clip.
    • First-person mouse-look with a pointer lock support.
    • Orbit camera script to follow an object in a third-person view.
  • Directional Light. Options: ambient color, intensity, light direction, fog color, fog range.
  • Chunked Floor. Spawns objects from a factory to make an "infinite" world around an object.
  • Late Update. It calls your scripts after all update functions have been called and physics objects have been moved.
  • Request more or contribute.

Debugging

  • Photo mode: press 0 to capture controls and observe the scene. The mode controls: move the mouse to look, WASD to fly, SPACE to go up, C to go down, M to copy camera settings, Enter to take a screenshot.

Buildings

  • Floor: 1x1, 2x2, 5x5, 10x10.
  • Walls: 0.1x1x3, 0.1x5x3, 0.1x10x3.
  • Blocks: 1x1x1, 3x3x3, 5x5x5.
  • Walls with door frames.
  • Walls with window frames.
  • Stairs 1x1.
  • Ramps 1x1, 3x3, 1x2, 3x6.

Environment

  • Sky: texture mapped on sphere.

Icons

  • Arrow (right), cog, flag, flash, heart, home, key, location, lock closed/open, music, puzzle, spanner, star, tick, video.
  • Letters A-Z, numbers 0-9.

Primitives

  • Cone.
  • Cube.
  • Cylinder.
  • Pyramid.
  • Sphere.
  • Tube.

Props

  • Road cone.
  • Soccerball.

Materials

  • basic_color.material - colors your model + the simplest shading. The mesh should have the "color" stream.
  • basic_grid_*.material - it puts a texture on your objects without having to make UV’s.
  • basic_unlit.material - the simplest possible textured material. sky.material is the same but with a different tag.
  • primitive_*.material - no textures, only applies tint on your model.

Some materials have a tint from the palette: #687378 Nickel, #d9d9d3 Timberwolf, #38b2cb Pacific Blue, #0baaad Verdigris, #94d2bd Middle Blue Green, #e9d8a6 Medium Champagne, #ffcd70 Maximum Yellow Red, #fd905e Atomic Tangerine, #ef766b Salmon, #e2797d Candy Pink.

Included shaders don't apply gamma correction.

Current Status

⚠️ Work in progress ⚠️

  • ✔️ It's suitable for production, but be aware that API, scripts, project structure aren't in a finished state and may be changed.
  • ✔️ If you are making the game with Scene3D, follow the optimization section below before releasing your game.

How To Use

Before You Start

Scene3D uses the metric system, i.e. metres as its default unit for measuring distance/length, i.e. 1 unit is 1 meter.

  • Coordinate system: OpenGL, i.e. a right-handed system - the positive x-axis is to your right, the positive y-axis is up and the positive z-axis is backwards. The forward direction is vmath.vector3(0, 0, -1).

Installation

Use it in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add the link to the ZIP file of a specific release.

Required Dependencies

  • Pointer Lock (only if a project uses mouse_look.script or the debug_camera prefab).

Optional Dependencies

Scene3D can use the following dependencies if you include them in your project:

Included Scenes

  • playground: a playable level with a first-person character controller and a car. Loaded first.
  • basic_3d: use it as a template to start developing a new 3D project/scene.

The game.project Settings

At this moment, Defold supports only Bilinear (Linear Mipmap Nearest) or Trilinear (Linear Mipmap Linear) filtering to apply to textures. Scene3D can enable anisotropic filtering for all textures in the builds for the HTML5 platform:

[scene3d]
anisotropic_filtering = 8

Known Issues

  • Frustum culling uses camera matrices from the previous frame.

Optimization

TODO

... Add information about the over-use of scripts and how to optimize them. ... Add info about shaders optimization, downsizing meshes buffers.

Vote For The Issues

The following issues are critical for the further development of Scene3D. Please put 👍 on them!

Contributing to Scene3D

👍🎉 First off, thanks for taking the time to contribute! 🎉👍

Scene3D tries to follow the principles:

  • Developer-friendly: it should be user-friendly and have a comfortable learning curve to make it a good choice for developers of any experience.
  • Mobile-friendly: it should be able to run on mobile and web platforms.
  • Ready-to-use: the included components should be ready for production.

When creating a bug report, please include as many details as possible. If you find a Closed issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.

Please, follow code formatting style of the project:

Credits

Artsiom Trubchyk (@aglitchman) is the current Scene3D owner within Indiesoft and is responsible for the open source repository.

Contributors

  1. Be the first!

License

The content and sources are licensed under the MIT license.

Third-Party Licenses & Acknowledgements

  • The excellent POLYGON Prototype Pack by Synty inspired a collection of prefabs for mechanics & level prototyping.
  • 3D icons shapes are based on Typicons by Stephen Hutchings, CC BY-SA 4.0 License.
  • Nunito Sans are licensed under the Open Font license.