Space Shooter in Godot 4 - part 1 (introduction)

FencerDevLog
1 Sept 202325:31

Summary

TLDRIn this video course, Philip guides viewers through designing and developing a space shooter game using Cuddle Engine, showcasing techniques valuable for various game projects. Key tools like Godot Engine, Blender, and Material Maker are introduced, all available for free. The course begins with setting up the game environment, creating scenes, and implementing a debug overlay for performance monitoring. It emphasizes creating assets from scratch, ensuring a comprehensive understanding of game development.

Takeaways

  • ๐Ÿš€ The video course is designed to teach how to design and develop a space shooter game in Godot Engine.
  • ๐Ÿ› ๏ธ All the necessary tools for the project are available for free, eliminating the need for any licensing fees.
  • ๐Ÿ“š The Godot Engine is central to the project, with the course using version 4.1.1 for consistency.
  • ๐ŸŽจ Blender is used to create low-polygon models for the game, with the course referencing version 3.6.1.
  • ๐ŸŽญ Material Maker is introduced as a free tool for assigning materials to game assets, streamlining the process.
  • ๐Ÿ’ป The course starts from scratch, creating everything from the ground up with detailed explanations for each step.
  • ๐Ÿ” Godot's project manager window is used to create and manage new projects, setting up the workspace for game development.
  • ๐Ÿ–ผ๏ธ The importance of setting up global settings in Godot for different display sizes and resolutions is emphasized.
  • ๐Ÿ“ A 3D scene is created with a root node, and additional sub-nodes for light source and camera are added for game setup.
  • ๐Ÿ›‘ A debug overlay is implemented to monitor game performance and vital aspects like FPS and draw calls.
  • ๐Ÿ”ง An Autoload script is created for utility functions, such as checking if a node is valid, to be used across the project.

Q & A

  • What is the purpose of the video course created by Philip?

    -The purpose of the video course is to demonstrate how to design and develop an organ in Cuddle Engine, specifically a space shooter game with 3D models, showcasing various techniques and skills that can be valuable in many other game projects.

  • What are the tools mentioned in the script that are required for the course?

    -The tools mentioned are Godot Engine for game logic, Blender for creating 3D models, and Material Maker for assigning materials to assets. All these tools are available for free, eliminating the need for licensing fees.

  • Which version of Godot Engine is recommended for following the course?

    -The recommended version of Godot Engine at the time of recording the video is 4.1.1, as the scripts developed in the course may not work with earlier versions.

  • What is the role of Blender in the video course?

    -Blender is used to create visually appealing low-polygon models for the game. The course is based on Blender version 3.6.1, but any recent version is likely to be suitable due to the focus on basic operations.

  • What is Material Maker and how is it used in the course?

    -Material Maker is a free tool powered by the Godot Engine used to assign visually appealing materials to game assets. It streamlines the process of preparing game models, with the latest version at the time being 1.3.

  • What is the first step in setting up the game project in Godot?

    -The first step is to open Godot and create a new project, keeping all parameters with their default values since it's a desktop game, and selecting a new folder to create the project in.

  • Why is it important to set up global settings in Godot before starting the game development?

    -Setting up global settings is crucial to ensure compatibility with different display sizes and resolutions, to avoid issues such as distorted texts and visual artifacts in the game.

  • What is the significance of using a 'debug overlay' in the game development process?

    -A debug overlay is significant as it allows developers to monitor vital aspects of the game such as frame rate, draw calls, and other performance metrics, providing valuable insights during the development process.

  • How is the 'utils' script used in the course?

    -The 'utils' script is an autoload script that contains utility functions, such as 'is_valid_node', which can be called from any other script in the project to check if a node is valid and not null.

  • What is the purpose of the 'autoload' folder in the Godot project structure?

    -The 'autoload' folder is used to store scripts that are automatically loaded into the project, making their functions globally accessible without the need to instantiate them in every scene.

  • What is the recommended approach for handling player data in the debug overlay?

    -The recommended approach is to first check if the player object is valid using the 'utils.is_valid_node' function before accessing its properties like global position and rotation to avoid errors.

Outlines

00:00

๐Ÿš€ Introduction to Game Development with Cuddle Engine

In this introductory paragraph, Philip welcomes viewers to a video course focused on designing and developing a space shooter game using Cuddle Engine. He emphasizes the use of 3D models and the applicability of the skills learned to other game projects. The tools required for the course are mentioned, including Godot Engine, Blender, and Material Maker, all of which are free of charge. The Godot version 4.1.1 is specified for consistency with the course content. The tutorial begins with creating a new project in Godot and setting up the project manager window.

05:00

๐Ÿ›  Setting Up the Game Environment and Global Settings

The second paragraph details the initial setup of the game environment in Godot, including the creation of a new project folder named 'shooter' and the configuration of global settings to accommodate different display resolutions. The stretch mode is set to Canvas items with an aspect ratio set to expand, ensuring sharp 2D elements. The option to resize the game window is disabled, and the viewport size is adjusted to 1600x900. The first scene is created with a 3D scene as the root node, which is then renamed to 'main root' for better description.

10:01

๐Ÿ”† Configuring Light and Camera for a Top-Down Perspective

In this paragraph, the focus shifts to setting up the lighting and camera for the game's top-down perspective. A directional light is added and positioned above the game plane with specific rotation values to ensure uniform illumination. The camera is set to an orthogonal projection initially but then changed to a perspective projection to leverage 3D effects, with the field of view reduced to 30 degrees to prevent distortion. The camera's position and rotation are also configured to align with the game's viewpoint.

15:01

๐Ÿ“ Organizing Assets and Preparing the Debug Overlay

The fourth paragraph discusses the organization of game assets through the creation of folders for models, materials, scenes, and fonts. It then proceeds to describe the creation of a debug overlay using a new scene with a Label node, which will display vital game information such as frame rate and memory usage. A custom font is imported for consistency across platforms, and a script is attached to the debug label to control its activation and display of game data.

20:02

๐Ÿ’ป Scripting the Debug Overlay and Player Data Monitoring

This paragraph delves into the scripting process for the debug overlay, explaining how to monitor and display game performance metrics such as frames per second, draw calls, frame time, and video RAM usage. It also outlines the preparation for player data monitoring, with placeholders for the player's position and rotation. A utility function is created in an 'autoload' script to check the validity of nodes, ensuring that player data is only accessed if the player object is valid.

25:05

๐Ÿ”„ Finalizing the Debug Overlay and Unit Conversion

The final paragraph wraps up the creation of the debug overlay by addressing the need to convert video RAM usage from bytes to megabytes for readability. It also emphasizes the importance of checking the validity of the player object before accessing its properties to avoid errors. The paragraph concludes with the integration of the 'utils' script for node validation and the final positioning of the debug overlay in the game's user interface.

Mindmap

Keywords

๐Ÿ’กCuddle Engine

Cuddle Engine is not explicitly mentioned in the script, so it seems to be a typographical error. The correct term is likely 'Godot Engine', which is an open-source game development engine designed to create 2D and 3D games. In the video's context, it's the core tool used for designing and developing the space shooter game. The script mentions setting up Godot Engine to create game logic, indicating its central role in the game development process.

๐Ÿ’กSpace Shooter

A space shooter is a genre of video games where players control a spacecraft and engage in combat with enemies. In the script, the space shooter serves as the project example for demonstrating various design and development techniques. The video course aims to guide viewers through creating a 3D space shooter game, showcasing the process from start to finish.

๐Ÿ’ก3D Models

3D models refer to three-dimensional representations of objects or characters used in video games and other graphics applications. In the video script, 3D models are mentioned as an integral part of creating the space shooter game. The course will use Blender, a free 3D modeling software, to craft low-polygon models that are optimized for performance and aesthetics in the game.

๐Ÿ’กBlender

Blender is a free and open-source 3D creation suite that supports the modeling, rigging, animation, simulation, rendering, compositing, and motion tracking of 3D models. In the context of the video, Blender is utilized to create visually appealing low-polygon models for the game, highlighting its role in the asset creation process.

๐Ÿ’กMaterial Maker

Material Maker is a free tool designed to create materials for 3D models that can be used in Godot Engine. It streamlines the process of preparing game models by allowing users to assign visually appealing materials to their assets. In the script, Material Maker is mentioned as an essential tool for enhancing the aesthetics of the game's 3D models.

๐Ÿ’กGame Logic

Game logic refers to the rules and mechanics that govern how a game functions, including how objects interact within the game world. In the video script, developing game logic in Godot Engine is a primary focus, as it is crucial for creating the gameplay mechanics of the space shooter.

๐Ÿ’กGlobal Settings

Global settings in Godot Engine are used to configure various project-wide parameters such as window size, stretch mode, and other display settings. In the script, setting up global settings is emphasized as an important step to ensure that the game displays correctly on different screen sizes and resolutions.

๐Ÿ’กDebug Overlay

A debug overlay is a feature in game development that provides developers with real-time information about the game's performance, such as frames per second (FPS) and memory usage. In the video, creating a debug overlay is discussed as a way to monitor vital aspects of the game during development, which is essential for optimizing performance.

๐Ÿ’กPerspective Camera

A perspective camera is a type of camera used in 3D graphics that mimics the way human eyes perceive depth, creating a sense of three-dimensionality. In the script, a perspective camera is chosen for the space shooter game to allow for a more immersive and visually interesting gameplay experience.

๐Ÿ’กAutoload

In Godot Engine, autoload is a feature that allows certain scripts to be automatically loaded and available throughout the game without needing to be explicitly referenced. In the video script, an 'autoload' script named 'utils.gd' is created to hold utility functions, making them accessible from any script in the project.

๐Ÿ’กVersion Control

Version control is a system that records changes to a file or set of files over time so that developers can track and revert changes if necessary. While the script mentions creating a repository on GitHub, which is a platform for version control, the focus of the video course is strictly on game development, and thus version control steps are skipped.

Highlights

Introduction to the video course on designing and developing an organ in Cuddle Engine with 3D models for a space shooter game.

All the necessary tools for the course are available for free, eliminating the need for licensing fees.

Godot Engine 4.1.1 is the core for developing game logic, ensuring compatibility with the course scripts.

Blender 3.6.1 is used for creating low-polygon models, with basic operations applicable across various versions.

Material Maker 1.3 is introduced for assigning materials to game assets, streamlining the preparation process.

The course starts from scratch, creating everything from the ground up without pre-existing assets.

Setting up a new Godot project with default parameters for a desktop game.

Configuring global settings in Godot for different display sizes and resolutions.

Creating the first scene in Godot with a 3D scene root node.

Setting up a directional light and camera for the space shooter game's top-down perspective.

Establishing a debug overlay for monitoring game performance and vital aspects during development.

Creating a new scene for the debug overlay using a Label node.

Importing a custom font for consistency across different platforms instead of using system fonts.

Scripting the debug overlay to display FPS, draw calls, frame time, and allocated video RAM.

Creating an autoload script for utility functions accessible throughout the project.

Implementing a function to check if a node is valid before accessing its properties to avoid errors.

Adjusting the display of video RAM from bytes to megabytes for better readability.

Positioning the debug overlay at the bottom left of the game view for easy access to information.

Transcripts

play00:01

hello everybody and welcome my name is

play00:04

Philip and I created this video course

play00:06

to demonstrate how you can easily design

play00:09

and develop your organ in cuddle engine

play00:12

we'll be crafting a space shooter with

play00:14

3D models which is a great example to

play00:16

Showcase a plenty of techniques and

play00:18

tricks

play00:19

in fact these skills can be valuable in

play00:22

many other game projects as well

play00:25

let's get started

play00:27

[Music]

play00:39

I prefer to avoid lengthy introductions

play00:41

so allow me to briefly outline the

play00:43

necessary tools we'll be working with

play00:46

the best part is that all these tools

play00:49

are available for free there is no need

play00:51

for any licensing fees which means we

play00:53

can start working without any initial

play00:55

investment

play00:57

first go to four

play01:00

the Godot engine is a heart of our

play01:02

project and we will develop all the game

play01:04

logic in it

play01:05

to like the stable version at the time

play01:07

of recording this video was got over

play01:10

4.1.1

play01:12

please ensure you have the correct

play01:14

version of Godot to follow this course

play01:16

as the scripts we will develop wouldn't

play01:19

work with earlier merchants

play01:23

second blender

play01:25

I will demonstrate how we can utilize

play01:27

blender to create nice looking low

play01:29

polygon models for your game currently

play01:31

I'm working with blender version of

play01:33

3.6.1 and since we'll primary focus on

play01:37

basic operations in Wonder it's likely

play01:40

that any three-point X version would be

play01:43

suitable

play01:44

and third material maker

play01:48

we'll need to assign nice looking

play01:49

materials to our assets

play01:51

and material maker is just the right

play01:53

tool to achieve that

play01:55

it's a free tool powered by the codo

play01:57

engine and it proves to be incredibly

play02:00

valuable in streamlining the process of

play02:02

preparing game models currently the

play02:04

latest version available is 1.3

play02:09

and that's it no additional

play02:12

installations are required to follow the

play02:13

along with this tutorial

play02:16

I've included download links in the

play02:19

video description ensuring a similar's

play02:21

preparation of your local environment

play02:24

so if you are all set we can dive right

play02:27

into working on the game

play02:30

let me show you again what we will start

play02:32

with

play02:35

go

play02:37

blender

play02:39

and material maker

play02:43

and what we will end with

play02:46

[Music]

play03:05

thank you

play03:06

[Music]

play03:12

[Music]

play03:23

[Music]

play03:34

thank you

play03:53

[Music]

play03:58

just to remind we're starting this

play04:00

project from scratch with no

play04:02

pre-existing assets textures or code our

play04:05

approach involves creating everything

play04:06

from the ground up and I'll make sure to

play04:09

provide detail explanations for each

play04:11

step of the process

play04:14

our first step is to open Godot and

play04:16

create a new project if you read my book

play04:19

you know that I usually start with

play04:21

creating a repository on GitHub I'm

play04:23

calling it on my local environment

play04:26

however the video course is strictly

play04:28

about the game development so I will

play04:30

skip the step related to a Version

play04:32

Control

play04:33

and in this video series we will only

play04:36

work locally

play04:40

okay let me switch to my working

play04:44

environment and I'll start cuddle

play04:47

on the startup godo displays the project

play04:49

manager window you can see that I

play04:52

already have several projects here most

play04:54

of them are games I'm currently working

play04:56

on we just click here to create a new

play04:59

project

play05:00

we can keep all parameters with their

play05:02

default values because we'll be working

play05:04

on a desktop game so I'll only select a

play05:07

new folder to create a project

play05:10

okay

play05:12

where it is here and control

play05:16

fine and let's give it a name

play05:19

shooter

play05:21

good create folder and create an edit

play05:25

and go to environment opened this is a

play05:29

blank project nothing is there yet every

play05:32

other project is different by one or

play05:34

more scenes so we need to create the

play05:36

first scene and since we are working

play05:39

with 3D models and operations our choice

play05:41

is the 3D scene

play05:44

but before we create a scene there is

play05:47

one more important step to take let's

play05:49

set up the global settings it's here in

play05:52

project project settings

play05:56

as we know people who will play our game

play05:58

usually have displays with different

play06:01

sizes and resolutions so it's crucial to

play06:04

be ready for that I personally faced

play06:07

plenty of problems before my own game

play06:09

started displaying everything as I

play06:11

wished I remember that the biggest issue

play06:13

was with 2D labels and the assigned

play06:16

fonts as The Wrong settings resulted in

play06:19

distorted texts that looked bad and were

play06:22

difficult to read

play06:23

So to avoid such a situation let's set

play06:26

this here in the stretch section we'll

play06:29

set stretch mode to Canvas items

play06:32

and the aspect should be set to expand

play06:36

this will ensure that our 2D elements

play06:38

will always be sharp and without any

play06:40

visual artifacts

play06:42

I also recommend disabling the option

play06:45

for players to resize the game's seed

play06:48

screen unless you specifically decided

play06:50

functionality later we will introduce a

play06:54

feature to modify the window size within

play06:56

the game now we uncheck this

play06:59

checkbox

play07:01

and the game window won't be resizable

play07:03

anymore

play07:05

and one last thing let's adjust the

play07:07

viewport size to

play07:09

1 6 0 0 by 900.

play07:15

it fits nicely within my laptop display

play07:18

with full HD resolution good we can

play07:22

proceed with creating the first scene

play07:25

let's do it by specifying its root note

play07:27

and we will which we will set to 3D

play07:31

scene there it is it's always a good

play07:34

idea to rename it to something more

play07:36

descriptive so let's click it

play07:39

and give it some

play07:42

better name for example main root

play07:46

okay

play07:54

we save the scene either by pressing

play07:57

Ctrl s or in the scene menu here save

play08:00

scene and give it Main tscn

play08:05

okay we have the scene but it's

play08:08

completely empty there is nothing in it

play08:10

we'll start with adding two more

play08:13

important sub nodes the light source and

play08:15

a camera

play08:17

fertilized swords we choose a

play08:19

directional light 3D as we need at least

play08:22

at this stage to have all the game

play08:24

objects equally illuminated let's right

play08:27

click the root note and add a child node

play08:29

of the type

play08:31

directional light 3D

play08:34

cool okay done

play08:37

now we need to configure it as you know

play08:40

we are working on a space shooter and

play08:42

all its objects will be observed from

play08:44

the top down perspective which means

play08:46

that the globe light source should be

play08:48

located above the exact plane

play08:51

let's click the node to open it in the

play08:54

inspector there it is

play08:56

and set the values of the position and

play08:59

rotation properties they are located

play09:01

here in the transform section so the

play09:04

position of Y should be to 25

play09:09

now it's above the above the exit plane

play09:12

and the rotation we will rotate it to

play09:15

negative 90. to point light source

play09:19

directly at the plane

play09:22

we will use the same approach to

play09:24

configure the camera let's add it to the

play09:26

scene first

play09:28

okay child node and Camera 3D

play09:32

good

play09:34

now what kind of camera do we need there

play09:37

are basically two options

play09:39

they are set here in the projection

play09:41

first of them order orthogonal we will

play09:45

choose it to assemble a traditional 2D

play09:47

game with no depth perception that would

play09:49

be perfectly fine and sufficient to

play09:51

create a playable nice looking game

play09:55

however

play09:56

I would like to leverage certain 3D

play09:58

effects in this project so we better

play10:00

select the second option which is

play10:02

perspective

play10:03

with this camera object will be objects

play10:06

will be perceived from slightly varied

play10:08

angles and the visual scale will be

play10:10

influenced by the y-coordinate

play10:13

furthermore the space can be distorted

play10:16

at the edges and corners

play10:18

of the viewport so it's important to

play10:20

reduce the field of view to mitigate

play10:22

that

play10:24

let's do it here fov field of view will

play10:27

set to 30 degrees

play10:30

and again we need to change the position

play10:33

we'll set it above the exit plane

play10:36

to 130

play10:40

and rotation just like with the light

play10:43

source negative 90.

play10:47

good finally let's prepare several

play10:50

folders to keep various assets

play10:53

and may all project better organized we

play10:56

will right click here in file system the

play11:00

root note

play11:01

and create a new folder

play11:04

uh modals

play11:10

materials

play11:16

scenes

play11:19

and for instance

play11:21

fonts

play11:24

good job

play11:25

let's execute the project

play11:28

and it seems we didn't set the main

play11:31

scene yet so we'll do it now go to

play11:34

already offered us to select the current

play11:35

one let's do it

play11:38

and the game opened of course there is

play11:42

nothing to see but at least the game

play11:44

started now it's a good moment to add

play11:47

more elements to the scene

play11:51

the initial element we will introduce to

play11:53

our 3D scene is in fact a 2d object why

play11:56

is that the reason is that we want to

play11:59

establish a debug overlay which would be

play12:02

always on top and allows us to monitor

play12:04

vital aspects of the game such as

play12:06

creation and deletion of significant

play12:08

objects fluctuations in frames per

play12:11

second which is closely related to the

play12:14

game performance and so on

play12:17

this debug overlay will provide

play12:19

extremely valuable during the

play12:21

development process

play12:22

so let's create a new scene here in the

play12:26

file system panel right click the scenes

play12:29

folder create new and scene and for the

play12:33

root type we'll choose the last option

play12:35

node click the node selector and find

play12:39

label

play12:41

okay because we'll display only text

play12:45

let's give it a name debug and ok

play12:50

great the scene was created now we want

play12:54

to attach a script to it this can be

play12:56

done in two ways first we right click

play13:00

the node and select anti-script or we

play13:03

can just click this icon next to the

play13:05

search bar and use the same

play13:08

functionality it's already prefilled as

play13:10

debug GD let's use it and create the

play13:14

script open so we can verify that it

play13:16

extends label which is exactly what we

play13:19

wanted

play13:21

now we will display text which means we

play13:23

must use some font

play13:25

actually go to uses system fonts by

play13:28

default but I don't recommend do that

play13:31

because fonts could be different on

play13:33

various platforms so let's instead

play13:37

download and import a custom font this

play13:40

can be done uh for example from the site

play13:45

phones google.com which contains

play13:47

thousands of free fonts to use so I

play13:51

already downloaded one suitable font I

play13:54

have it prepared here let me drag and

play13:58

drop this file into the fonts folder and

play14:03

here it is the font was imported let's

play14:06

select the root node again scroll down

play14:10

to theme overrides Here we can open

play14:13

fonts and drag the font to the property

play14:16

to use it and we will

play14:20

set the font size to 24 pixels

play14:24

okay this should be prepared

play14:28

now it's time to implement the script we

play14:32

don't need the function ready which was

play14:34

pre-generated from template let's delete

play14:36

it

play14:37

and we will need a switch to activate or

play14:43

deactivate this debug label because we

play14:45

don't want to use it once the game is

play14:47

finished let's add a variable

play14:50

export

play14:55

and give it the default value true

play14:58

this uh prefix this annotation export

play15:01

means that the variable will be added to

play15:04

the inspector and can be easily we can

play15:07

easily change its value here without

play15:09

modifying the script

play15:11

now we will need some values to display

play15:15

let's prepare the variables

play15:42

okay the first four variables

play15:45

are related to values we want to monitor

play15:48

on each frame the last one player this

play15:51

is just a placeholder because we don't

play15:53

have a player object yet but we will

play15:56

want to see some data related to

play16:00

playership here in the debug overlay for

play16:03

example its current position rotation

play16:05

and

play16:07

Etc so we will just make it ready here

play16:10

and prepare the function to

play16:14

initialize it later

play16:28

okay now we finally need to fill the

play16:34

text property of this label to display

play16:35

something so we will start with

play16:39

verifying if the overlay is

play16:42

um is active or not

play16:53

so there will be nothing displayed

play16:56

and now let's fill the variables

play17:00

we will use

play17:02

sorry we will use built-in functions

play17:08

as godo makes it easy for us

play17:11

frames per second

play17:14

then draw calls

play17:17

would be filled from

play17:20

rendering server and there is some

play17:24

method get rendering info

play17:30

here and I think it is total draw calls

play17:36

in frame

play17:37

there this long constant

play17:42

the next one is frame time

play17:48

which is actually Delta because

play17:53

Delta again is prefilled by Godot and it

play17:57

is the difference ellipse time since the

play18:00

previous frame which is exactly the

play18:01

frame time and the last one allocated

play18:04

video RAM

play18:06

this will be again taken from rendering

play18:09

server

play18:13

get rendering info and the constant is

play18:17

in this game video mem used I think yeah

play18:20

this one great

play18:23

okay now

play18:26

we will create a long variable to

play18:30

concatenate these values into one label

play18:34

let's start

play18:46

okay the function Str is actually

play18:49

conversion from number to string because

play18:52

Godot doesn't have an implicit

play18:55

conversion like other languages so we

play18:58

must always convert everything to string

play19:00

to use the plus operator

play19:27

it's not too aesthetic but it will so it

play19:30

exactly what we need to do so

play19:34

there is no problem with that

play20:01

very well by the way this backslash at

play20:05

the end of the line means that the line

play20:07

continues on the next line so the good

play20:10

old knows it is not finished here

play20:12

okay

play20:15

and now we want to add the player data

play20:19

but only if the player exists otherwise

play20:22

good overthrow and error so we need to

play20:24

check the player is a valid object it's

play20:28

not null

play20:48

foreign

play20:57

almost there just rotation

play21:07

okay

play21:10

and finally let's assign this data

play21:13

object to the text property

play21:18

cool finished

play21:20

now let's save the scene

play21:24

click back to the main scene and let's

play21:27

drag the new scene as a child note

play21:33

debug tscn

play21:36

cool

play21:38

let's open the 2D View and properly

play21:44

position position this element

play21:50

we will set up

play21:52

the position here

play21:55

I think it's here in layout yeah not

play21:58

stop left but let's give it bottom left

play22:02

and

play22:04

maybe transform yeah it's already set up

play22:07

so let's check it

play22:11

ah here it is

play22:15

so yeah this is just the basis for the

play22:19

future debug panel with unnecessary

play22:22

information

play22:23

right now we are finished with this part

play22:29

uh there is one more thing I forgot

play22:31

because nobody wants to see the vram

play22:35

value in bytes we should use at least uh

play22:39

megabytes or gigabytes so we need to

play22:41

divide it

play22:43

divide it by

play22:50

124 convert to kilobytes and

play22:55

24 convert to megabytes this is one

play22:59

thing and the other one is that we

play23:02

should be ready for situation when the

play23:04

player object exists but it's not valid

play23:07

so calling the properties Global

play23:10

position and rotation would end up in

play23:13

air as well

play23:14

to do that we will create a global

play23:17

function that can be called from any

play23:20

anywhere of the project

play23:22

and for that we will create a new folder

play23:25

called autoload

play23:28

Auto load

play23:30

there it is and we will add a new script

play23:38

we'll call it utils GD

play23:44

okay

play23:46

let's open it again we won't need these

play23:49

functions because this is just a utility

play23:51

class

play23:53

and now we need to add it to Auto alt

play23:56

settings this is done here in Project

play23:59

settings

play24:01

Auto load and click the folder icon

play24:05

let's find the script

play24:08

go to automatically assigned a node name

play24:11

Auto loads sorry hotels we'll click add

play24:15

and here it is now each time we need to

play24:18

access functions from this script we

play24:21

will just use the prefix utils with

play24:23

capital u and it can be used from any

play24:28

other script in this project

play24:30

let's close and let's Implement a simple

play24:33

function

play24:36

is valid node

play24:39

parameter node

play24:43

node so which means it's not null and

play24:48

s

play24:50

in

play24:53

tons

play24:54

valid

play24:56

there it is

play24:59

okay and that's it

play25:01

let's use Ctrl s to save the script

play25:05

switch back to debug overlay and here

play25:07

instead of if player we will replace it

play25:10

with

play25:11

utils

play25:14

is

play25:16

valid note

play25:19

great let's check it out

play25:22

yeah

play25:25

I think it looks fine

Rate This
โ˜…
โ˜…
โ˜…
โ˜…
โ˜…

5.0 / 5 (0 votes)

Related Tags
Game Development3D ModelsGodot EngineBlender SoftwareSpace ShooterFree TutorialCuddle EngineLow PolyDebug OverlayMaterial MakerGame Assets