一个游戏数据服务器的设计与实现

 2022-06-20 11:06

论文总字数:22067字

摘 要

随着时代的进步,网络技术进行着飞速的发展,网络游戏已经成为了人们进行休闲娱乐的一个重要方式。与单机游戏不相同的是,网络游戏更加注重玩家间的互动,因此确保玩家在进行互动时他们的属性、物品等信息不会出错,这是一个优秀的数据服务器应该具备的条件。

本项目是设计和开发一个基于MariaDB,Redis数据库的网络游戏数据服务器。需要实现一个满足可以和本游戏中其他服务器主要是游戏服务器进行交互,将数据放在MariaDB,Redis和内存三个部分来进行存取以及实现可以高速修改又能持久化保存数据等特点的数据服务器。为了实现项目需求,需要实现以下模块:将Redis作为MariaDB的数据缓存服务器。因此我们需要实现将MariaDB的数据导入Redis以及数据回写时同步,其中需要完成Redis数据格式设计以及回存时消息队列的处理;包含游戏中的各种排名的排行榜模块;与服务器组其他服务器的网络交互模块,并且引入libevent来提升消息转发的效率;封装了数据库的操作来方便对于数据库的使用。

目前作者已经完成上诉功能同时实现了数据的高速读写,降低了由于玩家人数增多带来的海量数据造成的数据服务器性能影响,同时保证了数据的完整性和数据的持久储存。

关键词:数据服务器,MariaDB,Redis

Abstract

With the progress of the times, network technology is developing rapidly. Online games have become an important way for people to enjoy leisure and entertainment. Unlike stand-alone games, online games pay more attention to the interaction between players, so to ensure that players do not make mistakes in their properties, items, and other information when interacting. This is an excellent database server should have conditions.

This project is to design and develop an online game database server based on MariaDB, Redis database. We need to implement a database server that can interact with other servers in this game, mainly game servers, and store data in three parts of MariaDB, Redis, and memory to access data and implement high-speed changes and persistent data retention. . In order to achieve project requirements, you need to implement the following modules: Use Redis as MariaDB's data caching server. Therefore, we need to implement the synchronization of MariaDB data into Redis and data write-back, which needs to complete the design of the Redis data format and the processing of the message queue at the time of returning; the ranking module containing various rankings in the game; and other server group servers The network interaction module, and the introduction of libevent to improve the efficiency of message forwarding; encapsulates the operation of the database to facilitate the use of the database.

At present, the author has completed the appeal function and achieved high-speed data reading and writing, reduced the impact of database server performance caused by the massive data brought by the increase in the number of players, and ensured the integrity of the data and the long-term storage of data.

KEY WORDS: database server, MariaDB, Redis,

目录

摘要 I

Abstract II

第一章 介绍 1

1.1 项目背景 1

1.2 项目意义 1

1.3 主要任务 2

1.4 论文大纲 2

第二章 理论基础 3

2.1 服务器框架 3

2.2 关系型数据库和非关系型数据库区别 3

2.3 数据库分析 4

2.3.1 MariaDB 4

2.3.2 Redis 5

2.4 选择原因 7

第三章 相关技术 8

3.1 操作平台及开发环境 8

3.2 相关库及模块 8

3.2.1 boost 8

3.2.2 mysql-devel 9

3.2.3 hredis 9

3.2.4 gevent 9

3.3 libevent框架 9

第四章 数据服务器的架构设计及需求分析 11

4.1 数据服务器的架构设计 11

4.2 功能模块分析 13

第五章 数据服务器的具体实现及功能测试 14

5.1 封装数据库操作 14

5.2 MariaDB数据导入Redis及数据回存数据库 14

5.3 排行榜模块 16

5.4 网络交互模块 17

5.5 功能模块测试 18

5.6 性能分析 20

第六章 总结与展望 21

6.1 总结 21

6.2 展望 21

致谢 23

参考文献 24

介绍

本章主要介绍该课题的项目背景和项目意义,简单描述了课题的主要任务,最后陈述了论文的结构与大纲。

项目背景

自从2014年来,中国的游戏产业以远超世界水平的迅速发展。根据中国音数协游戏工委最新公布的《2017年中国游戏产业报告》显示,2017年中国游戏用户数量达到5亿8300万人,游戏销售收入达到了约2036亿元,其中,网络游戏收入几乎占据了整个游戏产业收入。如图1-1所示

图1-1 2017年中国游戏收入分布

剩余内容已隐藏,请支付后下载全文,论文总字数:22067字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;