Home  >  Article  >  Backend Development  >  Introduction to Web Game Development Tutorial 2 (Game Mode + System)_PHP Tutorial

Introduction to Web Game Development Tutorial 2 (Game Mode + System)_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:42:35862browse

一、游戏模式
目前webgame游戏模式大体上可以分为以下四类:
1
、玩家拥有一个城市,不断的升级城市内建筑,建筑可以自动获得物资,可以生产军队,军队之间进行对比数值的战斗。这里我简单的称为Ogame模式。

比较优秀的代表:战神世界IITravianOgame,武林三国,纵横天下,领主online,乱舞春秋,热血三国,方便面三国等等。
这是一个比较成熟的模式, 但正因为成熟。因此,玩家接触到这类游戏比较的多,除非你能超过这些优秀的代表,否则就只是简单的重复开发。

For players:
Advantages: Ogame mode simulates a monarch and launches a series of wars . Satisfy the monarch's sense of accomplishment.
Disadvantages: Playing the Ogame mode game requires enough patience. Of course you have money.
For developers:
Advantages: There are quite a few places to refer to. There's even a source code reference. (Source code of Ogame)
Disadvantages: No matter how the name is changed, the planning is done. The essence remains unchanged. Changing the soup without changing the medicine, players are not fools.
Ogame
mode is as successful as when Legends first came out. Not because this model is very good, but because there is no stronger model that can surpass him yet. So, if you want to make web games to make money, not just for fun, or just to set up your own server. Then please develop a new model from scratch.
2
. The core of the game is fighting, constant fighting, and constant completion of tasks. Here I simply call it the Ebs pattern.
Excellent representatives: EBSII, webFantasy (wog), Wuxin pet (forum plug-in). The
Ebs
mode is also a mature mode.
For players:
Advantages: Just keep fighting and complete the mission, PK.
Disadvantages: You can only keep fighting and completing tasks, PK.
For developers:
Advantages: There are quite a few places to refer to. There's even a source code reference.
(wog
web幻想)的源代码,无心宠物的源代码)
缺点:收益到底如何呢?
3
mmRPG模式游戏。
猫游记、英雄之门、昆仑(昆仑不应该算网页游戏了)。
模拟具有客户端的网络游戏。本身这个想法非常好,但是,谁来玩是一个问题。
对玩家来说:
优点:类似有客户端的网络游戏。
缺点:画面、游戏性等等都比不过客户端网络游戏,要玩mmrpg,有必要玩网页游戏吗?对开发者来说:
优点:模式清晰,参考众多。(大部分网络游戏都可以作为参考)
缺点:策划难度高,技术难度高。

4、经营模式游戏。
武林足球经理、XBA篮球经理。
经营类游戏在游戏消耗上,和成就感上比较难处理。毕竟不是单机的经营游戏。
如果策划够强,经营类游戏是很好的选择。
那么,作为开发者来说,选择哪一类入手呢?
从程序的角度上来说,不管哪一类,都需要六个系统。

二、网页游戏六大系统

1、经济系统。
经济系统包括:商店、拍卖行、生产或打工场所、道具和资源。

生产或打工场所通过 玩家 消耗时间 产生道具和资源
商店 让玩家和系统进行道具和资源的交互。
拍卖行 让玩家和玩家之间进行道具和资源的交互。
2
、消耗系统。(战斗、战争、比赛系统。)
不论是哪一类网页游戏。都是以下12个模式中选择某几个组合。
1玩家vs 1 NPC
N
玩家 vs 1 NPC
N
玩家 vs N NPC
1
玩家vs 1玩家
N
玩家 vs 1 玩家

N 玩家 vs N 玩家
1
团队 vs 1 NPC

N团队 vs 1 NPC
N
团队 vs N NPC
1
团队 vs 1团队
N
团队 vs 1团队

N团队 vs N团队
比如,无心宠物,就包括了
1玩家vs 1 NPC
1
玩家vs 1玩家
比如,战神世界,就包括了
1
玩家vs 1 NPC
1
玩家vs 1玩家
1
团队 vs 1团队
N
团队 vs 1团队
3、消息系统。
短信息,系统通知,游戏内邮件等等。
4
、任务系统。
任务系统是对以上系统功能的集合。有了功能,自然就有了任务发挥的空间。
5
、公会系统。
游戏始终是人跟人玩。所以公会系统是重中之重。
6
、地图系统。
虚拟的世界环境。可以是复杂的图片地图,也可以只是几个数字。

分析6类系统到底是做什么
1、经济系统。
相信大多数开发者都做过电子商务类型的网站吧,要不商店类型的网站做过吧。

再不然,一个产品列表总做过吧。
ok,
网页游戏中的商店跟一般的网站商店非常类似,而且可能更简单,因为你不需要购物车。

拍卖行,如果你用过淘宝、易趣的拍卖功能,你就知道是怎么回事了。
经济系统的难点是:
生产或打工场所道具和资源
生产或打工场所
你至少需要完成一个计时器,一个生产类,一个打工类。
生产类和打工类都只需要有:
开始() 过程() 结束()
开始():数据初始化。如判断体力是否够啊。材料是否够啊之类的。
过程():可以什么都不做。
结束():产生了什么产品。
计时器用来配合处理什么时候执行开始(),什么时候执行结束()
道具和资源:
道具最好整合到一个表里。加上如itemtype(道具类型),itemaddtype(道具增加属性类型),itemaddpoint(道具增加点数)之类的字段。
你可以很好的处理装备、药品等等。

2、消耗系统。
消耗系统比经济系统复杂。因为它涉及到一个个具体的功能模型。

比如1玩家vs 1 NPC的模型。
你可以通过纯js处理,也可以通过ajax配合后台编程语言处理。
比如一个完整的过程:
1
、获得初始数据。开始计时。
2
、模型过程。比如攻击一次,攻击XX个回合。
  
判断,循环模型过程,或模型结束。

3、模型结束。返回数据。
难点在模型过程。当然,你可以简单的,提交模型数据后,等待多少分钟,返回另一堆数据。目前很多网页游戏就是这样处理的。
你也可以做得很复杂。比如做成即时的回合模型。(例如无心宠物的商业版玩家战斗模型)
甚至你够牛叉的话,你做成战棋类模型。当然,这个对策划,对程序都是严峻的考验。

最大的问题是:一个模型往往不够,可能需要多个模型。
获取数据、返回数据都是比较简单的。模型功能本身,比较复杂和繁琐。

因此,我强烈建议,模型最好做得具有开放性以及方便扩展。多写几个虚类,多写几个接口,可能会很有好处。

我也参考了一些网页游戏的代码。但是,纯函数的写法,纯过程的写法,写出的模型。。真的好难用。没办法直接用。数据和模型交杂在了一起。Ogame是这样,无心宠物是这样,wog也是这样。

没有足够扩展性的模型,还不如自己写。修改花的时间更多,而且非常不好用。

3、消息系统。

参考一般论坛的短消息功能。很简单。
游戏内邮件,如果可以邮寄物品,那么会困难一些。但是只要前面的道具类完成好了。增加一两个字段不是大问题。

4、任务系统。
整合前面的功能。形成任务链。
大概需要几个表:
1
)任务基础表

id

位置id

任务类型一(打怪/寻宝/等等)

任务类型二(单一任务/连续任务开始/连续任务过程/连续任务结束)

任务进行状态(开始/中断/取消/未接/完成)默认:未接

任务开关文字(连接文字或图片,点击触发)

任务开关图片。

任务文字描述。(说明任务的具体内容)

是否一次性任务。

是否有前置任务。

前置任务id

是否有后置任务。

后置任务id

任务开始NPC

任务结束NPC

2)任务完成条件

id

任务id

任务完成类型 (无条件/需要物品/需要属性/都需要/等)

物品id

物品数量

玩家属性

玩家属性达到值

3)任务完成奖励

id

任务id

物品id

物品数量

玩家属性

玩家属性增加值

任务完成开关文字

任务完成开关图片

4)任务记录表 (记录只能执行一次的任务)

id

角色

任务id

任务进行状态(开始/中断/取消/未接/完成)默认:开始

5)任务临时表

(记录可以多次执行的任务,开始即写入,完成即删除或备份。)

(连续任务,当全部完成时再删除或备份。)

id

角色

任务id

任务进行状态(开始/中断/取消/未接/完成)默认:开始

6NPC

id

NPC名字

NPC图片

NPC对话

任务系统是对前3个系统功能的总结和升华。对游戏性和易玩性相当重要。

5、公会系统。
公会是一个类似虚函数的东西。

公会说,进攻某个地方。

这时候,如果有多个公会玩家去进攻某个地方。从1v1,形成了貌似Nv1
公会本身,不用管玩家到底如何进攻法。
公会系统和任务系统结合。能够产生很强大的游戏成就感。

6、地图系统。
网页游戏的地图系统,其实跟网站导航很类似。
不同的是,网站导航可能只需要几个连接就行了。
地图系统会复杂一些。可能有图片,连接更多,有的还需要自动生成。

有的是XXX*XXX个点(图片或连接)组成。
个人觉得看成是模板就行了。最简单的就是地图系统(不同于网络游戏,还需要检测碰撞、寻路,一大堆算法)。当然,你要做成跟网络游戏很类似的地图,那也没办法。找本游戏开发的书看,都有讲。
总结:
经济系统、消耗系统、消息系统是基础。
任务系统、公会系统是升华。

地图系统是容器。

三、如何分析网页游戏的优缺点
站在开发者的角度:
分析网页游戏,就是分析它的六大系统如何。分析网页游戏的核心,就是分析它的消耗模式。
Ogame模式的游戏:
经济系统:中级,生产场所自动生成。没有单人打工。有商店,拍卖行不健全。道具不丰富。
消耗系统:出兵战斗,等待时间,返回战斗结果。
         
发现敌人有进攻,转移资源。

附加型的英雄模式,对出兵战斗有一定影响。
消息系统:初级,站内短信息。有的加个简单聊天室,大部分是通过论坛。
任务系统:中级,修建任务,获得道具任务,战斗掠夺任务(实质还是获得道具)。
公会系统:中级,集合多人兵力的兵营。没有公会任务。公会内简单的消息发布。
地图系统:中级,有的有图片,有的是数字和列表。表现了一定的距离关系。
Ebs
模式的游戏:
经济系统:初级,通过战斗获得道具和资源。没有打工,没有生产。有商店,拍卖行不健全。道具不丰富。
消耗系统:战斗。继续战斗。
消息系统:初级,站内短信息。
任务系统:初级,不断的战斗。
公会系统:初级,简单的玩家集合。没有公会任务。公会内简单的消息发布。
地图系统:初级,没有地图。或者地图就是几个连接。没有距离关系。
mmRPG
模式的游戏:
经济系统:初级,通过战斗获得道具和资源。没有打工,没有生产。有商店,拍卖行不健全。
消耗系统:战斗、合成。
         
附加型的人物养成。
消息系统:中级,站内短信息,局部聊天室,全局聊天室。

任务系统:中级,战斗任务,传递任务,合成任务,升级任务(其实也是战斗任务)。
公会系统:初级,简单的玩家集合。没有公会任务。公会内简单的消息发布。
地图系统:中级,有地图。有距离关系。地图关系比较复杂。
经营类模式的游戏:
经济系统:中级,有生产场所自动产生资源。有打工,有生产。有商店,拍卖行。
消耗系统:比赛任务、生产场所获得更好效率。

              附加型的人物养成模式。

消息系统:初级,站内短信息。

Task system: Intermediate level, competition tasks, delivery tasks.
Guild system: elementary, simple collection of players. There are no guild quests. Simple news release within the guild.
Map system: elementary, simple map. Some have distance relationships, and some are simple picture connections.
The levels written above are just a general concept and are for reference only.
My personal opinion is that it is possible for an elementary system to achieve qualitative improvement with less investment.
For an intermediate system, it is difficult to achieve higher improvements. Of course, the exception is awesome people.
4. Improve old modes and develop new ones
Ogame mode The game, from a system perspective, doesn't have much room for improvement. Therefore, they are all comparing art and operations.
I haven’t heard of any small company, because games operating the ogame model are quite profitable. Those who make profits are all big companies, some making millions or tens of millions a year.
Ebs
mode game has many areas for improvement. But none of them are improvements to the core consumption system. It's about the improvement of other systems.
Consumption mode to continuously defeat monsters. It has certain shortcomings. The balance of the game is difficult to ensure and maintain. But if a small company operates, it is still possible to make a profit. Including careless pets, EBSII, ready. It’s just that the advertising revenue is considerable. If it works well, 1010,000200,000 a year is not a big problem. But it cannot be compared with Ogame mode games operated by big companies.
mmRPG
mode has a lot of room for improvement and a lot of investment. Competitors are strong. Competitors are online games with clients. This is also the flaw of mmRPG mode web games.
In terms of income, it depends on whether the platform itself is big enough. If it is big enough, it can be maintained. The platform is smaller. Waiting for closure. It is not recommended for individuals or small companies to get involved. But again, except for the awesome people.
The business model has some room for improvement.(其他不太清楚也不太懂)
再回头看看六大系统。
经济系统 消耗系统 消息系统 任务系统 公会系统 地图系统
其中,区别最大的是消耗系统。其他5个系统都有一定程度上的雷同。
因此,个人开发者,以及小开发团队或小公司。
五、要想在竞争中脱颖而出,可以向着四个方向发展。
一、通过策划,让原有的系统的模式产生新的游戏感受。
如: web航海类游戏。基本上都是对Ogame模式的修改值得借鉴。虽然是航海游戏,但核心模式没变。比较巧妙的把Ogame模式转化为了探险类的游戏。

This type of modification repackages 6 systems to a certain extent. It has strong appeal to new players. But for old players, the effect may not be good. Because the pattern hasn't changed.
This direction requires quite strong and sharp planning.
2. Develop a novel consumption system. Or a small interactive game with high gameplay.
For example: the virus game developed by Seven Days Studio. (This link has a certain timeliness. The latest link is on http://www.zhwebgame.com/ . It works within seven days Room group: 70996701)
Because of a well-expandable consumption system, it can be easily added to existing games. And it can also evolve many new consumption systems.
For example, the virus game, through its model, may evolve into a game of real estate grabbing for land; a game of fighting for the highest point in a war, etc.
3. Develop other systems besides consumption systems. In other words, it is called a web game framework.
Because no matter how new and fun your consumption system is; you will always need support from other systems. As for the functions of other systems, it can be said that it is difficult to make major breakthroughs.
The breakthrough is:
How to facilitate data management and modification;

How to easily combine these functions to achieve planning purposes;

How to leave a suitable interface to easily integrate with the consumption system.
4. Integrate existing game systems. For example, RPG+SLG, RPG+

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn