Godot 4 Final Fantasy 6 Data in LiteDB

NuGameDev
13 Jul 202316:01

Summary

TLDREl script proporciona una guía detallada sobre cómo utilizar la base de datos NoSQL LightDB para almacenar datos de Final Fantasy VI. Se discuten métodos para instalar LightDB y Newtonsoft.Json a través del Package Manager GUI o manualmente. Se destaca la importancia de definir clases C# que representen los campos en las colecciones de la base de datos, como habilidades, armas, armaduras y personajes, y cómo se utilizan para organizar y acceder a los datos. Además, se cubren técnicas para actualizar la base de datos y manejar colecciones, incluyendo la adición de personajes y habilidades, y se sugieren mejoras para la integridad de los datos y la eficiencia en la manipulación de la base de datos. El objetivo es crear una base sólida para el desarrollo de menús de batalla y la interfaz de usuario en futuras tutoriales.

Takeaways

  • 📚 Utilizaremos Light DB para almacenar datos de Final Fantasy VI de manera más sencilla que en tutoriales anteriores.
  • 📦 Necesitaremos instalar Light DB y Newtonsoft.Json, que son paquetes necesarios para la gestión de la base de datos y el manejo de JSON.
  • 🗂 Crearemos variables para almacenar la base de datos y las colecciones, que son objetos para los cuales queremos mantener datos.
  • 📝 Inicializaremos la base de datos y las colecciones con una ruta de archivo específica y una cadena de conexión segura.
  • 🏢 Las clases C# definirán los campos en las colecciones de la base de datos, como ID, nombre y otros atributos específicos de Final Fantasy.
  • 🔍 El uso de ID es crucial para la actualización de la base de datos, y se debe incluir en las clases para permitir consultas.
  • 🔢 Utilizaremos enumeraciones (enums) para representar estados o características específicas, lo que mejora la integridad de los datos.
  • 🛡️ Las armas y armaduras tendrán atributos específicos, como posibilidades de activación de habilidades o reducción de daño.
  • 🧙 Los personajes tendrán una lista de habilidades y magias nativas, que se almacenarán en diccionarios para su fácil recuperación.
  • 🎮 La gestión de la base de datos incluirá métodos para obtener y actualizar objetos, como personajes y habilidades, en la colección.
  • 📈 Los métodos de manejo de la base de datos también se utilizarán para construir menús de batalla y UI en futuras tutoriales.

Q & A

  • ¿Qué base de datos se utilizará para almacenar los datos de Final Fantasy VI?

    -Se utilizará Light DB para almacenar los datos de Final Fantasy VI.

  • ¿Qué paquete adicional se necesita además de Light DB?

    -Además de Light DB, se necesita Newtonsoft.Json.

  • ¿Cómo se instala un paquete en el proyecto?

    -Se puede instalar un paquete utilizando la GUI del administrador de paquetes o agregando las referencias del paquete manualmente en el archivo del proyecto.

  • ¿Qué es importante tener en cuenta al crear clases C# para la base de datos?

    -Es importante incluir un campo de ID para Light DB, ya que se utiliza para consultar y actualizar la base de datos.

  • ¿Cómo se definen las colecciones en la base de datos?

    -Las colecciones se definen como cualquier tipo de objeto para el que se desee realizar un seguimiento de datos, y se inicializan creando una instancia de la base de datos y obteniendo la ruta de conexión.

  • ¿Qué es una forma de representar las fortalezas y debilidades de los elementos en una clase?

    -Se puede utilizar una enumeración (enum) para representar las fortalezas y debilidades de los elementos, lo que permite obtener el porcentaje de reducción o absorción de daño.

  • ¿Cómo se obtiene un objeto de personaje de la base de datos?

    -Se utiliza el método 'get character object', que toma el nombre del personaje, lo convierte en JSON, y luego lo deserializa en un objeto C# utilizando la biblioteca Newtonsoft.Json.

  • ¿Cómo se actualiza un personaje en la base de datos?

    -Se utiliza el método 'update character', que busca el personaje por su ID, y luego utiliza ese ID para actualizar los valores nuevos que se han pasado.

  • ¿Cómo se obtiene el líder del grupo en la base de datos?

    -Se utiliza una consulta que busca una propiedad donde 'is party leader' es verdadero, lo que debería devolver solo un resultado dado que solo hay un líder.

  • ¿Cómo se obtiene la lista de habilidades mágicas de un personaje?

    -Se utiliza el método 'get character magic', que toma el nombre del personaje y devuelve una lista de habilidades mágicas asociadas a ese personaje.

  • ¿Cómo se agregan habilidades por defecto a la base de datos?

    -Se utiliza un script que agrega objetos a la base de datos, asegurándose de que no existan registros duplicados y utilizando índices para garantizar la unicidad de los nombres de personajes.

Outlines

00:00

😀 Introducción a la base de datos LightDB y su uso en Final Fantasy VI

El primer párrafo introduce el uso de LightDB para almacenar datos de Final Fantasy VI. Se menciona que el tutorial será más sencillo que uno previo, ya que no implica la creación de objetos en una escena a través de C Sharp y GD Script. Se detalla el proceso de instalación del paquete LightDB y la necesidad de NewtonSoft.Json. Se habla de la inicialización de la base de datos y las colecciones, y cómo se definen las clases C Sharp para las colecciones de datos.

05:02

📚 Definición de clases y estructura de datos para objetos del juego

Este párrafo se enfoca en la definición de las clases C Sharp que representan los distintos elementos del juego, como habilidades, armas, armaduras y enemigos. Se discute la importancia del campo ID para la biblioteca LightDB y cómo se estructuran los datos para cada tipo de objeto, incluyendo habilidades especiales y estadísticas de personajes y enemigos.

10:02

🔍 Consultas y actualizaciones en la base de datos para el juego

El tercer párrafo cubre cómo realizar consultas y actualizaciones en la base de datos. Se describen métodos para obtener objetos de personaje, obtener estadísticas de personajes y habilidades, y cómo se usan las consultas de LightDB para encontrar y manipular datos específicos. Se destaca la importancia del ID para la actualización de registros en la base de datos.

15:04

🛠️ Procesos de inserción de datos y garantía de integridad en la base de datos

El último párrafo se centra en los procesos de inserción de datos en la base de datos, garantizando la integridad y la unicidad de los registros. Se detallan los métodos para agregar personajes, habilidades y otros objetos del juego a la base de datos, y cómo se utiliza el código para inicializar la base de datos con todos los objetos necesarios para el juego.

Mindmap

Keywords

💡Light DB

Light DB es un motor de base de datos NoSQL que se utiliza para almacenar y manipular datos de manera eficiente. En el video, se utiliza para almacenar información de Final Fantasy VI, como habilidades, armas, armaduras y personajes. Se destaca por su simplicidad de uso y su capacidad para manejar grandes conjuntos de datos sin la necesidad de un esquema previo.

💡Final Fantasy VI

Final Fantasy VI es un popular videojuego de rol desarrollado por Square para la consola Super Nintendo Entertainment System. En el contexto del video, se utiliza como base para la creación de una base de datos en Light DB, almacenando datos relevantes del juego para su posterior uso en un proyecto.

💡C#

C# es un lenguaje de programación orientado a objetos desarrollado por Microsoft. En el video, se utiliza para crear clases y objetos que representan los elementos del juego, como habilidades y personajes, y para interactuar con la base de datos Light DB.

💡Newtonsoft.Json

Newtonsoft.Json es una biblioteca de C# que facilita la serialización y deserialización de objetos a JSON y viceversa. En el video, se utiliza para convertir objetos de C# en JSON y luego deserializarlos de nuevo a objetos, permitiendo así la manipulación y actualización de datos en la base de datos.

💡BSON

BSON (Binary JSON) es un formato de almacenamiento de datos binario y más eficiente que JSON. En el video, se menciona que Light DB utiliza BSON Mapper para convertir objetos a documentos BSON, lo que permite una mayor eficiencia en la manipulación de datos.

💡Clases de C#

Las clases de C# son una parte fundamental de la programación orientada a objetos y se utilizan para definir estructuras de datos y comportamientos. En el video, las clases de C# se usan para modelar los distintos elementos del juego, como 'Ability', 'Weapon', 'Armor', y 'Character', cada una con sus propios campos y propiedades.

💡Colecciones

En el contexto de la base de datos, una colección es un conjunto de documentos que generalmente comparten una estructura similar. En el video, las colecciones se utilizan para organizar y almacenar diferentes tipos de objetos del juego, como habilidades, armas, armaduras y personajes.

💡Consultas

Las consultas son una parte crucial de la manipulación de datos en una base de datos. En el video, se muestra cómo realizar consultas en Light DB para recuperar información específica, como el líder del grupo o las estadísticas de un personaje, utilizando diferentes criterios de búsqueda.

💡Serialización

La serialización es el proceso de convertir una estructura de datos en un formato que pueda ser fácilmente transmitido o almacenado. En el video, se discute cómo utilizar la serialización para transformar objetos de C# en JSON y luego deserializarlos, lo que es esencial para la interacción con la base de datos Light DB.

💡Enums

Un enum (enumeration) es un tipo especial de dato en C# que representa un conjunto de constantes con nombre. En el video, se utilizan enums para representar estados, como 'strong' o 'weak' en el contexto de los elementos, lo que permite una mejor organización y comprensión del código.

💡Interfaces de usuario (UI)

La interfaz de usuario (UI) es la parte de un sistema que permite a los usuarios interactuar con la aplicación. Aunque no se profundiza en el video, se menciona que la información almacenada en la base de datos se utilizará para alimentar menús de batalla y crear la UI en futuras tutoriales.

Highlights

Utilización de Light DB para almacenar datos de Final Fantasy VI.

Instalación del paquete Light DB y Newtonsoft.Json a través del Package Manager GUI.

Creación de variables para la base de datos y las colecciones.

Inicialización de la base de datos y las colecciones con una ruta y una cadena de conexión segura.

Definición de clases C# para estructurar los campos en las colecciones de la base de datos.

Importancia del campo ID para la biblioteca Light DB y su uso en consultas y actualizaciones.

Creación de clases para habilidades, armas, armaduras y otros objetos del juego con diferentes campos relevantes.

Uso de enumeraciones (enums) para representar estados y elementos en lugar de texto para mejorar la eficiencia.

Implementación de diccionarios para almacenar probabilidades de habilidades y efectos.

Definición de la estructura de la zona de batalla y enemigos asociados.

Descripción de las propiedades y características de los personajes, incluyendo habilidades nativas y niveles.

Inclusión de métodos para recuperar objetos de personajes de la base de datos y convertirlos en objetos C#.

Actualización de objetos de personajes en la base de datos utilizando su ID único.

Consulta de información específica de personajes, como el líder del equipo o estadísticas de personajes.

Recuperación de la lista de habilidades mágicas de un personaje para su uso en menús de batalla.

Adición de habilidades y objetos predeterminados a la base de datos para cada personaje y colección.

Uso de diccionarios y enumeraciones para definir reducciones y absorciones de daño por elemento.

Preparación de la base de datos con todos los objetos necesarios para alimentar menús de batalla y UI en futuras tutoriales.

Transcripts

play00:01

okay we're going to use light DB and

play00:03

this time we're going to use it to store

play00:05

Final Fantasy VI's data uh so I have a

play00:08

other video on nosql and light DB using

play00:11

that wiggado this one's going to be a

play00:13

little bit simpler because we're not

play00:14

going to pass from C sharp to GD script

play00:16

and create objects uh in the scene that

play00:20

hold the data we're just going to use

play00:21

the database which is a little more

play00:23

straightforward so we're going to need

play00:24

light DB using light DB and again I have

play00:28

that other nuget tutorial which we'll

play00:30

show how to install a package so again

play00:32

to install the package you can use the

play00:34

package manager GUI put light DB we're

play00:36

also going to need Newton's off Json

play00:38

uh the alternative to that is in the Cs

play00:41

project file you can put the new get

play00:43

package references right in this item

play00:45

group that's the manual way to add it

play00:48

but the guis are easier so just make

play00:50

sure you have the those things installed

play00:52

because we're going to need them

play00:54

so first we just need to have some

play00:55

variables here that will store the

play00:58

database and our collections the

play01:00

database itself is just going to be a

play01:02

single file you can pick the path for

play01:04

that the collections are going to be any

play01:06

type of object that we want to keep

play01:07

track of data on we're just going to

play01:10

create a collection for that

play01:12

so here we're going to initialize the

play01:13

database and initialize the collections

play01:15

which right down here this is

play01:17

essentially just getting the path and

play01:19

then this connection string you have the

play01:22

file name equal to the database path

play01:24

that you choose where you're going to

play01:25

write that file

play01:26

I would put a password so no one can

play01:28

edit your data with a text editor and

play01:30

the connection type is just meant to

play01:32

allow multiple things happening at once

play01:34

I think but anyway just so this will

play01:37

create the database new light database

play01:40

in that connection string and if it's

play01:42

already there it won't it won't bother

play01:43

you know it's already done

play01:45

initialize collections it's very much

play01:47

the same thing we take that game

play01:49

database that we just stored in there

play01:51

you know again we have it in a variable

play01:53

as well so that that object get

play01:56

collection and the type of collection

play01:58

which is going to be a c-sharp class

play02:00

which I'll show you in a moment and then

play02:02

the name of that collection that you

play02:04

want anything you want

play02:06

so first I want to talk about this the

play02:09

c-sharp classes are going to define the

play02:11

fields in the database collection so

play02:14

we're going to look at one of those

play02:15

first ability like we're starting with

play02:18

here make sure you have this ID field

play02:21

for light DB anyway this is important

play02:24

so it's in that object ID comes from the

play02:27

light DB library and name it this to

play02:30

underscore ID because when you query

play02:33

light DB it will return results but if

play02:36

your class doesn't have this as a

play02:38

property you won't be able to access it

play02:39

and you do need that to update the

play02:41

database

play02:42

so we're going to go through some of

play02:44

these uh classes just so I can show the

play02:47

traits or fields that I'm storing on

play02:50

each of them so if you're reproducing

play02:52

this you know you get to see all the

play02:53

abilities but I'm going to go kind of

play02:55

quickly through them because a lot of

play02:56

it's repetition and it gets kind of

play02:58

boring so every one of these has its

play03:01

name uh the ability class I made to kind

play03:04

of be able to handle different types of

play03:06

abilities meaning like a spell or some

play03:08

of the monster special abilities or

play03:10

whatever it may be so some of these

play03:12

aren't going to get used for each

play03:13

ability

play03:14

but you know you got name power physical

play03:16

some of these are called different

play03:17

things in the different Final Fantasy uh

play03:20

versions so if you if you need to pause

play03:22

this just uh by all means

play03:24

um I'm gonna explain a few of the ones

play03:26

that might not be obvious but a lot of

play03:28

this stuff is pretty obvious magic class

play03:31

is just a string because I was lazy it's

play03:33

just the black white or gray magic

play03:34

that's going to come in handy for

play03:36

organizing them the same way the

play03:38

original game did and some of the you

play03:40

know any time it has a random a chance

play03:43

of happening like maybe your low energy

play03:44

attacks you could store that in here

play03:46

armors and weapons are gonna uh armor

play03:49

and weapons are going to be pretty

play03:50

straightforward too they just kind of

play03:51

have the typical traits

play03:53

um I figured we'd store the statuses

play03:56

that it would induce or block in an enum

play03:59

oh in a list excuse me the enums

play04:01

actually enums are good for whenever

play04:03

you're you have a set list of things

play04:06

that that something can be basically if

play04:09

you can avoid storing stuff as text than

play04:11

any enum is a nice way to do that so

play04:14

anytime you see that enums dot whatever

play04:15

it's coming from this class that I

play04:17

defined and I put in the statuses and uh

play04:20

you know the Elementals just to fish

play04:22

fish yummy fish all that stuff is there

play04:25

um except the stuff I forgot so this

play04:28

part here um

play04:30

damage reduction and damage absorption a

play04:32

lot of times I tried this method of

play04:34

using an i dictionary where you put in

play04:37

whatever the thing is and store it as an

play04:40

uh integer or a float to give you a

play04:43

number or percentage chance of that

play04:46

thing happening or in this case maybe

play04:47

percentage uh of damage reduction or

play04:52

absorption that way when you're you know

play04:54

if you're calling this in code you can

play04:56

call the item by its name or by its enum

play04:59

and it'll return the percentage so if

play05:02

you're in you know you're doing a

play05:03

calculation in the battle algorithm you

play05:05

want to know like okay some jerk cast

play05:07

fire on me check my equipment does my

play05:09

equipment have fire you know et cetera

play05:11

damage reduction so since we did armor

play05:13

I'm just going to click on weapons next

play05:14

because it's you know same idea I don't

play05:17

think there's anything too different in

play05:18

here name

play05:20

the random Mobility cast like if you've

play05:22

got aluminum and you and it casts Pearl

play05:24

it'll you know any abilities that get

play05:26

cast in there you can store here

play05:28

Bushido capable is just uh science sword

play05:31

Tech runic same you know you know same

play05:34

deal for the most part same damage back

play05:36

row like the locks weapons in the middle

play05:38

of the game

play05:39

battle area this needs to be more

play05:42

complicated to be really be a true

play05:43

representation but this will give us the

play05:45

concept uh just the battle area name is

play05:47

going to be like I'm going to name the

play05:49

scene of the battle area and then this

play05:51

is going to be a reference to the

play05:53

enemies that should appear in that scene

play05:55

really it might better be a list of

play05:58

lists or something like that because

play06:00

there are different sets of enemies but

play06:02

I'm not going to go that deep at least

play06:03

not yet so character that one's I'm

play06:06

gonna have a few that are worth

play06:08

explaining so like native magic

play06:10

activation list same idea the dictionary

play06:14

you put the magic spell name and what

play06:16

level

play06:17

it activates is going to get returned

play06:19

from that dictionary you know hey does

play06:21

that spell activate at such and such a

play06:23

level

play06:24

actually that one should probably be

play06:25

turned around that one should be pass in

play06:27

the level that I just got to and return

play06:29

the spell that I learned yeah this also

play06:31

needs to be turned around what it should

play06:32

be is in string so you can pass in the

play06:34

level and then hey seven learns Mantra

play06:36

you know row position is going to be

play06:38

integral obviously in battle strengths

play06:41

and weaknesses down here

play06:43

um I think that this doesn't necessarily

play06:45

have to be a static value of course so

play06:47

like if you're equipped you could

play06:48

actually just store the characters

play06:50

strengths and weaknesses as a result of

play06:52

the equipment or you can store it on the

play06:53

equipment but this is kind of what I was

play06:55

thinking here

play06:57

enemy is you would think a little

play06:59

simpler but not really

play07:01

um so a lot of this is the same so you

play07:03

have the name level all of the typical

play07:06

statistics no HP and we obviously need

play07:08

the max depending on what level they're

play07:10

at I don't know if you would need all

play07:11

these for every enemy but actually I'm

play07:13

sure you don't for every enemy but it's

play07:16

here and you can always mess with it

play07:18

later same thing here elements strong

play07:19

and weak this one just to explain a

play07:22

little bit this is more a correct way to

play07:24

use string and then the float so like

play07:26

sketch abilities so from uses sketch we

play07:28

have a dictionary of the abilities uh

play07:31

and then the percent chance that they're

play07:33

going to happen what I was reading is

play07:35

the control are the same abilities that

play07:39

uh confuse does and so when you're in

play07:42

control obviously you don't need the

play07:43

percentage of that happening but in

play07:45

confuse you would rage abilities of

play07:47

course if GAO has the rage you know

play07:49

which abilities same thing with lore

play07:51

sometimes there are multiple items that

play07:53

when you use Ragnarok on an enemy

play07:56

that you can get and those also have a

play07:58

percentage chance of turning into that

play08:00

item and dropped installing you know

play08:02

self-explanatory so a piece I want to

play08:05

touch on here uh this is going to be uh

play08:07

used in the next tutorial so in this

play08:09

database Handler

play08:10

um I'm going to touch on some of these

play08:12

methods just to show how they work I do

play08:14

want to go over some of these methods

play08:15

these are going to come into play in the

play08:16

next tutorial where we build out the

play08:18

menu so I'm actually going to start with

play08:19

this so get character objects so when

play08:21

you query the database you're going to

play08:23

get back that C sharp character object

play08:26

when you query the character collection

play08:28

of course so here we pass in the

play08:30

character name and we need to convert

play08:32

that to Json and lightdb has a built-in

play08:35

way to convert it to Json which is what

play08:38

this is doing here it's going to refer

play08:40

to this this bson mapper Global to

play08:43

document what I'm doing here is since

play08:44

we're just taking the character name in

play08:46

this is querying the character

play08:48

collection for that character name and

play08:51

then this light DB Json serializer that

play08:54

converts it to Json that's kind of what

play08:55

a light DB e offers is converting back

play08:58

and forth to Json but I want the C sharp

play09:00

object back so we can mess with the code

play09:02

so that's what this does and obviously

play09:04

this can be done to any of these this

play09:06

character is just the one we're going to

play09:08

use first so here we get the Json I just

play09:11

split it out here to make it a little

play09:12

easier to read and then this Json

play09:15

convert

play09:17

deserialize and then your class you know

play09:19

that character class that's uh going to

play09:22

use the Newton soft Json library and

play09:25

then that's going to return the actual

play09:26

c-sharp object so that way we can pass

play09:29

in anything that we've stored in the

play09:30

character collection we can pass in the

play09:32

character's name and get back a C sharp

play09:35

object where we can access any of these

play09:37

properties update character I did cover

play09:40

this in the other tutorial but really

play09:42

quickly we're just going to query for

play09:43

that make sure we have that ID again

play09:46

that's why that that ID is important and

play09:49

all those classes so you pass in that

play09:52

modified character it's going to make

play09:53

sure it's in the database and use that

play09:55

ID property to update with the new

play09:58

values that you passed in with that

play10:00

object

play10:01

so these we're going to use when we

play10:02

start a battle so get party leader

play10:05

um you know it's pretty straightforward

play10:06

you're just querying where the property

play10:09

which is one of those

play10:11

um you know properties is is party lead

play10:13

equals true there's only going to be one

play10:14

hopefully this one uh get all the

play10:17

characters in The Party

play10:19

this dollar sign is just kind of the

play10:21

light DB syntax like if you use light DB

play10:24

Studio you'll see like it uses the

play10:26

dollar sign to kind of Mark the object

play10:29

and then dot property pretty much like

play10:33

any language and equals true so get

play10:35

character stat is string this is going

play10:37

to pass in or take in rather a character

play10:40

name and the name of a stat so like you

play10:42

pass in lock you pass in HP then this

play10:46

uses reflection to say get the property

play10:48

info and then get the value of that

play10:51

property and that way we can just simply

play10:53

say give me this person's stat and now

play10:56

we don't have to rewrite this every time

play10:58

get character magic so one of the things

play11:01

we're going to do in the next tutorial

play11:02

is populate their a magic list and we're

play11:05

going to use this to simplify that pass

play11:09

in the character name and again the

play11:11

um we're going to get a list back

play11:13

because again the character magic list

play11:15

the property is a list already

play11:19

so all we have to do is get the Single

play11:21

Character and get back that magic list

play11:23

property and that will be a list of

play11:25

abilities so first we're going to get

play11:27

the character

play11:28

and pay attention to this dollar sign

play11:30

notation here so this might look a

play11:32

little confusing if you're not familiar

play11:34

with it this dollar sign is part of

play11:36

light DB syntax that we were just

play11:37

talking about this one outside the

play11:40

quotes is a C sharp convention so that

play11:42

within the quotes so you can pass in a

play11:44

variable value

play11:46

in the curly braces pay also close

play11:49

attention to the single quotes on each

play11:51

side of these because you're passing a

play11:53

string into a database query you want to

play11:55

have the single quotes around it

play11:57

first to default is necessary here

play11:58

because this method the find method

play12:00

could return multiple so we have to

play12:01

specify first or default because it

play12:04

would break if you had multiple rows I

play12:06

did have a little issue with the other

play12:08

syntax here I'm not sure if that's a bug

play12:10

or whatever but that's why I use this

play12:12

way and it's going to come in handy

play12:14

anyway so here we just initialize the

play12:16

list make sure it's not null and set

play12:17

that magic list that we're returning

play12:19

equal to the result that character's

play12:21

magic list and that's going to give us a

play12:23

list of abilities now specifically

play12:25

spells so to get the boring stuff out of

play12:28

the way here last thing are these

play12:29

database default abilities I'm going to

play12:32

just look at the character ones because

play12:33

they're basically all the same so first

play12:36

here we have ADD character and you know

play12:37

in other ones it'll be addability or

play12:39

whatever it's just the same template

play12:40

this query is the database to make sure

play12:42

the character doesn't already exist if

play12:44

it does just skips out of the method

play12:47

insert the character and ensure index

play12:50

make sure that the that it's Unique so

play12:52

that you're you know you cannot have two

play12:54

records in here with the same character

play12:55

name that's what this is saying that

play12:57

true is ensuring uniqueness as well as

play13:00

being an index and then it just prints

play13:02

out either way so what I'm doing with

play13:04

these database default scripts is you

play13:07

know basically code entering all of the

play13:10

objects that I want to for one that's

play13:12

just how light DB is mainly designed to

play13:14

work it seems if I want to change

play13:16

something I just delete the whole

play13:18

database file when the game starts up

play13:20

again it'll run through this as it is it

play13:22

just you know this is what I get every

play13:24

time everything's already in the

play13:25

database so the ad characters I just

play13:28

break them up into regions for each

play13:29

character we just create an object as a

play13:33

new character and it'll be whatever

play13:35

c-sharp class that you made for that

play13:37

collection so this would be ability

play13:40

um weapon armor or whatever

play13:42

and then open close the curly braces and

play13:44

then you put all of the properties in

play13:46

here

play13:46

so this is mostly obvious so a couple

play13:50

little things to note so the fine one is

play13:51

actually kind of Overkill but it gives a

play13:54

little database Integrity I guess

play13:56

um so this actually finds the spell

play13:58

in the database so you'd have to add the

play14:01

abilities first which is important if

play14:03

you're doing it this way but you don't

play14:05

have to do that like you could just

play14:06

create the ability and I'll show you an

play14:08

example of that below one point of

play14:09

Interest this native magic activation

play14:11

list again the spell and what level

play14:14

which I probably should turn around so

play14:17

the other example here go I didn't add

play14:19

all of his rage abilities as abilities

play14:21

or enemies yet actually so if you're not

play14:24

actually referencing the database you

play14:25

know you create the object

play14:28

right in the list here so you're

play14:30

creating a new list create a new ability

play14:33

and add it right into that unique

play14:35

ability list that's going to be stored

play14:38

you know as the character object's

play14:40

unique ability list and so yeah that was

play14:42

fun you can see all the different rages

play14:45

that he has here and then you just to go

play14:47

through the same process through each

play14:48

character and for each object so that's

play14:51

all these other ones do and like for

play14:53

example I did a list of characters that

play14:55

can equip each item this was kind of

play14:58

tedious another kind of not terribly

play15:01

often used cases Elemental damage

play15:03

reductions so this uh what is this the

play15:07

the Minerva so it does you know you can

play15:10

store the Elementals as an enum which I

play15:12

did here and then you uh just say for

play15:17

each one of those the percentage of

play15:19

damage reduction and again that's why

play15:21

it's a dictionary because there's more

play15:22

than one and you want to be able to get

play15:25

the percentage when you're messing with

play15:28

battle algorithms and also you can also

play15:30

just see at the end of each of these

play15:32

objects I I do add armor add character

play15:34

whatever that's the method at the top it

play15:37

just adds that variable that I just

play15:39

created

play15:40

you know this is the same process as the

play15:43

you know

play15:44

as this process except it's just

play15:46

referencing the different collections so

play15:48

we're not going to need all this

play15:49

immediately but we're going to need some

play15:51

of this in order to feed the battle

play15:53

menus when we actually get into a battle

play15:55

and then start making up the UI and

play15:58

that's what will be next

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
LightDBFinal FantasyC#NoSQLBases de DatosTutorialProgramaciónVideojuegosJSONGDScript
Benötigen Sie eine Zusammenfassung auf Englisch?