This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - apanx
Pages: 1 2 3 4 5 6 7 8 [9] 10
161
« on: November 03, 2015, 12:19:00 PM »
I need a different AI for one of the robots for Pot Luck 2 (Guess which). What I need is other.py (Littlemetalfriend) but for it to raise a linear actuator up to its max when nothing is in the smartzone.
Any ideas?
Don't use smartzones to emulate stuff better handled by code. Make a variant of the Littlemetalfriend.py code You'll figure it out... From: def Tick(self): targets = [x for x in self.sensors.itervalues() if x.contacts > 0] if len(targets) > 0: # TODO: squeeze and push? or whip? self.Input("Lefthook", 0, -100) self.Input("Righthook", 0, -100) else: # TODO: open arms back up? self.Input("Lefthook", 0, 0) self.Input("Righthook", 0, 0) return AI.SuperAI.Tick(self) To: def Tick(self): targets = [x for x in self.sensors.itervalues() if x.contacts > 0] if len(targets) > 0: #When stuff in smartzone. Push Kill trigger self.Input("Kill", 0, 1) else: #When smartzone empty, Fully raise lineal acutator self.Input("RaiseLinAcu", 0, 100) return AI.SuperAI.Tick(self) You can also use self.GetPistonPosition(ID of piston) to make the AI not touch pistons when fully raised.
162
« on: September 22, 2010, 09:03:21 AM »
self.revolution += plus.AI.__getattr__tickInterval__(self)
Why would you do such a horrible thing? Provided self is actually a plus.AI instance:
self.revolution += self.tickInterval
Nice, that works too, I figure this is a more elegant way to do this. Used the old code because the tickInterval attribute did not show up when doing a dir() on plus.AI.
163
« on: September 21, 2010, 12:43:13 PM »
Corollary: the 1/30 second limit also means that apanx's FBS.py uses an unnecessarily low tick interval. It should be able to be increased from 0.001 to 0.0333 with no loss in performance, thus decreasing lag. Short version: There is no 1/30th second limit for the game. Long version: While the getTimeElapsed() only have a resolution of about 1/30th second. The game tries to execute code as fast as the specified tickInterval. When tickInterval is set too low, stuttering occurs as there are not enough processing resources to excecute all instructions fast enough to finish them before the tickInterval is over in the real world. In order to get a higher limit for the RPM measurement, you would have to write your own time measurement code as the resolution of getTimeElapsed() is not enough. Something like the example below. #Measure RPM if (self.GetMotorAngle(self.motorID) > math.pi/3 or self.GetMotorAngle(self.motorID) < 0) and self.measuring == 0: self.revolution += self.tickInterval self.measuring = 1 if self.measuring == 1: self.revolution += self.tickInterval if 0 < self.GetMotorAngle(self.motorID) < math.pi/3 and self.measuring == 1: self.RPM = 50 / self.revolution self.revolution = 0 if self.display != 0: self.RPMhist.append(self.RPM) if self.RPM > self.max_RPM: self.max_RPM = self.RPM self.measuring = 0
164
« on: July 20, 2010, 07:13:57 PM »
Here are the tools: plus.getHealth(bot#, ComponentID) plus.getHitpoints(bot#, ComponentID)
Now go create.
165
« on: March 15, 2010, 03:03:43 PM »
no, I mean make the AW so corupted it launches SHWs
Sorry, laws of physics does not allow that. Can you figure out why? Sometimes, an education can be a real downer, but I rather have that than the alternative.
166
« on: March 14, 2010, 04:52:40 PM »
I need to know what .txt files I edit for the bot to flip higher than normal. Do I need to decompile the bot file first? I want to flip bots to the ceiling with an AW and another bot
I suppose this means something like: Hey guys, which files do I have to modify to increase the burst power for the burst motors? Do I have to readjust the hard drive head alignment, redistribute RAM allocation or is there an easier way? I want to do lame things because it is funny. The answer to that is: You could modify components by extracting all contents of the components.cfz file and edit the txt files for the components. There are better guides out there for how you do that. However, it would be easier, to not say more respectable, to try out some building techniques first before resorting to modding the game.
167
« on: December 16, 2009, 03:54:45 PM »
Winter break is approaching (technically a self-study period) and it seems that I will have time to start working on my RA2 Python guide. However, in order to ensure that I can spend the most time in probing currently less explored areas. I would like everyone to contribute with all the current knowledge in this thread. Which I then will compile and in the end will result in a guide giving a much clearer understanding of how Python is used in RA2. I will not be able to check this thread after the 21st of December, so it can be a bit tight. Thanks in advance to everyone contributing
168
« on: December 14, 2009, 11:57:56 PM »
Created a new AI: return AI.SuperAI.LostComponent(self, id) def Disable(self,btarget): <- Seems to be a space too little, try changing to def Disable(self, btarget): # Disables opponent by charging it at an angle Problem: Crashes RA2, and I don't know how. Help?
Check that part, there seems to be a space missing. What I see immediately. Might discover something more later.
169
« on: December 14, 2009, 03:15:10 PM »
Is there a possibility of a .py that uses the moving action of the FBS.py to just go to the center of the arena and spin there, instead of chasing the other bot?
Yes it is possible. You have to make a custom tactic for it though that has the target set to 0,0,0. I made a thread before about how to integrate custom tactics in the AI python files. Sorry to DP, but I want to show everyone what I did. I added this to popup.py after the bit about not firing until the enemy hits the body:
if self.weapons: targets = [x.robot for x in self.sensors.itervalues() if x.contacts > 0 \ and not plus.isDefeated(x.robot)] fire = False for bot in targets: if not plus.isUpsideDown(bot) or self.CanDriveUpsideDown(bot): fire = True if fire: self.Input(self.trigger, 0, 1) bReturn = AI.SuperAI.Tick(self) return bReturn
def CanDriveUpsideDown(self, bot): MOVE_THRESHOLD = 3.0 <- Tried increasing that to make it less sensitive to random movments? if bot in self.upTrack: t = self.upTrack[bot] if t.invertible: return True else: # check to see if he's moved recently position = plus.getLocation(bot) time = plus.getTimeElapsed() if time - t.last_time > 10: # this record is too old to be reliable t.last_time = time t.last_position = position return False v0 = vector3(t.last_position) v1 = vector3(position) if (v1-v0).length() > MOVE_THRESHOLD: t.invertible = True return t.invertible else: t = UpsideDownTracker() t.last_position = plus.getLocation(bot) t.last_time = plus.getTimeElapsed() self.upTrack[bot] = t return False
The bot still attacks upside down robots. What have I done wrong?
170
« on: September 26, 2009, 07:31:36 AM »
Why the bot turns off weapon sometimes: This is because immobile bots are not counted to the enemy list, so when the only enemy is immobile, the bot detects no more enemies and the Engage tactic that is selected using self.tactics.append(Tactics.Engage(self)) tells the bot to shut down. You could replace the Engage tactic with your own tactic that does not shutdown by following thses instructions. https://gametechmods.com/forums/showthread.php?t=2207While it may seem that the AI might cheat by inputting values over 100 in turn and throttle. The code shows these strings in the routines for them throttle = min(max(throttle, -100), 100) turning = min(max(turning, -100), 100) Which caps the input at 100 and -100
171
« on: September 16, 2009, 10:48:24 AM »
turnFactor = ((h - self.accuracy) * (h - (math.pi - self.accuracy) ) / self.rampupfactor) Is not that obvious  It is the window in radians where the bot moves forward or backwards. So if you have higher value the bot will be less accurate when tracking the enemy. Lower value vill make more likely for the bot to face the enemy before moving forward or backward, making it more accurate.
172
« on: September 16, 2009, 04:20:57 AM »
From chopper.py
def Tick(self): # fire weapon if self.weapons: targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \ and not plus.isDefeated(x.robot)] if len(targets) > 0: for trigger in self.triggers: [B][COLOR=Blue]self.Input(trigger, 0, 1)[/COLOR][/B] return AI.SuperAI.Tick(self)
Change it to
def Tick(self): # fire weapon if self.weapons: targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \ and not plus.isDefeated(x.robot)] if len(targets) > 0: for trigger in self.triggers: [B][COLOR=#0000ff]self.Input(trigger, 0, 100)[/COLOR][/B] return AI.SuperAI.Tick(self)
Wire positive analog control named Fire to flame thrower.
Bot flames when enemy is in smartzone named weapon
174
« on: September 03, 2009, 03:32:44 PM »
Working on python reference stuff, but it will take time. The aim is to give an understanding to how everything works and how python is used in RA2. It will be something like this post https://gametechmods.com/forums/showthread.php?t=2200 but delve more into the python stuff. Yes, the FBS AI is also being worked on. Just having a heap of other stuff to do (report writing, webpage making, book reading and such)
175
« on: July 28, 2009, 07:39:41 AM »
176
« on: July 27, 2009, 12:13:44 PM »
Om my, lots of thought to consider.
Well, one thing with this kind of bots is that some usual conventions that apply for normal bots are not appliable. Mobility for a normal bot consists of moving backwards, forwards and turning. For this kind of FBS, that does not apply. It does not move 'Forward' or Backward' as it is constantly spinning, changing what Forward and Backward is in relation to it.
A FBS can change the direction it is heading virtually instant. It does not need to slow down in order to change heading. If you want a normal bot to change its course by 90degrees, because there is a hole up ahead, it would have to slow down, turn and then speed up. A FBS would just change its direction, keeping the same speed. If someone have played this game Flying Saucer, a FBS' movment control would be like the control of the saucer. You point where you want to go and how fast and it instantly goes in that direction.
The modding of DriveToLocation(actually DriveToWaypoint) would consist of removing the AimToHeading command and adapting the speed control part for use with the FBS.
Flexible stuff is always good. The accuracy will be adjustable in the release version of this code. This is merely a proof-of-concept hack thrown together in order to produce the video. All that is needed for the bot to move "smartly" give it the locations it should move to and plug them into GetHeadingTo, returning the current heading to that navigational code.
A future development for this code is to detach itself from the Turn and Forward controllers and instead control each side seperately. In this way there can be more than one axis of symmetry for FBS, and three-wheeled FBS would be possible.
However, I now use another code for spinmotor control, giving the FBS higher translational capability.
Yet another Video
It is the same bot as before, but with this control scheme, it can move much faster.
177
« on: July 26, 2009, 06:36:54 PM »
# spin up depending on enemy's range enemy, range = self.GetNearestEnemy() self.Turn(100) self.Throttle(0) if enemy is not None: self.DebugString(6, str(self.GetHeading(False))) target = plus.getLocation(enemy) h = self.GetHeadingTo(target, False) if self.GetTurning() > 6: if (abs(h) < 0.3 ): self.Turn(0) self.Throttle(100) self.DebugString(8, "Boost") if (abs(h) > 2.8 ): self.Turn(0) self.Throttle(-100) self.DebugString(8, "Anti-Boost") self.DebugString(7, str(h)) self.DebugString(8, "No Boost")
Well that is what you see right now. Moves a little bit tacky, but it will get better when I have polished it. One thing with FBS is that you dont have to orient them, so you can change direction instantly and have strafing bots.
178
« on: July 26, 2009, 05:54:29 PM »
NICE work apanx!
I've been planning on trying this very concept since I found out about plus.Arena.__setattr__tickInterval__(), but it looks like you beat me to it. How low do you have the tick interval set? How fast can an AI spin before it starts to outpace the ticks? Could you AI something like, say, *shudder* Somebody's Super SnS with a melty brain?
Another cool thing you can do by decreasing the tick interval: measure the RPM of spinners, and make an AI that doesn't attack the opponent until its weapons reach a certain speed.
The Insanity Arena is a nice piece of work too. I knew about the CreateArenaByName function, but I never thought about throwing the bots in the air just before switching in order to keep them from falling through the floor. Genius.
Perhaps you need just a tad less force, though, since that one bot still got thrown out. The tickInterval is set individually for each AI spawned. Standard for AI is 0.125s. The tickInterval for the Arena only applies for the Arena mechanics, (hazards and stuff), standard 0.250s. tickInterval for the bot in the video is set at 0.001s. I have tried 0.0001, but that overtaxes the CPU and makes the game run slow. Assuming that you need an accuracy of 0.1 radians (0.314degrees), which is what is specified for the AimToHeading command, you can have a rotation speed of 100 radians/sec which is little bit short of 1000rpm. Now that does not sound much, but this is RA2 and not real-life. The bot in the first video, (5uCKi n00b) with all its Zteks only reaches a speed of 20radians/sec. Slack off with the accuracy and the RPM limit increases. The code is flexible enough to handle all plain FBS configs. However, there is no real pathfinding incorporated, it just goes straight towards the enemy without regard for own safety. Have to adapt the DriveToWaypoint code for it so it knows how to avoid things like traps.
179
« on: July 26, 2009, 05:23:43 PM »
Add your tactic to your AI.
Like this
from __future__ import generators import plus import AI from AI import vector3 import Arenas import Gooey import math import Tactics
class HaltAndCatchFire(AI.Tactic): name = "HaltAndCatchFire" def Evaluate(self): self.priority = 170 def Execute(self): return True class FBS(AI.SuperAI):
Then instead of the usual self.tactics.append(Tactics.HaltAndCatchFire(self)), write this
self.tactics.append(HaltAndCatchFire(self))
180
« on: July 26, 2009, 02:37:18 PM »
Based on the symptoms and what I guess is a laptop with a nVidia chipset. You are yet another victim of bad bumps. Only hope would be to whine at HP until they fix it for you. Have a look at HPLies.com.
Pages: 1 2 3 4 5 6 7 8 [9] 10
|