Serialization with Gson | Coding a 2D Game Engine in Java #19

preview_player
Показать описание

In this tutorial I go over a brief introduction to Gson, which is Google's serializer for Java objects. This library serializes objects into a Json format, which can then be deserialized with the same library. It uses reflection to do this, which means that the programmer does not have to write any serialization code at all. We will discuss some changes that need to be made to our current component framework to support this, implement those changes, and the begin to save our game data using Gson.

---------------------------------------------------------------------

Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :)

My Recommended Game Engine Books:

My Recommended Beginning Game Programming Books:

My Recommended Java Books:

Рекомендации по теме
Комментарии
Автор

Yay another episode!

BTW: you can type sout and then press ctrl+space to add the System.out.println(); snippet

voxelrifts
Автор

Great vid :)
FYI, in IntelliJ, you can right click -> generate (or Alt + Insert) to generate constructors, getters, setters, and a bunch of stuff.

cometmacaro
Автор

Your videos are helping me alot. Thanks for helping mate :)

vixellar
Автор

One thing that would make your life a lot easier is making all of those setters return `this`, so that in your creation code you can just chain them together (i.e. new SpriteRenderer().setColor(new Vector4f(...)).setSprite(...) )

blazernitrox
Автор

That's what I was waiting for, ty :D

sconosciutosconosciuto
Автор

instead of lamboc, you can use alt-ins/generate

ncg-sgnb
Автор

Oh and if you want to print out a vector in joml you can do and it will print the vector in decimal format

mrmaniac
Автор

Can anyone tell me why doesn't serialization work with Constructors?

suswee_
Автор

Wait... I've used constructors with reading and writing gson... are you sure you can't use them, or do the classes have to be pojo classes to use a constructor?

chadzack
Автор

you can use jackson also good spring boot use it

matanmigdal
welcome to shbcf.ru