type
status
date
slug
summary
tags
category
icon
password
Property
Nov 17, 2022 10:15 AM
任务目标
找到任意一只年兽并截图;
实现寻找玩家自己附近年兽的程序;
正确回答年兽的Actor Name;
提交年兽的世界坐标,每找到一只年兽得一部分的分数;
实现自动瞄准玩家自己附近的年兽的程序,需要阐述具体实现原理;
击杀任意一只年兽,拾取掉落物并截图;
分析并实现自动击杀玩家自己附近年兽的程序,需要阐述具体实现原理。
分析过程
开始之前
直接用的初赛APP,GName和GWorld可以直接沿用初赛的
寻找年兽
根据题目中随机分布的、透明的且随机移动的年兽可以判断,想手找基本上是找到死都找不到的。
绘制所有距离在500m以内的actor。
在军事基地外找到一只 BP_GameForPeace_C 开枪发现没掉血,而且也没动,最开始以为不是年兽,继续找了大半个地图没找到一只会动的年兽。

第二局在P城外再次发现 BP_GameForPeace_C, 而且会到处跑,初步确认这玩意就是年兽。

导出SDK,搜索BP_GameForPeace_C,根据父类类名中的TreasureBeast确定这就是年兽





想顺手杀了拿物资,结果身上子弹全部打完了这个东西都没有死,在SDK中找到血量的偏移并进行绘制
结果发现这玩意还锁血到10点了,离大谱。
后发现毒圈能够击杀年兽,掉落一张3周年工卡。

发现使用拳头可以击杀年兽,会掉落一张3周年工卡

世界坐标如图,SpawnTriggerLocation 为 (0,0,0) ,未找到年兽出生点位置,在内存中搜索 BP_GameForPeace_C 对应ID,未发现其他实体。在内存中搜索年兽对应坐标,大约有14个结果,一个个去看,在附近未找到其他年兽坐标。




在SDK内搜索Beast发现
测试可知,年兽有20只,有三个疑似刷新点,位于出生岛

自动瞄准
瞄准算法流程:
- 获取相机位置 cameraLocation,旋转角 cameraRotator
- 获取年兽位置 targetLocation
- 求差值 diff = targetLocation - cameraLocation
- 计算 ( 常量 angleToRad = 180.0f / PI ) Pitch = atan2f(diff.Z, sqrt(diff.X * diff.X + diff.Y * diff.Y)) * angleToRad Yaw = atan2f(diff.Y, diff.X)
- 判断 Pitch 值
- 计算 Pitch、Yaw 与 cameraRotator 中 Pitch、Yaw 的差值
- 得出最终结果
自瞄实现:
将算法得出的值写入内存 PlayerController → RotationInput
自动击杀
在内存中发现年兽时,通过内存写 Pawn → ControlInputVector 移动到目标年兽附近,到附近后模拟点击攻击键击杀年兽。