Unity3D - Separating Data and Logic for persistence and multiplayer

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

-------

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

More than 2 year after, I still think this is a clean way to code and should be the way we structure our programs. Thanx for sharing! Always appreciate the time you put in to sharing things like this!

knightmarerip
Автор

Thank you very much for providing so useful and good practices!

alexanderzotovthend
Автор

This is a very simple example. I want something more complicated. For example, customization character (or weapon) with separating data, logic and view.

evggg
Автор

Looking into more separation of data in my current project.
Would you say its a good idea to have Static Template Data be a ScriptableObject and then for example have an InstanceData that can then be perhaps an abstract class C# class: that i can create alternatives for specific data for specific Items which is my case is of MonoBehaviour that is added to prefabs.

In my game there will be Items that has data that changes like durability, stored water and much more and save systems will be implemented. They do exist already in some form but considering that the data seperation may be a great improvement to saving/loading when using with NewtonSoft JSON.

BNTO
Автор

since you mentioned networking, are you planning on doing a more advanced networking guide? would love to see more good habits when making a networked game

derrikcreates
Автор

If you want to increase your health, mana and movement speed; youll need a Celestial Emblem, find more life crystals and the hermes boots.

SpiritVector
Автор

Thank you ☺ ... If you are planning to make video regarding database/networking, please check out firebase with unity. Because there are few such videos and if you were to make one it would be great 👍

paradox
Автор

I don't know what seperating is but it sounds exciting.

bernardlemay
Автор

Hi! I am currently working on a turn-based multiplayer game and this video was very helpful! However, I am concerned that separating data and logic brakes the encapsulation of data. When there are many logic separated by their jobs, those public data could be accessed from any logic. Are there any solutions to this problem?

jinseopark
Автор

Jason, Could you please explain why you chose to have the PlayerData stored as a local variable over having the Player inherit from the Data. I guess what I'm trying to find out is, when seperating logic and data, should the logic extend from the data or just simply reference the data. Or why not have a logic class that uses parameters instead of the whole PlayerData class?
Can you HALP ME please!? I end up having a data class with a ~15 fields and a logic class with > 15 methods. It doesn't seem clean to me, but I think my standards are being bound by software programming and not game programming. Cheers,

ppk
Автор

Just making sure, but this was essentially replaced by scriptable objects, right?

Icewind
Автор

Hey Jason Im doing an online game that can be played offline(online when joining other players' world).
My question is that, after watching ur dependency injection video I noticed there is an asset file created as the setting files. I also want the dependency injection layer in my project. However, now sometimes I end up containing the setting file int identity(like a configID) in my playerdata.cs like: private int configID. Is that bad practice? Or is there a leaner way to include both saving data + dependency injection data?

hal
Автор

3:00 after getting used to clean code I really want to to delete those 3 namespaces from line 1 to 3 XD

yousefal-hadhrami
Автор

Thank you for your help / explanation. I did something similar in my project, but I had some problem when my "backend" needs some aditional information from the User/Ui. Could you give me some advice regarding this? (Example: 1) the player plays a card, which is an upgrade card 2) then the card logic needs an additional information which reaource the player wants upgrade.) I have a working solution for it with async tasks methods, but it looks ugly and hard to debug. Im sure there should be a better way, but I dont know it yet. Thanx in advance if you answer.

Ferenc-Racz
Автор

I'd like to know why this vid was down voted. If you think you have a better solution could you add a link to your vid?

knightmarerip
Автор

I'd like the video, but I'd be bumping the counter off of 555 likes...
Maybe some other time.

MasterofGalaxies
Автор

Could you do a playerprefs quick video? I'm guessing it is a text file that is stored next to the executable? Could this store video settings/custom input settings as well?

tartinitrumpet
visit shbcf.ru