当前位置:网站首页>Robocode教程4——Robocode的游戏物理
Robocode教程4——Robocode的游戏物理
2022-04-23 05:45:00 【dawnsun001】
Robocode/游戏物理
现在我们来了解Robocode的一些物理参数。
坐标系统:Robocode采用了笛卡尔坐标系统,也就是我们最常用的左下角为(0,0)点。这与通常的java与c++编程有所区别。
方向约定:
【绝对方向系】:Robocode中不管机器人在哪个方向都是以静态战场屏幕为参照物的绝对角度(Heading),正上方为0度角。即是向北为0,向东为90,向南为180,向西为270。
【相对方向系】:相对方向是以机器人的动态heading角度为参照物的角度差,不再以整个静态屏幕为参照了。叫它相对是因为机器人的heading是随着机器人移动而不停的在改变,heading只是个相对物体。
【Heading】:是机器人方向与屏幕正上方的角度差,方向在0到360之间。
【Bearing】:是机器人的某个部件如雷达发现的目标与方向的角度差,顺时针为正角度在-180到180之间。
具体如下图所示:
Heading和Bearing的概念非常重要,这是一切控制的基础,必须掌握好。
时间和距离:
Robocode的基本时间单位是“ticks”,每个robo每ticks 运动一个单位。Robocode的距离单位是像素,但是应该注意的是Robocode里面的距离distance是Double类型的数据,所以移动1.2个像素是可以实现的,另外,为了适应屏幕,Robocode里面的一个像素是要比真正的一个像素要小一些。
其他运动物理:
前进速度:坦克最大的速度(Velocity)为8,凼数getVelocity()迒回了坦克当前
的速度。
加/减速度:加速度为 1 像素(pixel)/帧frame ,减速度为 2 pixel/frame。
参考公式:设s为距离,Vt为终速度,Vo为初速度,t为时间,a 为加速度:
位秱公式 s=Vo*t+a*t*t/2
速度公式 Vt =Vo +a*t
平均速度公式 v=(Vt + Vo)/2=s/t
加速度公式 a=(Vt - Vo)/t
更多物理规则见《robocode游戏规则》
版权声明
本文为[dawnsun001]所创,转载请带上原文链接,感谢
https://blog.csdn.net/dawnsun2013/article/details/17718491
边栏推荐
- Understanding and installing MySQL
- Understanding and use of tp50, tp90 and tp99
- Rust 中的 Cell 共享可变指针
- Problems and solutions of database migration
- 小区房价可视化
- Installation and usage skills of idea
- Generation of verification code
- Export the articles written in CSDN to PDF format
- SQL sorts according to the specified content
- 深拷贝和浅拷贝的区别
猜你喜欢
随机推荐
xlsxwriter.exceptions.FileCreateError: [Errno 13] Permission denied问题
Rust 的多线程安全引用 Arc
SQL -- data definition
GNU EFI header file
根据SQL语句查询出的结果集,将其封装为json
Use of multithreaded executors
Type conversion in C #
MySQL table constraints and table design
斯坦福机器学习课程汇总
[leetcode 19] delete the penultimate node of the linked list
Integers have friends interval GCD + double pointer
D. Optimal partition segment tree optimization DP
Cf515b drazil and his happy friends
2. Devops sonar installation
[leetcode 228] summary interval
Cf1427c the hard work of paparazzi
Record the installation and configuration of gestermer on TX2, and then use GST RTSP server
Import of data
20 excellent plug-ins recommended by idea
程序設計訓練







