当前位置:网站首页>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
边栏推荐
- lambda expressions
- 4. Print form
- Framework analysis 2 Source code - login authentication
- How to grow at work
- Solution to the trial of ycu Blue Bridge Cup programming competition in 2021
- Rust的闭包类型(Fn, FnMut, FnOne的区别)
- [leetcode169] most elements
- How does MySQL convert stored seconds into dates
- 自动控制原理知识点整合归纳(韩敏版)
- 線性代數第二章-矩陣及其運算
猜你喜欢
Basic knowledge of network in cloud computing
Explanation of login page
基于Sentinel+Nacos 对Feign Client 动态添加默认熔断规则
Addition, deletion, modification and query of MySQL table
基于pygame库编写的五子棋游戏
Substring Inversion (Easy Version)
Export the articles written in CSDN to PDF format
P1586 solution to tetragonal theorem
Algèbre linéaire chapitre 2 - matrice et son fonctionnement
Rust的闭包类型(Fn, FnMut, FnOne的区别)
随机推荐
Framework analysis 2 Source code - login authentication
Plane semi intersecting plate
[leetcode 19] delete the penultimate node of the linked list
Gesture recognition research
线程和进程的关系和区别是什么
GNU EFI header file
8. Integer Decomposition
Integration and induction of knowledge points of automatic control principle (Han min version)
D. Optimal partition segment tree optimization DP
Animation - Introduction to keyframes
Log4j2跨线程打印traceId
Rust 中的 Cell 共享可变指针
Calculation (enter the calculation formula to get the result)
Common sense of thread pool
批量导出Arcgis属性表
DBCP usage
Collections multiple parameter sorting
Class loading and classloader understanding
Best practices for MySQL storage time
St table template