Gluon: Difference between revisions

From KDE UserBase Wiki
(Marked this version for translation)
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages />
<translate>
<!--T:32-->
{{Historic}}
<!--T:1-->
==Intro==
==Intro==
<div><br></div>This section gives you a set of documentation for the various parts of Gluon:
<div><br /></div>This section gives you a set of documentation for the various parts of Gluon:


<!--T:2-->
===Gluon Basics===
===Gluon Basics===
<dd>Games built using GluonEngine are all built in the same way. This chapter describes shortly how this works. If you do not already understand how systems based on the GameObject/Component paradigm work, this is where you want to start.</dd>
:Games built using ''GluonEngine'' are all built in the same way. This chapter describes shortly how this works. If you do not already understand how systems based on the GameObject/Component paradigm work, this is where you want to start.


<!--T:3-->
===Introducing Creator===
===Introducing Creator===
<dd>Once you understand the basic layout of a game built with GluonEngine, you are ready to look at Gluon Creator, the tool with which you build the games. This chapter describes the user interface and the workflows of the tool.</dd>
:Once you understand the basic layout of a game built with GluonEngine, you are ready to look at Gluon Creator, the tool with which you build the games. This chapter describes the user interface and the workflows of the tool.


<!--T:4-->
===Creating Games===
===Creating Games===
<dd>Once you have read the two first chapters and feel ready to start building games with Gluon, go right ahead and do so. Should you get stuck at some point and need further help with specifics, this is where you want to look.</dd>
:Once you have read the two first chapters and feel ready to start building games with Gluon, go right ahead and do so. Should you get stuck at some point and need further help with specifics, this is where you want to look.
 
===Using the Libraries===
<dd>This chapter contains the information needed by those who wish to use the libraries directly for building games. GluonInput, GluonAudio and GluonGraphics are presented within.</dd>
 
===Hacking Gluon===
<dd>Contains information needed by the people working on Gluon itself, such as header listings, coding guidelines, internal APIs and the like. If you want to simply use Gluon to build games, this section is irrelevant to you.</dd>
</dl>


==Gluon Basics==
==Gluon Basics== <!--T:5-->


Games built using the Gluon game engine, <em>GluonEngine</em>, are called GameProjects. They consist of a variety of different types of objects, which work together to create a game. The following is a short introduction to how the structure of a GameProject works. You can start working with Gluon Creator without this knowledge, but it will make your life easier if you understand these basic terms, as they are used throughout the rest of the documentation.
<!--T:6-->
:Games built using the Gluon game engine, GluonEngine, are called ''GameProjects''. They consist of a variety of different types of objects, which work together to create a game. The following is a short introduction to how the structure of a GameProject works. You can start working with Gluon Creator without this knowledge, but it will make your life easier if you understand these basic terms, as they are used throughout the rest of the documentation.


<!--T:7-->
===The GameObject Hierarchy===
===The GameObject Hierarchy===
At the top of the Gluon GameObject Hierarchy is the <em>GameProject</em>, which is basically your entire game. A GameProject contains one or more <em>Scenes</em>, which can be anything from a level map or a menu screen. A Scene is composed of one or more GameObjects. A <em>GameObject</em> is a tree of GameObjects or any number of Components. A GameObject represents a functional unit in a scene, like a Car object, which can also be made up of other parts which are GameObjects in themselves (like a rocket backpack or a weapon). <em>Components</em> provide the logic that operates on the GameObject they are attached to. Components can be attached to any number of Assets. <em>Assets</em> simply represent a piece of data stored on disk, like a sound file or an image file.  
:At the top of the Gluon GameObject Hierarchy is the GameProject, which is basically your entire game. A GameProject contains one or more ''Scenes'', which can be anything from a level map or a menu screen. A Scene is composed of one or more GameObjects. A GameObject is a tree of GameObjects or any number of Components. A GameObject represents a functional unit in a scene, like a Car object, which can also be made up of other parts which are GameObjects in themselves (like a rocket backpack or a weapon). ''Components'' provide the logic that operates on the GameObject they are attached to. Components can be attached to any number of Assets. ''Assets'' simply represent a piece of data stored on disk, like a sound file or an image file.  


<!--T:8-->
The GameObject hierachy is made up of instances of GluonEngine::GameObject in a tree structure with a parent-child system, each with any number of GluonEngine::Component instances. The Components provide most of the logic in the game, and since so many are usable in so many places, Gluon would ship with a number of pre-created Components (such as a Camera, Input handlers, MeshRenderer, TextureRenderer and so on).  
The GameObject hierachy is made up of instances of GluonEngine::GameObject in a tree structure with a parent-child system, each with any number of GluonEngine::Component instances. The Components provide most of the logic in the game, and since so many are usable in so many places, Gluon would ship with a number of pre-created Components (such as a Camera, Input handlers, MeshRenderer, TextureRenderer and so on).  


<!--T:9-->
The logic behind creating this system is to enable the game programmer to enforce encapsulation and create reusable components, which can then be applied to numerous GameObjects. It also allows for sane separation of the different types of logic required for each part of a GameObject, thus potentially creating cleaner, more readable code. At the same time, the structure described here would allow for the creation of a graphical tool to manage all of the components' settings. Components are implemented as plugins, making the code even more flexible and separated.  
The logic behind creating this system is to enable the game programmer to enforce encapsulation and create reusable components, which can then be applied to numerous GameObjects. It also allows for sane separation of the different types of logic required for each part of a GameObject, thus potentially creating cleaner, more readable code. At the same time, the structure described here would allow for the creation of a graphical tool to manage all of the components' settings. Components are implemented as plugins, making the code even more flexible and separated.  


<!--T:10-->
===More on Components===
===More on Components===
Components are like properties that you can attach to GameObjects, such as a "render" Component that actually makes the GameObject visible, or a "SoundListener" Component that gives the object the ability to listen to sounds. Components can also be scripts that controls the behaviour of the GameObjects attached to them. All GameObjects in Gluon have their Transform properties built-in, giving the object its position, rotation, and scale (it doesn't make much sense to have an object that doesn't have at least a position). Components do not have Transform properties, but the GameObject to which a Component is attached to does.
Components are like properties that you can attach to GameObjects, such as a "render" Component that actually makes the GameObject visible, or a "SoundListener" Component that gives the object the ability to listen to sounds. Components can also be scripts that controls the behaviour of the GameObjects attached to them. All GameObjects in Gluon have their Transform properties built-in, giving the object its position, rotation, and scale (it doesn't make much sense to have an object that doesn't have at least a position). Components do not have Transform properties, but the GameObject to which a Component is attached to does.


<!--T:11-->
==Introducing Creator==
==Introducing Creator==
[[File:Gluon.png]]
[[File:Gluon.png|600px|thumb]]




<!--T:12-->
In the image to the right you can see Gluon Creator in its default layout, with the Invaders sample loaded. In a rough clock-wise order, the elements of the window are:
In the image to the right you can see Gluon Creator in its default layout, with the Invaders sample loaded. In a rough clock-wise order, the elements of the window are:


====Project====
===Project=== <!--T:13-->
    <dd>This shows all the <em>Assets</em> that you have in your project, such as sounds, textures, scripts and <em>Scenes</em>.</dd>
 
====Components====
<!--T:14-->
    <dd>This is a list of the pre-defined functionality available to you in Gluon Creator. The <em>Components</em> are things like sound emitters and listeners, camera controllers, input handlers and the like.</dd>
:This shows all the Assets that you have in your project, such as sounds, textures, scripts and Scenes.
====View====
 
    <dd>This is the view of your current <em>Scene</em> from the perspective of the camera.</dd>
===Components=== <!--T:15-->
====Scene====
 
    <dd>The contents of the current <em>Scene</em> - in essence your scene graph. </dd>
<!--T:16-->
====Properties====
:This is a list of the pre-defined functionality available to you in Gluon Creator. The Components are things like sound emitters and listeners, camera controllers, input handlers and the like.
    <dd>The place where you can see and manipulate every option on the various <em>Components</em> which are attached to the <em>GameObjects</em> in your game.</dd>
 
====Messages====
===View=== <!--T:17-->
    <dd>This is where debugging messages, errors from scripts and other information from the various <em>Components</em> are shown.</dd>
 
</dl>
<!--T:18-->
:This is the view of your current Scene from the perspective of the camera.
 
===Scene=== <!--T:19-->
 
<!--T:20-->
:The contents of the current Scene - in essence your scene graph.  
 
===Properties=== <!--T:21-->
 
<!--T:22-->
:The place where you can see and manipulate every option on the various Components which are attached to the GameObjects in your game.
 
===Messages=== <!--T:23-->
 
<!--T:24-->
:This is where debugging messages, errors from scripts and other information from the various Components are shown.
 
==Workflow in Gluon Creator== <!--T:25-->


===Basics of Using Gluon Creator===
<!--T:26-->
The work flow of using Gluon Creator to create games is based around the idea that you should be able to use your mouse for as much of the work as possible. As such, adding an Asset to your project is a task done by dragging a file into the Project pane from your file browser (or alternatively by clicking the "Add Asset..." button in the toolbar). It will then be copied to the project folder, and be made available for use in your game.


The work flow of using Gluon Creator to create games is based around the idea that you should be able to use your mouse for as much of the work as possible. As such, adding an <em>Asset</em> to your project is a task done by dragging a file into the <em>Project</em> pane from your file browser (or alternatively by clicking the Add Asset... button in the toolbar). It will then be copied to the project folder, and be made available for use in your game.
<!--T:27-->
To describe a scene in a game, you select the appropriate Scene in the Project view, which causes it to be loaded and shown in the Scene pane, and in the View the camera view will show what the camera sees in the newly loaded scene. You can now edit this scene, by adding and removing GameObject to the Scene, and by adding Components to those GameObjects.


To describe a scene in a game, you select the appropriate <em>Scene</em> in the <em>Project</em> view, which causes it to be loaded and shown in the <em>Scene</em> pane, and in the <em>View</em> the camera view will show what the camera sees in the newly loaded scene. You can now edit this scene, by adding and removing <em>GameObject</em> to the <em>Scene</em>, and by adding <em>Components</em> to those <em>GameObjects</em>.
<!--T:28-->
To add a GameObject to the scene, click on the "Add GameObject" button on the toolbar. This will add a new, empty GameObject to the Scene, and if you have an existing GameObject selected, the new one will be added as a child to the selected one. This allows you, as described in Gluon Basics, to build items for the game based on multiple GameObjects in a hierarchy, which all move along with each other.


To add a <em>GameObject</em> to the scene, click on the Add GameObject button on the toolbar. This will add a new, empty <em>GameObject</em> to the <em>Scene</em>, and if you have an existing <em>GameObject</em> selected, the new one will be added as a child to the selected one. This allows you, as described in Gluon Basics, to build items for the game based on multiple <em>GameObjects</em> in a hierarchy, which all move along with each other.
<!--T:29-->
So that you can change the values for the various Components, selecting a GameObject in the Scene view will make the properties for that object and all the Components on it show up in the Properties view, which is a scrollable, categorized list of all the various properties.


So that you can change the values for the various <em>Components</em>, selecting a <em>GameObject</em> in the <em>Scene</em> view will make the properties for that object and all the <em>Components</em> on it show up in the <em>Properties</em> view, which is a scrollable, categorized list of all the various properties.
<!--T:30-->
One of the functions which will be performed with some regularity from the Properties view is that of setting references to various Assets, for example setting the texture of a ''SpriteRenderer'', or the sound of a ''SoundEmitter''. This is done by clicking on the "..." button in the Properties view and selecting the appropriate item from the list.


One of the functions which will be performed with some regularity from the <em>Properties</em> view is that of setting references to various <em>Assets</em>, for example setting the texture of a SpriteRenderer, or the sound of a SoundEmitter. This is done by clicking on the ... button in the <em>Properties</em> view and selecting the appropriate item from the list.
<!--T:31-->
[[Category:Development]]
</translate>

Latest revision as of 10:13, 13 April 2024

Historic page

This page is of historic interest only. The content of the page is obsolete.


Intro


This section gives you a set of documentation for the various parts of Gluon:

Gluon Basics

Games built using GluonEngine are all built in the same way. This chapter describes shortly how this works. If you do not already understand how systems based on the GameObject/Component paradigm work, this is where you want to start.

Introducing Creator

Once you understand the basic layout of a game built with GluonEngine, you are ready to look at Gluon Creator, the tool with which you build the games. This chapter describes the user interface and the workflows of the tool.

Creating Games

Once you have read the two first chapters and feel ready to start building games with Gluon, go right ahead and do so. Should you get stuck at some point and need further help with specifics, this is where you want to look.

Gluon Basics

Games built using the Gluon game engine, GluonEngine, are called GameProjects. They consist of a variety of different types of objects, which work together to create a game. The following is a short introduction to how the structure of a GameProject works. You can start working with Gluon Creator without this knowledge, but it will make your life easier if you understand these basic terms, as they are used throughout the rest of the documentation.

The GameObject Hierarchy

At the top of the Gluon GameObject Hierarchy is the GameProject, which is basically your entire game. A GameProject contains one or more Scenes, which can be anything from a level map or a menu screen. A Scene is composed of one or more GameObjects. A GameObject is a tree of GameObjects or any number of Components. A GameObject represents a functional unit in a scene, like a Car object, which can also be made up of other parts which are GameObjects in themselves (like a rocket backpack or a weapon). Components provide the logic that operates on the GameObject they are attached to. Components can be attached to any number of Assets. Assets simply represent a piece of data stored on disk, like a sound file or an image file.

The GameObject hierachy is made up of instances of GluonEngine::GameObject in a tree structure with a parent-child system, each with any number of GluonEngine::Component instances. The Components provide most of the logic in the game, and since so many are usable in so many places, Gluon would ship with a number of pre-created Components (such as a Camera, Input handlers, MeshRenderer, TextureRenderer and so on).

The logic behind creating this system is to enable the game programmer to enforce encapsulation and create reusable components, which can then be applied to numerous GameObjects. It also allows for sane separation of the different types of logic required for each part of a GameObject, thus potentially creating cleaner, more readable code. At the same time, the structure described here would allow for the creation of a graphical tool to manage all of the components' settings. Components are implemented as plugins, making the code even more flexible and separated.

More on Components

Components are like properties that you can attach to GameObjects, such as a "render" Component that actually makes the GameObject visible, or a "SoundListener" Component that gives the object the ability to listen to sounds. Components can also be scripts that controls the behaviour of the GameObjects attached to them. All GameObjects in Gluon have their Transform properties built-in, giving the object its position, rotation, and scale (it doesn't make much sense to have an object that doesn't have at least a position). Components do not have Transform properties, but the GameObject to which a Component is attached to does.

Introducing Creator


In the image to the right you can see Gluon Creator in its default layout, with the Invaders sample loaded. In a rough clock-wise order, the elements of the window are:

Project

This shows all the Assets that you have in your project, such as sounds, textures, scripts and Scenes.

Components

This is a list of the pre-defined functionality available to you in Gluon Creator. The Components are things like sound emitters and listeners, camera controllers, input handlers and the like.

View

This is the view of your current Scene from the perspective of the camera.

Scene

The contents of the current Scene - in essence your scene graph.

Properties

The place where you can see and manipulate every option on the various Components which are attached to the GameObjects in your game.

Messages

This is where debugging messages, errors from scripts and other information from the various Components are shown.

Workflow in Gluon Creator

The work flow of using Gluon Creator to create games is based around the idea that you should be able to use your mouse for as much of the work as possible. As such, adding an Asset to your project is a task done by dragging a file into the Project pane from your file browser (or alternatively by clicking the "Add Asset..." button in the toolbar). It will then be copied to the project folder, and be made available for use in your game.

To describe a scene in a game, you select the appropriate Scene in the Project view, which causes it to be loaded and shown in the Scene pane, and in the View the camera view will show what the camera sees in the newly loaded scene. You can now edit this scene, by adding and removing GameObject to the Scene, and by adding Components to those GameObjects.

To add a GameObject to the scene, click on the "Add GameObject" button on the toolbar. This will add a new, empty GameObject to the Scene, and if you have an existing GameObject selected, the new one will be added as a child to the selected one. This allows you, as described in Gluon Basics, to build items for the game based on multiple GameObjects in a hierarchy, which all move along with each other.

So that you can change the values for the various Components, selecting a GameObject in the Scene view will make the properties for that object and all the Components on it show up in the Properties view, which is a scrollable, categorized list of all the various properties.

One of the functions which will be performed with some regularity from the Properties view is that of setting references to various Assets, for example setting the texture of a SpriteRenderer, or the sound of a SoundEmitter. This is done by clicking on the "..." button in the Properties view and selecting the appropriate item from the list.