本帖最后由 aliang227 于 2022-6-15 17:57 编辑
# 更新TXT修改方式,有同样问题想自行修改的汽油可以参考下。详见48楼。
# 手头上有源码,但对MS代码不是很精通的汽油,也可以参看8楼,有相对简单点的修改方法。
当玩家通过修改battle_size参数,或用战场人数调节工具修改战场人数上限,把战场人数改到2、300人的时候,野战时会有一个比较规律性的顿卡,配置高的会定时掉帧,配置低的会定时顿一下。
开始我以为是自己代码的问题,后来发现战团原版也会有这个问题。经过多次观察和排查之后,基本锁定了是在lead_charge这个mt里的这个触发器:
- (3, 0, 0, [ (call_script, "script_apply_effect_of_other_people_on_courage_scores"),], [ ]), #calculating and applying effect of people on others courage scores
复制代码
引用的script代码如下:
- # script_apply_effect_of_other_people_on_courage_scores
- # Input: none
- # Output: none
- ("apply_effect_of_other_people_on_courage_scores",
- [
- (get_player_agent_no, ":player_agent"),
- (try_for_agents, ":centered_agent_no"),
- (agent_is_human, ":centered_agent_no"),
- (agent_is_alive, ":centered_agent_no"),
- (neq, ":centered_agent_no", ":player_agent"),
- (agent_get_position, pos0, ":centered_agent_no"),
- (try_begin),
- (agent_is_ally, ":centered_agent_no"),
- (assign, ":is_centered_agent_ally", 1),
- (else_try),
- (assign, ":is_centered_agent_ally", 0),
- (try_end),
-
- (try_for_agents, ":agent_no"),
- (agent_is_human, ":agent_no"),
- (agent_is_alive, ":agent_no"),
- (neq, ":centered_agent_no", ":agent_no"),
- (try_begin),
- (agent_is_ally, ":agent_no"),
- (assign, ":is_agent_ally", 1),
- (else_try),
- (assign, ":is_agent_ally", 0),
- (try_end),
- (eq, ":is_centered_agent_ally", ":is_agent_ally"), #if centered agent and other agent is at same team then continue.
- (agent_get_slot, ":agent_is_running_away_or_not", ":agent_no", slot_agent_is_running_away),
- (try_begin),
- (eq, ":agent_no", ":player_agent"),
- (assign, ":agent_delta_courage_score", 6),
- (else_try),
- (agent_get_troop_id, ":troop_id", ":agent_no"),
- (troop_is_hero, ":troop_id"),
-
- #Hero Agent : if near agent (hero, agent_no) is not running away his positive effect on centered agent (centered_agent_no) fighting at his side is effected by his hit points.
- (try_begin),
- (neq, ":agent_is_running_away_or_not", 1), #if agent is not running away
- (store_agent_hit_points, ":agent_hit_points", ":agent_no"),
- (try_begin),
- (eq, ":agent_hit_points", 100),
- (assign, ":agent_delta_courage_score", 6),
- (else_try),
- (ge, ":agent_hit_points", 75),
- (assign, ":agent_delta_courage_score", 5),
- (else_try),
- (ge, ":agent_hit_points", 60),
- (assign, ":agent_delta_courage_score", 4),
- (else_try),
- (ge, ":agent_hit_points", 45),
- (assign, ":agent_delta_courage_score", 3),
- (else_try),
- (ge, ":agent_hit_points", 30),
- (assign, ":agent_delta_courage_score", 2),
- (else_try),
- (ge, ":agent_hit_points", 15),
- (assign, ":agent_delta_courage_score", 1),
- (end_try),
- (else_try),
- (assign, ":agent_delta_courage_score", 4),
- (end_try),
- (else_try),
- #Normal Agent : if near agent (agent_no) is not running away his positive effect on centered agent (centered_agent_no) fighting at his side is effected by his hit points.
- (try_begin),
- (neq, ":agent_is_running_away_or_not", 1), # if agent is not running away
- (store_agent_hit_points, ":agent_hit_points", ":agent_no"),
- (try_begin),
- (eq, ":agent_hit_points", 100),
- (assign, ":agent_delta_courage_score", 4),
- (else_try),
- (ge, ":agent_hit_points", 75),
- (assign, ":agent_delta_courage_score", 3),
- (else_try),
- (ge, ":agent_hit_points", 50),
- (assign, ":agent_delta_courage_score", 2),
- (else_try),
- (ge, ":agent_hit_points", 25),
- (assign, ":agent_delta_courage_score", 1),
- (try_end),
- (try_begin), # to make our warrior run away easier we decrease one, because they have player_agent (+6) advantage.
- (agent_is_ally, ":agent_no"),
- (val_sub, ":agent_delta_courage_score", 1),
- (try_end),
- (else_try),
- (assign, ":agent_delta_courage_score", 2),
- (end_try),
- (try_end),
-
- (try_begin),
- (neq, ":agent_is_running_away_or_not", 1),
- (val_mul, ":agent_delta_courage_score", 1),
- (try_begin), # centered agent not running away cannot take positive courage score from one another agent not running away.
- (agent_get_slot, ":agent_is_running_away_or_not", ":centered_agent_no", slot_agent_is_running_away),
- (eq, ":agent_is_running_away_or_not", 0),
- (val_mul, ":agent_delta_courage_score", 0),
- (try_end),
- (else_try),
- (try_begin),
- (agent_get_slot, ":agent_is_running_away_or_not", ":agent_no", slot_agent_is_running_away),
- (eq, ":agent_is_running_away_or_not", 0),
- (val_mul, ":agent_delta_courage_score", -2), # running away agent fears not running away agent more.
- (else_try),
- (val_mul, ":agent_delta_courage_score", -1),
- (try_end),
- (try_end),
- (neq, ":agent_delta_courage_score", 0),
- (agent_get_position, pos1, ":agent_no"),
- (get_distance_between_positions, ":dist", pos0, pos1),
- (try_begin),
- (ge, ":agent_delta_courage_score", 0),
- (try_begin),
- (lt, ":dist", 2000), #0-20 meter
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 50),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 4000), #21-40 meter
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 40),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 7000), #41-70 meter
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 30),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 11000), #71-110 meter
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 20),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 16000), # 111-160 meter, assumed that eye can see agents friendly at most 160 meters far while fighting.
- # this is more than below limit (108 meters) because we hear that allies come from further.
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 10),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (try_end),
- (else_try), # negative effect of running agent on other ally agents are lower then positive effects above, to avoid starting
- (try_begin), # run away of all agents at a moment. I want to see agents running away one by one during battle, not all together.
- (lt, ":dist", 200), #1-2 meter, # this would create better game play.
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 15),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 400), #3-4 meter,
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 13),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 600), #5-6 meter
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 11),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 800), #7-8 meter
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 9),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 1200), #9-12 meters
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 7),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 2400), #13-24 meters
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 5),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 4800), #25-48 meters
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 3),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (else_try),
- (lt, ":dist", 9600), #49-98 meters, assumed that eye can see agents running away at most 98 meters far while fighting.
- (agent_get_slot, ":agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
- (val_mul, ":agent_delta_courage_score", 1),
- (val_add, ":agent_courage_score", ":agent_delta_courage_score"),
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":agent_courage_score"),
- (try_end),
- (try_end),
- (try_end),
- (try_end),
- ]), #ozan
复制代码
|
我们在做MOD的时候,对于原版的代码一般都尽量不会动他的框架,更多的是改改判定和数值,因为默认原版的代码要比自己写的好一些。但是这个署名 #ozan 的代码确实不敢恭维。
我们先看看他这个script到底想干嘛:
1,以一个agent为中心,判断周围agent和他的关系。第一个雷点:这个是两个agent循环嵌套,相信有过一定MOD开发经验的作者都会尽量避免这种搞法,因为条件限制不足的话必卡。150战场就是150*150=25500次循环,300人战场就是90000次循环。
2,判断是否在一个队伍,如果是的话就根据周围agent自身的血量,来计算其勇气值(courage_score)。第二个雷点:这个值相同时间内是定的,即使要算,单列出来算只需要循环agent数量次,但是他放在第二个循环内,每次就计算了agent数量个平方次,也就是只需要算300次的东西他给算了90000次。
3,按照中心agent和周围agent的是否逃跑状态,来分为四种情况:
1)中心agent在逃跑,周围agent没逃跑:增加中心agent相应勇气值。也就是让逃跑的人再回头继续打架。
2)中心agent没逃跑,周围agent没逃跑:什么事情也没发生。这是大多数情况,也就是每3秒都在干这个没意义的运算,然后啥事没有。搁这儿挖矿呢……
3)中心agent没逃跑,周围agent在逃跑:减少两倍中心agent的相应勇气值。也就是没逃跑的被逃跑的人动摇了。
4)中心agent在逃跑,周围agent在逃跑:减少中心agent相应勇气值。但是他这块写错了,几个局部变量的混用估计把自己弄糊涂了,这个情况实际是不会生效的,全算在情况3里头了。
4,根据两者的距离来计算倍率,越近影响越大。而远了的呢? 照算不误,只是不加进来。
归纳一下他的想法,agent逃跑时会影响周围一定范围内的人,周围的人如果没跑,那人减勇气,自己加勇气;周围的人如果在跑,两边都减勇气。
因此优化的途径也是把他代码和思路的雷点避开掉:
1,有逃跑的人才开算,而且只循环逃跑的人,没跑的我管他干嘛;
2,把一些不必要放在二次循环的内容单拿出来算,用的时候直接调就行,减少运算量;
3,修正两个人都在跑时的勇气计算
因此我照此思路修改后的代码如下:
1,mt里把原来那个触发器注释掉,修改为以下内容。也就是直到有人跑的时候才开始计算,并把跑的人数和agent_no预先保存下来,以减少循环和计算。
说明一下, slot_item_temp_slot 这个临时slot需要自己预先定义一下,因为ms里没有数组,我就用item随便定义了一个临时slot当数组。当然,如果你用troop/agent之类的都无所谓,看个人习惯了。
- #====== 108 heroes begin ======
- #change
- (3, 0, 0, [
- #(display_message,"@111111"),
- (get_player_agent_no, ":player_agent"),
- (assign,":rout_num",0),
- (try_for_agents, ":agent"),
- (agent_is_human, ":agent"),
- (agent_is_alive, ":agent"),
- (neg|agent_is_routed,":agent"),
- (neq, ":agent", ":player_agent"),
- (agent_slot_eq, ":agent", slot_agent_is_running_away,1),
- (item_set_slot,":rout_num",slot_item_temp_slot,":agent"),
- (val_add,":rout_num",1),
- (try_end),
- (gt,":rout_num",0),
- #(assign,reg1,":rout_num"),
- #(display_message,"@rout num :{reg1}"),
- (call_script, "script_apply_effect_of_other_people_on_courage_scores_new",":rout_num"),#108 heroes changed
- ], [
- ]), #calculating and applying effect of people on others courage scores
- #====== 108 heroes end ======
复制代码
|
2,修改之前的script_apply_effect_of_other_people_on_courage_scores,或者新加个script_apply_effect_of_other_people_on_courage_scores_new以调用。思路也是如上所述:
1,预先计算每个人的勇气值,保存在临时slot里(slot_agent_temp_slot,需要自己先定义下)
2,增加一个入参,只对逃跑的agent周围进行循环,减少循环次数;
3,利用1.168增加的可选范围agent循环,用(try_for_agents, ":agent_no",pos2,160*1000), 将循环范围限制到其判定的最大范围内。但是得记得先(set_fixed_point_multiplier,1000), 然后避开pos0;
4,因为只从逃跑的agent角度出发了,因此以他为中心,判定时就只有两种情况了:
1)周围的agent没跑,那么他自己会扣除中心agent计算出来的勇气值;中心agent则会自己增加周围没跑的agent计算出来勇气值;
2)周围的agent也在跑,那么只让中心agent扣除周围agent计算出来的勇气值;因为周围agent也在逃跑的话,他之后也会循环到,没必要两人都扣,这样就会重复扣2次了。
5,根据两者距离乘以系数,最后附加到相应勇气slot里。
- # script_apply_effect_of_other_people_on_courage_scores_new
- # Input: arg1 = now rout agent number, should have saved to slot_item_temp_slot before
- # Output: none
- # Write by aliang227
- ("apply_effect_of_other_people_on_courage_scores_new",
- [
- (store_script_param, ":rout_num", 1),
-
- (get_player_agent_no, ":player_agent"),
- #count agent_delta_courage_score first, save to slot_agent_temp_slot
- (try_for_agents, ":agent_no"),
- (agent_is_human, ":agent_no"),
- (agent_is_alive, ":agent_no"),
- (agent_set_slot,":agent_no",slot_agent_temp_slot,0),#ini
-
- (agent_get_slot, ":agent_is_running_away_or_not", ":agent_no", slot_agent_is_running_away),
-
- (try_begin),
- (eq, ":agent_no", ":player_agent"),
- (assign, ":agent_delta_courage_score", 6),
- (else_try),
- (agent_get_troop_id, ":troop_id", ":agent_no"),
- (troop_is_hero, ":troop_id"),
-
- #Hero Agent : if near agent (hero, agent_no) is not running away his positive effect on centered agent (centered_agent_no) fighting at his side is effected by his hit points.
- (try_begin),
- (neq, ":agent_is_running_away_or_not", 1), #if agent is not running away
- (store_agent_hit_points, ":agent_hit_points", ":agent_no"),
- (try_begin),
- (eq, ":agent_hit_points", 100),
- (assign, ":agent_delta_courage_score", 6),
- (else_try),
- (ge, ":agent_hit_points", 75),
- (assign, ":agent_delta_courage_score", 5),
- (else_try),
- (ge, ":agent_hit_points", 60),
- (assign, ":agent_delta_courage_score", 4),
- (else_try),
- (ge, ":agent_hit_points", 45),
- (assign, ":agent_delta_courage_score", 3),
- (else_try),
- (ge, ":agent_hit_points", 30),
- (assign, ":agent_delta_courage_score", 2),
- (else_try),
- (ge, ":agent_hit_points", 15),
- (assign, ":agent_delta_courage_score", 1),
- (try_end),
- (else_try),
- (assign, ":agent_delta_courage_score", 4),
- (try_end),
- (else_try),
- #Normal Agent : if near agent (agent_no) is not running away his positive effect on centered agent (centered_agent_no) fighting at his side is effected by his hit points.
- (try_begin),
- (neq, ":agent_is_running_away_or_not", 1), # if agent is not running away
- (store_agent_hit_points, ":agent_hit_points", ":agent_no"),
- (try_begin),
- (eq, ":agent_hit_points", 100),
- (assign, ":agent_delta_courage_score", 4),
- (else_try),
- (ge, ":agent_hit_points", 75),
- (assign, ":agent_delta_courage_score", 3),
- (else_try),
- (ge, ":agent_hit_points", 50),
- (assign, ":agent_delta_courage_score", 2),
- (else_try),
- (ge, ":agent_hit_points", 25),
- (assign, ":agent_delta_courage_score", 1),
- (try_end),
- (try_begin), # to make our warrior run away easier we decrease one, because they have player_agent (+6) advantage.
- (agent_is_ally, ":agent_no"),
- (val_sub, ":agent_delta_courage_score", 1),
- (try_end),
- (else_try),
- (assign, ":agent_delta_courage_score", 2),
- (try_end),
- (try_end),
- (agent_set_slot,":agent_no",slot_agent_temp_slot,":agent_delta_courage_score"),
- (try_end),
-
- #try for running agents
- (set_fixed_point_multiplier,1000),
- (try_for_range,":agent_item_no",0,":rout_num"),
- (item_get_slot,":centered_agent_no",":agent_item_no",slot_item_temp_slot),
- #check again
- (agent_is_human, ":centered_agent_no"),
- (agent_is_alive, ":centered_agent_no"),
- (neg|agent_is_routed,":centered_agent_no"),
-
- (agent_get_position, pos2, ":centered_agent_no"),
- (agent_get_team,":centered_agent_team",":centered_agent_no"),
- (agent_get_slot, ":centered_agent_courage_score", ":centered_agent_no", slot_agent_courage_score),
-
- (try_for_agents, ":agent_no",pos2,160*1000),#max dis is 160m, avoid using pos0
- (agent_is_human, ":agent_no"),
- (agent_is_alive, ":agent_no"),
- (neq, ":centered_agent_no", ":agent_no"),
- (agent_get_team,":agent_team", ":agent_no"),
-
- #if centered agent and other agent is at same team then continue.
- (neg|teams_are_enemies,":centered_agent_team",":agent_team"),
-
- (agent_get_slot,":agent_delta_courage_score",":agent_no",slot_agent_temp_slot),
- (agent_get_slot,":centered_agent_delta_courage_score",":centered_agent_no",slot_agent_temp_slot),
- (neq, ":agent_delta_courage_score", 0),#not 0
- (store_mul,":agent_delta_courage_score_pos",":agent_delta_courage_score",1),
- (store_mul,":agent_delta_courage_score_neg",":agent_delta_courage_score",-1),
-
- #distance count
- (agent_get_position, pos1, ":agent_no"),
- (get_distance_between_positions, ":dist", pos2, pos1),
-
- (try_begin),
- (lt, ":dist", 2000), #0-20 meter
- (val_mul, ":agent_delta_courage_score_pos", 50),
- (else_try),
- (lt, ":dist", 4000), #21-40 meter
- (val_mul, ":agent_delta_courage_score_pos", 40),
- (else_try),
- (lt, ":dist", 7000), #41-70 meter
- (val_mul, ":agent_delta_courage_score_pos", 30),
- (else_try),
- (lt, ":dist", 11000), #71-110 meter
- (val_mul, ":agent_delta_courage_score_pos", 20),
- (else_try),
- (lt, ":dist", 16000), # 111-160 meter, assumed that eye can see agents friendly at most 160 meters far while fighting.
- # this is more than below limit (108 meters) because we hear that allies come from further.
- (val_mul, ":agent_delta_courage_score_pos", 10),
- (else_try),
- (val_mul, ":agent_delta_courage_score_pos", 0),
- (try_end),
-
- # negative effect of running agent on other ally agents are lower then positive effects above, to avoid starting
- (try_begin), # run away of all agents at a moment. I want to see agents running away one by one during battle, not all together.
- (lt, ":dist", 200), #1-2 meter, # this would create better game play.
- (val_mul, ":agent_delta_courage_score_neg", 15),
- (val_mul, ":centered_agent_delta_courage_score", 15),
- (else_try),
- (lt, ":dist", 400), #3-4 meter,
- (val_mul, ":agent_delta_courage_score_neg", 13),
- (val_mul, ":centered_agent_delta_courage_score", 13),
- (else_try),
- (lt, ":dist", 600), #5-6 meter
- (val_mul, ":agent_delta_courage_score_neg", 11),
- (val_mul, ":centered_agent_delta_courage_score", 11),
- (else_try),
- (lt, ":dist", 800), #7-8 meter
- (val_mul, ":agent_delta_courage_score_neg", 9),
- (val_mul, ":centered_agent_delta_courage_score", 9),
- (else_try),
- (lt, ":dist", 1200), #9-12 meters
- (val_mul, ":agent_delta_courage_score_neg", 7),
- (val_mul, ":centered_agent_delta_courage_score", 7),
- (else_try),
- (lt, ":dist", 2400), #13-24 meters
- (val_mul, ":agent_delta_courage_score_neg", 5),
- (val_mul, ":centered_agent_delta_courage_score", 5),
- (else_try),
- (lt, ":dist", 4800), #25-48 meters
- (val_mul, ":agent_delta_courage_score_neg", 3),
- (val_mul, ":centered_agent_delta_courage_score", 3),
- (else_try),
- (lt, ":dist", 9600), #49-98 meters, assumed that eye can see agents running away at most 98 meters far while fighting.
- (val_mul, ":agent_delta_courage_score_neg", 1),
- (val_mul, ":centered_agent_delta_courage_score", 1),
- (else_try),
- (val_mul, ":agent_delta_courage_score_neg", 0),
- (val_mul, ":centered_agent_delta_courage_score", 0),
- (try_end),
- (agent_get_slot, ":agent_is_running_away_or_not", ":agent_no", slot_agent_is_running_away),
- #pos or neg
- (try_begin),#agent is not running
- (neq,":agent_is_running_away_or_not",1),
- (assign,":centered_agent_courage_score_add",":agent_delta_courage_score_pos"),
- (store_mul,":agent_courage_score_add",":centered_agent_delta_courage_score",-2),
- (else_try),#agent is running
- (assign,":centered_agent_courage_score_add",":agent_delta_courage_score_neg"),
- (assign,":agent_courage_score_add",0),
- (try_end),
-
- #set agent score
- (agent_get_slot, ":agent_courage_score", ":agent_no", slot_agent_courage_score),
- (val_add,":agent_courage_score",":agent_courage_score_add"),
- (agent_set_slot, ":agent_no", slot_agent_courage_score, ":agent_courage_score"),
- #set center agent score
- (val_add,":centered_agent_courage_score",":centered_agent_courage_score_add"),
- (try_end),
-
- (agent_set_slot, ":centered_agent_no", slot_agent_courage_score, ":centered_agent_courage_score"),
- (try_end),
- ]),
复制代码
|
至此,应该修复与优化完成了,再进游戏开大战场时,应该不会再有这种3秒一次的卡顿了。如果还有的话,那就是其他代码造成的了。
因为是战团原版代码的问题,因此全MOD应该都是通用的,各位作者可随意使用。
虽然现在战团也差不多快到寿命的尾巴了,但给作品留个疙瘩还是有点难受,可以的话还是尽量避免掉吧。
另外最近还发现另外一个各类MOD可优化的点:如果你的装备贴图dds尺寸不是2的次幂的话,每次看到时载入贴图时将会发生顿卡,可能是会自动拉伸一下的原因,同时发生这种现象的贴图越多,画面会越卡。解决方式就是排查下textures文件夹的所有文件,把所有不合规格的贴图调整为256、512、1024之类的尺寸就好了。似乎只限装备贴图,图片那种mesh载入图之类的好像影响不大。
最后,如果优化完毕后的代码有什么粗心所致的疏忽或逻辑问题,也希望能指正探讨,大家一起学习。
|