




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、receiving monsters, merchants, and other players:processuserhuman: (other player - server processing)cplayerobject - > searchviewrange ();cplayerobject - > operate ();iterate over the list of userlnfolist, calling each userlnfo, s operation in turn to process all the operations in the command
2、queue: the puserlnfo - > action () invokes them pxplayerobject> () call send the sm turn message to the dient based on the dispatch message (rm turn) the gamesrv broadcast new player online (coordinate) messages send player information to the new player (rank, equipment, magic, damage etc.)pla
3、yers, moving objects:traversing the list of m_xvisibleobjectlist, all (player, business, monster) send call addprocess(rm turn sends a message to the surrounding player)traversing mxvisibleltemlist, sending addprocess (this, rm itemshow message update map.traversing m xvisibleeventlist, sending addp
4、rocess (this,rm_ siioweventprocessmonster threads: (monster - server processing)in processmonster gamesrv server thread: create different cmonsterobject object, and join xmonsterobjlist list and pmapcelllnfo - > m_xpobjectlist list, and then call cmonsterobject: : searchviewrange () to update the
5、 line of sight range targets, according to the calculated g searchtable search coordinates, converted to the corresponding map cell, traverse all mobile creatures, join m_xvisibleobjectlist list, calls to operate; the process iterates through the list of m_delayprocessq, filtering out rm_doopenhealt
6、h, rm_struck, and rm_magstruck three events (restoring life values, attacks, magic attacks), and processingprocessmerchants thread: (merchant - server processing)iterate through the g_pmerchantinfo structure (based on the number of nnumof mur chant inf o). get a map of the merchant type, create a me
7、rchant object, set different numbers, coordinates, heads, and a map add the merchant to the map and add the merchant to the list of the g_xmerchants tobjlist merchants2). iterate through g_xin-class, searchviewrange, and update the target for each business persona) . traversing mxvisibleobjectlist,
8、set each pvisibleobject 一 > nvisibleflag 二 0; set the status (delete)b) . search for the list of visibleobjectlist, (initializingserver loads searchtable.tbl when the server is started), and, based on the coordinates, find the corresponding map cel1. then traverse pmapcelllnfo - > mxpobjectlis
9、t list, judge if for os_movingobject flag, call updatevisibleobject function, the function traversal m_xvisibleobjectlist list, if it finds the business object, pvisibleobject - > nvisibleflag 二 1: otherwise, the pnewvisibleobject object, set the nvisibleflag to 2, sets the object to the merchant
10、 entity, and then joins the mxvisibleobjectlist listsummary: loop list, find all the players in the map cell, and add all the players (os_movingobject) to the list of m_xvisibleobjectlistc) . iterate over the list of m_xvisibleobjectlist, (pvisibleobject-> nvisibleflag 二 二 0), deletes the pvisibl
11、eobject objectd) .runrace calls addrefmsg to send sm_turn and sm_hit to the surrounding playersthe client receives the message and handles it accordingly:cgameprocess: : onsocketmessagerecieve joins the m_xwaitpacketqueue queuetraversal m_xvisibleobjectlist queue all moving objects (roles):rm disapp
12、ear (sm disappear) processdefaultpacket functionrm_death (sm_nowdeatii, sm_deatii)chero: : ondeath other playerscactor: : ondeath monster / / g_xgameproc m_xmagiclistrm_turn movesm_turn message processingtraversal the m_xvisibleitemlist queue for all moving objects (maps):rm_itemhide removes the mov
13、ing object from the list of m_stmapitemlistrm_itemshow traverses the m_stmapitemlist, and if it does not exist, create a grounditem structure and join the list of m_stmapitemlisttypedef struct taggrounditemint nrecog;short shtilex;short shtiley;word wlooks;char szitemname l40j; grounditem, * lpgroun
14、ditem;traversal the m_xvisibleeventlist queue all moving objects(events):rm_hideeventrm_showeventpart of the data is not processed, and it is processed by processpacket in the m_xwaitpacketqueue queuecclientsocket: : in the fd_read event of onsocketmessage, packetq pushq presses the received message
15、 into the packetq queue processing the packetq queue data is handled by the cgameprocess: : load () when the ontimer is processed in the cgameprocess: : ontimer:ontimer - > processpacket - > processpacket handles the m_xwaitpacketqueue queue message (the message that was not processed in the o
16、nsocketmessagerecieve function)processpacket function processing flow:handle the player (sm_nowdeath, sm_death, sm_changemap, sm_struck)a. if the message is sm_nowdeath or sm_death, the mxpriorpacketqueue queue is added.b. if the message is sm_changemap calls loadmapchanged, set the scenec. sm_struc
17、k handles the attack (this player, or any other player, npc, etc.).other news: m_xmyhero. struckmsgreassign ()m_xmyhero. m_xpackets pushq.determine whether the message id sent by the server is the same m_xmyhero. m_dwldentity is successful in loginthe user messages that are sent by the server are re
18、trieved.if (ippacketmsg - > stdefmsg nrecog 二 二 m_xmyhero. m_dwidentity)if the server-side game player sends the message itself, then the message is processed otherwise, if it's a message sent by other players (the monster), go through the list of m_xactorlist, determine if the object exists,
19、 and if that doesn,t exist, then based on the type of the stfeature bgender_gender_man: create a chero object and add it to the list of m xactorlistgender woman:gendernpc: create a cnpc object and add it to the list of m_xactorlist_gender_mon: create a cactor object and add it to the list of m_xacto
20、rlistthen pxac> m xpacketqueue pushq then pushes the message into the xpacketqueue list of the objectconclusion: processing processpacket cclientsocket class to accept the message (m_xwaitpacketqueue), to determine whether the server sends a message to their own, with some important message, sent
21、 to your other message processing. join m_xmyhero m_xpacketqueue queue, and then traverse m_xactorlist queue,determine if the players in the message from the server side (npc, monsters), can,t find in the m_xactorlist queue, add m_xactorlist judge a list, and press the message into the pxactor - >
22、; m_xpacketqueue to the npc for handle that event.the message for the xpacketqueue queue is handled by the updatepacketstate of the object, as follows:bool cactor: : updatepacketstate (), bool cnpc: updatepacketstate ()bool chero: : updatepacketstate ().processdefaultpacket function:processing the c
23、gameprocess: : onsocketmessagerecieve with smclearobject message:processing (sm_disappear, sm_clearobject) messages.iterate over the list of m_xwaitdefau1tpacketqueue messagessm_disappear and sm_clearobject:traversing the list of m_xactorlist to clear all the messages in the pxac-> m_xpacketqueue
24、 queuem_xactorlist deletecurrentnodeex (); remove the object from the column.chero * pxhero. (chero *) destroy the playergame loop processing: cgameprocess: : renderscene (int nlooptime) function:the main process is as follows:wmovetime + 二 nlooptime; at wmovetime > 100, blsmovetime is true.handl
25、e the player messages.a. updatepacketstate function:traversing the m_xpriorpacketqueue queue, if sm_nowdeath orsm_deatii messages are there, then the priority is processed.processing the messages in the m xpacketqueue queue.sm_struck:sm_rushsm_backstepsm_featurechanged:sm_openhealth:sm_closehealth:s
26、m_changelight:sm_username:sm_changenamecolor:sm_charstatuschange:sm_magicfire:sm_healthspellchanged:the checkmappeddata function: iterates through the list of m xactorlistcactor: : updatemotionstate (int nlooptime, bool blsmovetime) cnpc: : updatemotionstate (int nlooptime, bool blsmovetime) cmyhero
27、: : updatemotionstate (int nlooptime, bool blsmovetime) deal with your own newschero: : updatepacketstate ()case sm_sitdown:case sm_butch:case sm_featurechanged:case sm_charstatuschange:case sm_openhealth:case sm_closehealth:case sm_changelight:case sm_username:case sm_changenamecolor:case sm_health
28、spellchanged:case sm rush:case sm_backstep:case sm_nowdeath:case sm_death:case smjvalk:case sm_run:case sm_turn:case sm_struck:case sm_hit:case sm_firehit: 案例 sm_longhit: 案例 sm_powerhit: 案例 smjvidehit: 案例 sm_magicfire: 案例 sm_spell:中石油:updatepacketstate ()案例 sm_openhealth:案例 sm_closehealth:案例 sm_chan
29、gelight:案例 sm_username:案例 sm_changenamecolor:案例 sm_healthspellchanged:案例 sm_turn:案例 sm_hit:cactor:updatepacketstate()案例 sm_death: setmotionframe (_mt_m0n_die bdir);案例 smjvalk:setmotionframe (_mt_monjvalk bdir);案例 sm_turn:setmotionframe (_mt_mon_stand bdir);案例 sm_digup:setmotionframe (_mt_mon_appear
30、bdir);案例 sm_digdown:setmotionframe(_mt_mon_appear bdir);案例 sm_featurechanged:案例 sm openhealth:案例 sm_closehealth:案例 sm_changelight:案例 sm_changenamecolor:案例 sm_username:案例 sm_healthspellchanged:案例 sm_backstep: setmotionframe (_mt_mon_walk bdir);案例 sm_struck: setmotionframe (_mt_mon_hitted m_bcurrdir):
31、案例 sm_hit: setmotionframe (_mt_mon_attack_a bdir);案例 sm_flyaxe:案例 sm_lighting:案例 sm_skeleton:收到多个人大,玩家发送的sm_turn消息:由下面对象调用处理:chero:onturn中石油:0nturncactor:0nturn 根据服务器发送的消息,(创建一个虚拟玩家人大,怪物,在客户端), 根据参数,初始化该对象设置(方向,坐标,名字,等级等)o在后面的处 理中绘制该对象到ui界面中(移动对象的ui界面处理)osetmotionframe(mtmonstand, bdir):mbcurrmtn:=mtmonstand m_dwfstframe> m_dwendframe m_wdelay 笫一帧,最后一帧,延迟时间。 3所示。autotargeting自动搜索目标(人大,怪物,玩家等) 4renderobject补偿对象时间5o rendermapti1egridm_xmagiclist,处理玩家魔法后,ui界面的处理。6o m_xsnow> m_xrain m_xflyingtail>
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 二零二五年度保密信息处理保密费及安全保障协议
- 二零二五年度企业办公区场地借用安全责任协议
- 二零二五年度双方知识产权合作协议书范本
- 二零二五年度个人二手房贷款业务委托代理协议
- 二零二五年度房地产并购股权收购协议书合同
- 二零二五年度智能机器人研发合作合伙人协议
- 二零二五年度智慧城市安全系统工程合伙人投资协议
- 2025年度高尔夫球场地板安装与赛事举办保障合同
- 二零二五年度个体服装店股份转让与时尚品牌合作合同
- 二零二五年度企业高级管理人员任职及权益保障合同
- 11471劳动争议处理(第4章)
- 小学语文人教三年级下册 赵州桥-
- 基因治疗课件最新版
- 幼儿园社会领域自我意识活动教案(3篇)
- 识别和获取法律法规管理制度
- 2022“博学杯”全国幼儿识字与阅读大赛选拔试卷
- 2022年老年人健康管理工作总结
- 《碳纤维片材加固混凝土结构技术规程》(2022年版)
- 青岛城园林绿化技术规范
- 《眩晕的诊治》PPT课件(完整版)
- 欧姆龙(OMRON)3G3JZ系列变频器使用说明书
评论
0/150
提交评论