basic_concepts.rst 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Basic Concepts
  2. ==============
  3. This page describes basic concepts and terminology commonly used when working
  4. with Crown.
  5. .. _project:
  6. Project
  7. -------
  8. A project in Crown is a folder that contains all the resources that describe
  9. your game. Resources are plain-text files (with some exceptions) identified
  10. by their relative path (to the project's root).
  11. You are free to organize resources in a project however you like. However, to
  12. avoid confusion it is recommended to put units in their own folder because
  13. they often consist of multiple files (e.g. a resource for a tree may consist
  14. of a ``tree.unit``, ``tree.material`` and ``tree.lua`` files).
  15. Resource paths and names
  16. ------------------------
  17. All paths in Crown are unix-style (forward slashes). Only canonical/normalized
  18. paths are allowed.
  19. Resources in a project are identified by their relative path to the project's
  20. folder, without extension.
  21. For example, to refer to the unit named "units/player/player.unit" you will
  22. use the string "units/player/player".
  23. Unit and Components
  24. -------------------
  25. Units are the fundamental building blocks in Crown. Units can be used to
  26. represent any object that exists in a game world - a character, a tree, a
  27. vehicle, a light etc.
  28. By default, units are empty. You add functionality to a Unit by adding
  29. Components to it. No component is mandatory, units can be just empty IDs.
  30. Crown includes a number of predefined components, some examples are:
  31. - ``Transform`` - specifies a position, rotation and scale in the world
  32. - ``MeshRenderer`` - draws a 3D mesh
  33. - ``Actor`` - specifies physics properties for a collider, such as mass, filter etc.
  34. - ``Script`` - adds logic via a Lua script
  35. - ``Light``, ``Camera``, ``Fog``, ``Bloom`` etc.
  36. Components can be added or removed at any time in the editor or at runtime.
  37. Units support parent-child relationships, allowing complex hierarchies of
  38. objects to be built from many smaller units (e.g. a car with wheels, body,
  39. lights etc.).
  40. Unit Prefab
  41. -----------
  42. Units can be saved to disk as a *.unit* resource, creating a prefab. Other
  43. units can then reference this prefab, instantly inheriting all of its
  44. components and hierarchy. Changes to a prefab are automatically propagated to
  45. every instance of that prefab.
  46. Unit Prefabs are created by saving existing units inside
  47. the :ref:`level_editor`, or, more commonly, by importing them from
  48. a :ref:`meshes <importing_meshes>` or :ref:`sprites <importing_sprites>`.
  49. World
  50. -----
  51. A World is the runtime container that holds Units and other objects and
  52. advances the game simulation. When a World is running it:
  53. - updates animations/audio/particles;
  54. - steps physics and handles collisions;
  55. - dispatches logic events to script components;
  56. - renders the visible scene;
  57. - etc.
  58. A World can be populated manually via code or automatically by loading Level
  59. resources into it.
  60. A game always has at least one active world. Multiple worlds can exist
  61. simultaneously (for example, one for the main game and one for a UI overlay),
  62. though this is uncommon.
  63. Level
  64. -----
  65. A Level (*.level* resource) is a saved collection of units, sounds and other
  66. objects.
  67. Levels are authored in the :ref:`level_editor`. A world can load any number of levels
  68. at the same time, enabling complex multi-layered scenes.