如何在没有在线数据库的情况下存储游戏数据 [英] How To Store Game Data Without An Online Database

查看:160
本文介绍了如何在没有在线数据库的情况下存储游戏数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款旨在离线玩的游戏.在过去,我做过需要在线连接的游戏.我们会将所有相关数据在线存储在数据库中,然后获取数据库数据,通过JSON将数据解析为对象,然后根据需要对其进行访问.

I am working on a game that is intended to be played off line. For the past I had done games which required an online connection. We would store all relevant data online in a database, and I would fetch the database data, parse the data into objects, via JSON, and access them as needed.

对于我的离线环境,我不确定如何才能最好地复制存储所有类型的游戏数据.我确实更喜欢数据库的组织,并且我不想创建一堆游戏文件和变量来管理所有内容.我宁愿模仿一个拥有数据库的数据库,只有它可以随游戏一起编译.

For my offline environment, I'm not sure how I can best replicate storing all the types of game data. I really preferred the organization of the database and I don't want to create a whole bunch of game files and variables to manage everything. I'd prefer to mimick having a database, only it compiles with the game.

我考虑过使用excel文件,但是我觉得这样很容易被黑客入侵.

I considered using an excel file, but I feel that would be too easy to hack.

您对我如何模仿离线数据库有何建议?

Do you have a suggestion on how I can mimick an offline database?

我的特定引擎使用Unity3D,并且我使用的是C#.

My specific engine is with Unity3D and I'm using C#.

谢谢

推荐答案

您可以使用本地数据库技术,就像使用在线数据库一样使用它们,但是数据存储在本地计算机上存储的文件中.如果您在.NET中有两个想法:

You can use a local database technology, they are used just like you would use an online database but the data is stored in a file stored on the local machine. If your in .NET two come to mind:

SQLite- http://www.sqlite.org/

这是defaco本地数据库技术,它是开源的并且具有非常广泛的用途.甚至还有一个库可以将统一性连接到它: https://github.com/Busta117/SQLiteUnityKit

This is the defaco local database technology, its open source and has very widespread use. There is even a library to connect unity to it: https://github.com/Busta117/SQLiteUnityKit

SQL CE

这是Micrsofts单个文件数据库.它与SQL Server的功能非常相似,它不是开源的,但它已经在.NET框架中内置了驱动程序,因此使用起来可能更简单.如果您想让您的游戏跨平台运行,可能会出现以下问题: http://answers.unity3d .com/questions/26118/can-you-use-sql-compact-35-with-unity.html

This is Micrsofts single file database. It is very similar to the features of SQL Server, its not open source but it has built in drivers already in the .NET framework so it maybe simpler to use. Issue with this could be if you want your game to run across platforms take a look here: http://answers.unity3d.com/questions/26118/can-you-use-sql-compact-35-with-unity.html

我建议使用SQLite,因为它似乎在Unity中对此有更多支持

I would recommend going with SQLite as it seems there is more support for it in Unity

这篇关于如何在没有在线数据库的情况下存储游戏数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆