当前位置:网站首页>Robocode Tutorial 4 - robocode's game physics

Robocode Tutorial 4 - robocode's game physics

2022-04-23 18:04:00 dawnsun001

Robocode/ Game physics
Now let's look at Robocode Some physical parameters of .
Coordinate system :Robocode Cartesian coordinate system , That is, the bottom left corner we most often use is (0,0) spot . This is the same as the usual java And c++ Programming is different .

Direction agreement :
【 Absolute direction system 】:Robocode No matter which direction the robot is in, it is the absolute angle with the static battlefield screen as the reference (Heading, Above is 0 Degree angle . That is, to the north is 0, To the East is 90, To the south is 180, To the West 270.
【 Relative direction system 】: The relative direction is based on the dynamics of the robot heading The angle is the angle difference of the reference , No longer refer to the whole static screen . It's called relative because of the robot's heading It's constantly changing as the robot moves ,heading It's just a relative object .
Heading】: Is the angle difference between the robot direction and the top of the screen , The direction is 0 To 360 Between .
Bearing】: It is the angle difference between the target and the direction found by a certain part of the robot, such as radar , Clockwise is a positive angle at -180 To 180 Between .
        
The details are shown in the following figure :


 
Heading
and Bearing The concept of is very important , This is the basis of all control , We must master .


Time and distance :
        Robocode
The basic unit of time is “ticks”, Every robo Every time ticks  Move a unit .Robocode The unit of distance is pixels , But it should be noted that Robocode The distance inside distance yes Double Data of type , So mobile 1.2 A pixel can be realized , in addition , To fit the screen ,Robocode One pixel inside is smaller than the real one .


Other sports Physics :
      
Forward speed : The maximum speed of the tank (Velocity) by 8, Taipa number getVelocity() The tank is back
The speed of . 
      
Add / deceleration : Acceleration is  1  Pixels (pixel)/ frame frame , The deceleration is  2 pixel/frame. 
      
Refer to the formula : set up s For distance ,Vt Is the final speed ,Vo For the initial speed ,t For time ,a  For acceleration : 
      
Bit formula  sVo*ta*t*t/2 
      
Speed formula  Vt Vo a*t 
      
Average velocity formula  v(Vt  Vo)/2s/t 
      
Acceleration Formula  a(Vt  Vo)/t 
See... For more physical rules 《robocode The rules of the game 》

版权声明
本文为[dawnsun001]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230544289512.html