- 好友
- 0
- 在线时间
- 745 小时
- 最后登录
- 2020-6-14
见习骑士
- UID
- 116736
- 第纳尔
- 755
- 精华
- 0
- 互助
- 17
- 荣誉
- 4
- 贡献
- 0
- 魅力
- 24
- 注册时间
- 2009-2-22
鲜花( 36) 鸡蛋( 0)
|
本帖最后由 jppjpp 于 2013-11-11 14:47 编辑
战利品撸(loot)法改进:
一、概要
所谓战利品,指的是战斗胜利后,玩家从每个参战敌人的物品栏撸东西,1人撸1次,撸完取最贵96个,特殊战利品不在此列。
战团1.153的战利品算法基本原理就是,每次战后派一个“中间人”把敌人撸一遍,撸满96个物品结束。
潘德3.611的战利品算法有所改进,每次战后派三个“中间人”把敌人撸一遍,撸满288个物品后取最贵96个物品结束。
上述算法都有个问题:不管是撸96个还是撸288个,如果撸满了,剩下的敌人就不撸了。
而玩家的心理期望值是,打完的敌人都能撸到一条裤衩不剩才好,然后拿96个最贵的,撸不撸的出东西看运气。
下面我们实战演练说明问题:
演习男主角:初级斗士。(他当男主角不是因为长得帅,而是这家伙包里只有一双破鞋,撸没撸到一目了然)。
第一次演习:(老算法)玩家 VS “马儿踢死恐惧军团”
第二次演习:(老算法)玩家 VS “马儿踢死恐惧军团”+1500男主角
第三次演习:(新算法)玩家 VS “马儿踢死恐惧军团”+1500男主角
老算法测试:CurLoot是挑选后的战利品,TotalLoot是撸出来的全部战利品,可以看到老算法总共只撸出来288件。
玩家恰好先把男主角的283双破鞋子撸出来了,剩下的900多人的恐惧军团刚撸出5把破刀就满288格物品了,所以283双破鞋加5把破刀后挑出来的96件还是破烂
新算法测试:可以看到新算法总共撸出973件,然后挑96件给你。
|
需要说明的是,由于troop_loot_troop的特性,老算法是能满足大多数情况下的要求的,所以玩家是否采用新算法取决于个人,感觉问题不大也没必要非得改。
另外,我们注重延展性和通用性,新算法别说几千人的战团规模,就是把整个地球人都拉上去干一架,新算法也能把他们撸到一条裤衩都不剩。
二、算法改进思路:
战利品算法有两个基本要求:1是全部撸完,2是挑最贵96件。
满足这两点,玩家就基本上没什么异议了。
按照这个思路,最机械的算法就是:撸满95件后,每撸1件进行比较,始终把最差的1件扔掉,一直到撸完。
这个最机械的撸法如下:- (troop_loot_troop, "trp_temp_troop", "被撸的人", "撸的参数"),
- (troop_sort_inventory, "trp_temp_troop"),
- (troop_ensure_inventory_space, "trp_temp_troop", 1),
复制代码 上面只是代码循环里面的核心部分,实际上还要把扔掉的东西暂存最后加回去,但这个最机械算法是个坑爹算法,所以没必要完善了,大概就是这个意思。
这个最机械算法其实是可以满足要求的,而且看上去很简洁,短短几个代码就搞定了,但他的效率实在是太坑爹了,坑爹就坑爹在“troop_sort_inventory”这个操作上。
粗略估算,1条“troop_sort_inventory”操作在2个物品的情况下相当于6条“assign”操作,95个物品时相当于4500×6=27000条“assign”操作,
再把“troop_sort_inventory”加入到人数循环里,5000个敌人相当于执行135000000条“assign”操作。
实际上我用这个最机械算法撸5000个敌人,大概花了5秒钟才撸出来。
虽然5秒不是很长,人少的时候玩家也感觉不到,但坑爹毕竟是坑爹,修改党毕竟也要讲节操。
所以这个最机械算法应该被抛弃。
三、新算法隆重登场:
为大家看得容易,贴的是PY代码
- (val_div, ":loot_probability", ":num_player_party_shares"),
- ###以上与原代码相同,不贴了
- ###新算法开始
- (assign, ":min_slot", 105), ##最小值SLOT
- (assign, ":min_item_id", 0), ##最小值物品ID
- (assign, ":min_item_modifier", 0), ##最小值物品质量
- (assign, ":min_item_value", 0), ##最小值物品价值
- (assign, ":num_looted_items", 0), ##最终物品数量
- (party_get_num_companion_stacks, ":num_stacks", ":enemy_party"),
- (try_for_range, ":i_stack", 0, ":num_stacks"), ##算法循环开始
- (party_stack_get_troop_id, ":stack_troop", ":enemy_party", ":i_stack"),
- (neg|troop_is_hero, ":stack_troop"),
- (party_stack_get_size, ":stack_size", ":enemy_party", ":i_stack"),
- (try_for_range, ":unused", 0, ":stack_size"),
- (assign, ":loop_control", 0), ##循环控制初始化
- (assign, ":cur_loot_slot", ":min_slot"),
- (troop_loot_troop, "trp_temp_troop", ":stack_troop", ":loot_probability"),
- (troop_get_inventory_slot, ":cur_item_id", "trp_temp_troop", ":cur_loot_slot"), ##取当前物品ID
- (neg|eq, ":cur_item_id", -1), ##核心算法分界线,撸满96件时才开始下面核心算法,撸不满或者撸满后继续撸没撸到就只执行上面5条操作
- (try_begin),
- (eq, ":min_item_value", 0), ##保证下面这些指针初始化只进行一次
- (troop_sort_inventory, "trp_temp_troop"), ##指针初始化时把物品栏排序一下,整个过程就一次,否则也坑爹了
- (store_add, ":unused_1", "trp_temp_array_b", 1),
- (try_for_range, ":init_point_trp", "trp_temp_array_a", ":unused_1"), ##指针trp初始化开始,与原版相同,不过原版这三个trp装东西,我们装指针,只用两个
- (troop_clear_inventory, ":init_point_trp"),
- (store_skill_level, ":init_point_skl1", "skl_inventory_management", ":init_point_trp"),
- (store_sub, ":init_point_skl2", 10, ":init_point_skl1"),
- (troop_raise_skill, ":init_point_trp", "skl_inventory_management", ":init_point_skl2"),
- (try_end), ##指针trp初始化结束
- (try_for_range, ":init_point_slot", 10, 106), ##指针初始化开始,为trp_temp_troop和trp_temp_array_a和trp_temp_array_b建立指针
- (troop_get_inventory_slot, ":init_point_itemid", "trp_temp_troop", ":init_point_slot"),
- (troop_get_inventory_slot_modifier, ":init_point_itemmod", "trp_temp_troop", ":init_point_slot"),
- (call_script, "script_get_item_value_with_imod", ":init_point_itemid", ":init_point_itemmod", 0),
- (assign, ":init_point_itemval", reg0),
- (val_div, ":init_point_itemval", 100),
- (val_max, ":init_point_itemval", 1),
- (store_sub, ":unused_1", ":init_point_slot", 1),
- (troop_set_inventory_slot, "trp_temp_array_a", ":init_point_slot", ":unused_1"),
- (troop_set_inventory_slot, "trp_temp_array_b", ":init_point_slot", ":cur_item_value"),
- (try_end), ##指针初始化结束
- (assign, ":min_slot", ":init_point_slot"),
- (assign, ":min_item_id", ":init_point_itemid"),
- (assign, ":min_item_modifier", ":init_point_itemmod"),
- (assign, ":min_item_value", ":init_point_itemval"),
- (troop_set_inventory_slot, "trp_temp_troop", ":min_slot", -1), ##暂存最小值,抛弃最小值
- (else_try),
- (troop_get_inventory_slot_modifier, ":cur_item_modifier", "trp_temp_troop", ":cur_loot_slot"), ##取当前物品质量
- (call_script, "script_get_item_value_with_imod", ":cur_item_id", ":cur_item_modifier", 0),
- (assign, ":cur_item_value", reg0),
- (val_div, ":cur_item_value", 100),
- (val_max, ":cur_item_value", 1), ##得到当前物品价值
- (try_for_range, ":unused_1", 0, 95), ##价值比较开始
- (eq, ":loop_control", 0), ##控制比较次数
- (try_begin),
- (eq, ":unused_1", 0),
- (neg|gt, ":cur_item_value", ":min_item_value"), ##当前物品低于最小值,直接抛弃
- (troop_set_inventory_slot, "trp_temp_troop", ":min_slot", -1),
- (assign, ":loop_control", 1),
- (else_try),
- (troop_get_inventory_slot, ":next_item_slot", "trp_temp_array_a", ":cur_loot_slot"), ##取下一件物品SLOT,就是比当前大一点的物品
- (troop_get_inventory_slot, ":next_item_value", "trp_temp_array_b", ":next_item_slot"), ##取下一件物品价值
- (try_begin),
- (neg|gt, ":cur_item_value", ":next_item_value"), ##当前物品低于下一件的直接暂存,指针关系保持不变
- (try_begin),
- (eq, ":unused_1", 0),
- (assign, ":min_slot", ":cur_loot_slot"),
- (assign, ":min_item_id", ":cur_item_id"),
- (assign, ":min_item_modifier", ":cur_item_modifier"),
- (assign, ":min_item_value", ":cur_item_value"),
- (try_end),
- (troop_set_inventory_slot, "trp_temp_troop", ":min_slot", -1),
- (assign, ":loop_control", 1),
- (else_try),
- (try_begin), ##当前物品高于下一件的,使第一个下一件成为最小值并暂存
- (eq, ":unused_1", 0),
- (assign, ":min_slot", ":next_item_slot"),
- (troop_get_inventory_slot, ":min_item_id", "trp_temp_troop", ":min_slot"),
- (troop_get_inventory_slot_modifier, ":min_item_modifier", "trp_temp_troop", ":min_slot"),
- (assign, ":min_item_value", ":next_item_value"),
- (troop_set_inventory_slot, "trp_temp_troop", ":min_slot", -1),
- (assign, ":last_item_slot", 0),
- (try_end),
- (troop_set_inventory_slot, "trp_temp_array_a", ":last_item_slot", ":next_item_slot"), ##指针修正开始,暂存指针
- (assign, ":last_item_slot", ":next_item_slot"),
- (troop_get_inventory_slot, ":next_item_next", "trp_temp_array_a", ":next_item_slot"),
- (troop_set_inventory_slot, "trp_temp_array_a", ":cur_loot_slot", ":next_item_next"),
- (troop_set_inventory_slot, "trp_temp_array_a", ":next_item_slot", ":cur_loot_slot"), ##指针修正结束,最小值物品抛弃,其他按序指向下一个
- (try_end),
- (try_end),
- (try_end),
- (try_end), ##核心算法结束
- (try_end),
- (try_end), ##算法循环结束
- (try_begin), ##把最小值物品放回去
- (neg|eq, ":min_item_value", 0),
- (troop_add_item, "trp_temp_troop", ":min_item_id", ":min_item_modifier"),
- (try_end),
- (troop_get_inventory_capacity, ":inv_cap", "trp_temp_troop"),
- (try_for_range, ":unused_1", 0, ":inv_cap"),
- (troop_get_inventory_slot, ":item_id", "trp_temp_troop", ":unused_1"),
- (ge, ":item_id", 0),
- (val_add, ":num_looted_items", 1),
- (try_end),
- (assign, reg0, ":num_looted_items"),
复制代码 |
新算法的基本思路就是,为中间人的物品栏建立指针关系,在撸到有保存价值的物品时加入物品栏并修正指针,然后把最小值物品暂存,开始下次撸。
保证全部撸完,留96件最佳物品,因为你永远不知道下一件会撸出什么,
用指针可以避免大量的重复计算。
四、新算法TXT修改(适用所有采用原版算法的MOD)
还是修改scripts.txt,用记事本打开,找到下面:
party_calculate_loot -1
136 21 1 1224979098644774912 1 1 936748722493063323 2133 2 1224979098644774913 72057594037927936 6 3 1224979098644774914 0 5 2120 3 1224979098644774915 1224979098644774914 110 521 3 1224979098644774916 144115188075856185 1224979098644774915 32 2 1224979098644774916 0 501 3 144115188075856185 1224979098644774915 0 2106 2 1224979098644774915 110 2105 2 1224979098644774915 115 521 3 1224979098644774917 144115188075856185 1224979098644774915 1530 3 360287970189639683 1224979098644774916 1224979098644774917 3 0 501 3 144115188075856185 109 0 2133 2 1224979098644774918 0 4 0 1073742365 3 144115188075856185 0 11 1073742365 3 144115188075856185 0 18 541 3 144115188075856185 0 15 2122 3 1224979098644774919 10 30 2107 2 1224979098644774919 144115188075856246 2108 2 1224979098644774919 100 2108 2 1224979098644774919 1224979098644774913 4 0 541 3 144115188075856185 0 11 1492 1 100 2133 2 1224979098644774920 288230376151711831 2133 2 1224979098644774921 288230376151711865 5 0 541 3 144115188075856185 0 18 2108 2 1224979098644774919 2 1492 1 1 2133 2 1224979098644774920 288230376151711850 2133 2 1224979098644774921 288230376151711866 5 0 2108 2 1224979098644774919 5 1492 1 1 2133 2 1224979098644774920 288230376151711850 2133 2 1224979098644774921 288230376151711866 3 0 2121 3 1224979098644774922 301 288230376151711831 6 3 1224979098644774923 1224979098644774920 1224979098644774921 4 0 2147484189 3 144115188075856185 0 18 2120 3 1224979098644774924 1224979098644774923 1224979098644774922 521 3 1224979098644774925 144115188075856185 1224979098644774924 5 0 2133 2 1224979098644774925 10000 2105 2 1224979098644774925 1000 2108 2 1224979098644774925 3 3 0 4 0 2147483680 2 1224979098644774925 1 2133 2 1224979098644774925 1 3 0 2133 2 1224979098644774926 100 2107 2 1224979098644774926 1000 2108 2 1224979098644774926 1224979098644774925 2107 2 1224979098644774926 1000 2108 2 1224979098644774926 1224979098644774925 2107 2 1224979098644774926 1000 2108 2 1224979098644774926 1224979098644774925 2133 2 72057594037927936 1224979098644774926 1493 2 1224979098644774923 1224979098644774926 3 0 1512 3 360287970189639683 11 1224979098644774919 2105 2 1224979098644774918 1224979098644774919 3 0 2122 3 1224979098644774927 10 3 2107 2 1224979098644774927 144115188075856246 1685 3 1224979098644774928 648518346341351424 22 2105 2 1224979098644774928 10 2107 2 1224979098644774927 1224979098644774928 2108 2 1224979098644774927 8 2108 2 1224979098644774927 1224979098644774913 2120 3 1224979098644774929 360287970189640615 1 6 3 1224979098644774930 360287970189640613 1224979098644774929 1532 1 1224979098644774930 2170 3 1224979098644774931 12 1224979098644774930 2121 3 1224979098644774932 10 1224979098644774931 1521 3 1224979098644774930 12 1224979098644774932 3 0 1 3 936748722493063322 360287970189639683 360287970189640613 1650 2 1224979098644774933 1224979098644774912 6 3 1224979098644774934 0 1224979098644774933 1652 3 1224979098644774935 1224979098644774912 1224979098644774934 2147485155 1 1224979098644774935 1653 3 1224979098644774936 1224979098644774912 1224979098644774934 6 3 1224979098644774937 0 1224979098644774936 4 0 2167 2 1224979098644774938 360287970189640613 32 2 1224979098644774938 0 1539 3 360287970189640613 1224979098644774935 1224979098644774927 5 0 2167 2 1224979098644774939 360287970189640614 32 2 1224979098644774939 0 1539 3 360287970189640614 1224979098644774935 1224979098644774927 5 0 1539 3 360287970189640615 1224979098644774935 1224979098644774927 3 0 3 0 3 0 1532 1 360287970189639683 6 3 1224979098644774937 0 96 2133 2 1224979098644774940 0 2133 2 1224979098644774941 -1 2133 2 1224979098644774942 -1 6 3 1224979098644774930 360287970189640613 1224979098644774929 1540 2 1224979098644774943 1224979098644774930 6 3 1224979098644774944 10 1224979098644774943 1541 3 1224979098644774945 1224979098644774930 1224979098644774944 1542 3 1224979098644774946 1224979098644774930 1224979098644774944 32 2 1224979098644774945 -1 1 4 936748722493063780 1224979098644774945 1224979098644774946 0 2133 2 1224979098644774947 72057594037927936 2108 2 1224979098644774947 100 2111 2 1224979098644774947 1 32 2 1224979098644774947 1224979098644774940 2133 2 1224979098644774940 1224979098644774947 2133 2 1224979098644774941 1224979098644774930 2133 2 1224979098644774942 1224979098644774944 3 0 3 0 32 2 1224979098644774940 0 1541 3 1224979098644774945 1224979098644774941 1224979098644774942 1542 3 1224979098644774946 1224979098644774941 1224979098644774942 1530 3 360287970189639683 1224979098644774945 1224979098644774946 1543 3 1224979098644774941 1224979098644774942 -1 3 0 1540 2 1224979098644774943 360287970189639683 6 3 1224979098644774944 0 1224979098644774943 1541 3 1224979098644774948 360287970189639683 1224979098644774944 30 2 1224979098644774948 0 2105 2 1224979098644774918 1 3 0 2133 2 72057594037927936 1224979098644774918 copy_inventory -1
|
中间红色的代码,改成下面:
party_calculate_loot -1 176 21 1 1224979098644774912 1 1 936748722493063323 2133 2 1224979098644774913 72057594037927936 6 3 1224979098644774914 0 5 2120 3 1224979098644774915 1224979098644774914 110 521 3 1224979098644774916 144115188075856185 1224979098644774915 32 2 1224979098644774916 0 501 3 144115188075856185 1224979098644774915 0 2106 2 1224979098644774915 110 2105 2 1224979098644774915 115 521 3 1224979098644774917 144115188075856185 1224979098644774915 1530 3 360287970189639683 1224979098644774916 1224979098644774917 3 0 501 3 144115188075856185 109 0 2133 2 1224979098644774918 0 4 0 1073742365 3 144115188075856185 0 11 1073742365 3 144115188075856185 0 18 541 3 144115188075856185 0 15 2122 3 1224979098644774919 10 30 2107 2 1224979098644774919 144115188075856246 2108 2 1224979098644774919 100 2108 2 1224979098644774919 1224979098644774913 4 0 541 3 144115188075856185 0 11 1492 1 100 2133 2 1224979098644774920 288230376151711831 2133 2 1224979098644774921 288230376151711865 5 0 541 3 144115188075856185 0 18 2108 2 1224979098644774919 2 1492 1 1 2133 2 1224979098644774920 288230376151711850 2133 2 1224979098644774921 288230376151711866 5 0 2108 2 1224979098644774919 5 1492 1 1 2133 2 1224979098644774920 288230376151711850 2133 2 1224979098644774921 288230376151711866 3 0 2121 3 1224979098644774922 301 288230376151711831 6 3 1224979098644774923 1224979098644774920 1224979098644774921 4 0 2147484189 3 144115188075856185 0 18 2120 3 1224979098644774924 1224979098644774923 1224979098644774922 521 3 1224979098644774925 144115188075856185 1224979098644774924 5 0 2133 2 1224979098644774925 10000 2105 2 1224979098644774925 1000 2108 2 1224979098644774925 3 3 0 4 0 2147483680 2 1224979098644774925 1 2133 2 1224979098644774925 1 3 0 2133 2 1224979098644774926 100 2107 2 1224979098644774926 1000 2108 2 1224979098644774926 1224979098644774925 2107 2 1224979098644774926 1000 2108 2 1224979098644774926 1224979098644774925 2107 2 1224979098644774926 1000 2108 2 1224979098644774926 1224979098644774925 2133 2 72057594037927936 1224979098644774926 1493 2 1224979098644774923 1224979098644774926 3 0 1512 3 360287970189639683 11 1224979098644774919 2105 2 1224979098644774918 1224979098644774919 3 0 2122 3 1224979098644774927 10 3 2107 2 1224979098644774927 144115188075856246 1685 3 1224979098644774928 648518346341351424 22 2105 2 1224979098644774928 10 2107 2 1224979098644774927 1224979098644774928 2108 2 1224979098644774927 8 2108 2 1224979098644774927 1224979098644774913 2133 2 1224979098644774929 105 2133 2 1224979098644774930 0 2133 2 1224979098644774931 0 2133 2 1224979098644774932 0 2133 2 1224979098644774918 0 1650 2 1224979098644774933 1224979098644774912 6 3 1224979098644774934 0 1224979098644774933 1652 3 1224979098644774935 1224979098644774912 1224979098644774934 2147485155 1 1224979098644774935 1653 3 1224979098644774936 1224979098644774912 1224979098644774934 6 3 1224979098644774937 0 1224979098644774936 2133 2 1224979098644774938 0 2133 2 1224979098644774939 1224979098644774929 1539 3 360287970189639683 1224979098644774935 1224979098644774927 1541 3 1224979098644774940 360287970189639683 1224979098644774939 2147483679 2 1224979098644774940 -1 4 0 31 2 1224979098644774932 0 1511 1 360287970189639683 2120 3 1224979098644774939 360287970189640614 1 6 3 1224979098644774940 360287970189640613 1224979098644774939 1532 1 1224979098644774940 2170 3 1224979098644774941 12 1224979098644774940 2121 3 1224979098644774942 10 1224979098644774941 1521 3 1224979098644774940 12 1224979098644774942 3 0 6 3 1224979098644774939 10 106 1541 3 1224979098644774940 360287970189639683 1224979098644774939 1542 3 1224979098644774941 360287970189639683 1224979098644774939 1 4 936748722493063780 1224979098644774940 1224979098644774941 0 2133 2 1224979098644774942 72057594037927936 2108 2 1224979098644774942 100 2111 2 1224979098644774942 1 2121 3 1224979098644774943 1224979098644774939 1 1543 3 360287970189640613 1224979098644774939 1224979098644774943 1543 3 360287970189640614 1224979098644774939 1224979098644774942 3 0 2133 2 1224979098644774929 1224979098644774939 2133 2 1224979098644774930 1224979098644774940 2133 2 1224979098644774931 1224979098644774941 2133 2 1224979098644774932 1224979098644774942 1543 3 360287970189639683 1224979098644774929 -1 5 0 1542 3 1224979098644774941 360287970189639683 1224979098644774939 1 4 936748722493063780 1224979098644774940 1224979098644774941 0 2133 2 1224979098644774942 72057594037927936 2108 2 1224979098644774942 100 2111 2 1224979098644774942 1 6 3 1224979098644774943 0 95 31 2 1224979098644774938 0 4 0 31 2 1224979098644774943 0 2147483680 2 1224979098644774942 1224979098644774932 1543 3 360287970189639683 1224979098644774929 -1 2133 2 1224979098644774938 1 5 0 1541 3 1224979098644774944 360287970189640613 1224979098644774939 1541 3 1224979098644774945 360287970189640614 1224979098644774944 4 0 2147483680 2 1224979098644774942 1224979098644774945 4 0 31 2 1224979098644774943 0 2133 2 1224979098644774929 1224979098644774939 2133 2 1224979098644774930 1224979098644774940 2133 2 1224979098644774931 1224979098644774941 2133 2 1224979098644774932 1224979098644774942 3 0 1543 3 360287970189639683 1224979098644774929 -1 2133 2 1224979098644774938 1 5 0 4 0 31 2 1224979098644774943 0 2133 2 1224979098644774929 1224979098644774944 1541 3 1224979098644774930 360287970189639683 1224979098644774929 1542 3 1224979098644774931 360287970189639683 1224979098644774929 2133 2 1224979098644774932 1224979098644774945 1543 3 360287970189639683 1224979098644774929 -1 2133 2 1224979098644774946 0 3 0 1543 3 360287970189640613 1224979098644774946 1224979098644774944 2133 2 1224979098644774946 1224979098644774944 1541 3 1224979098644774947 360287970189640613 1224979098644774944 1543 3 360287970189640613 1224979098644774939 1224979098644774947 1543 3 360287970189640613 1224979098644774944 1224979098644774939 3 0 3 0 3 0 3 0 3 0 3 0 4 0 2147483679 2 1224979098644774932 0 1530 3 360287970189639683 1224979098644774930 1224979098644774931 3 0 1540 2 1224979098644774948 360287970189639683 6 3 1224979098644774943 0 1224979098644774948 1541 3 1224979098644774949 360287970189639683 1224979098644774943 30 2 1224979098644774949 0 2105 2 1224979098644774918 1 3 0 2133 2 72057594037927936 1224979098644774918 copy_inventory -1
|
~~~~~~~~~~~~~~~~~~~议论~~~~~~~~~~~~~~
五、关于troop_loot_troop
格式:(troop_loot_troop, “中间人”, “被撸的人”, “参数”),
影响撸不撸得到的几个因素:(参数可以提高成功率,但不是100%)
因素一:“被撸的人”物品栏东西越多,成功率越高
因素二:“参数”是决定成功率的第二大因素,参数主要受限于玩家部队人数(分母);据胡乱估计,96格战利品也有道理,初始设计并不认为玩家能在较大劣势下获胜(比如1比3),所以采用玩家部队人数来控制参数大小,进而控制战利品总数规模。在物品栏平均10几个物品情况下,能基本保证千人规模的敌军战利品不爆棚
因素三:战利品质量决定因素不明,应该属于概率,而且是有CAP的概率。中间人存放战利品按格子从小到大,见缝插针,撸满就扔。troop_loot_troop没有返回值
骑砍的MOD系统基本是线性结构的,没有开放循环/跳转等,像(try_for_range, “:var”, 0, 100)这样的只是假循环,MOD系统把里面的语句重复100遍,var并不能使你跳转出来,唯一能做的就是在try_for_range里加一个中断,减少代码重复。
当然系统的事不是我们能够决定的,只有在算法设计上,考虑更多的简单语句,比如GET/SET/ASSIGN和四则运算等,减少大运算量的语句互相嵌套,更多使用指针数组这样有序的概念,比如SLOT,据胡乱估计,SLOT应该就是数组,但SLOT的用法还仅限于保存一些值,可以利用的空间还很多,数组最具优势的地方就在于有序,减少try_for_agent这样坑爹的语句在大运算量场合重复运用。
有兴趣的话,可以开千人战场看部队的刷新速度,看单一party和混合party的速度差异,看有马和没马的差异,1000个初级斗士几乎瞬间就刷出来了,500个萨利昂骑士就比较慢,死了之后留下一堆马后面刷新就像挤牙膏。换个思路,如果agent的SLOT被用在更多的地方,减少try_for_agent,很多值通过get/setSLOT解决,战场效率应该还能提高。
以上是扯蛋,现在结束。因为对这块没好好研究过,况且有些是MOD系统限定的,无法突破。
|
end.
|
评分
-
查看全部评分
鲜花鸡蛋Dyte 在2018-9-6 22:15 送朵鲜花 并说:我非常同意你的观点,送朵鲜花鼓励一下 blackerlt 在2014-1-5 19:54 送朵鲜花 并说:这样的好帖我居然才看见 左手晨曦 在2013-11-26 21:39 送朵鲜花 并说:反正看着代码我是晕了,求小白鼠 星海晦暝 在2013-11-11 19:52 送朵鲜花 并说:求小白鼠 280701275 在2013-11-11 10:06 送朵鲜花 并说:嘿嘿,以后打叛变骑士更舒服了,打精灵妈妈再也不用担心我损兵折将了 妖精的眼泪 在2013-11-10 19:16 送朵鲜花 并说:楼主有心了~~~
|