Placing bots and AI?

Blitz3D Forums/Blitz3D Programming/Placing bots and AI?

anderstone(Posted 2005) [#1]
What would best the best and fastest way, hopefully with a level editor of some sort, for placing bots and ai without having to put the x,y,z of each one?


asdfasdf(Posted 2005) [#2]
Create a function:
Function CreateBot(bot)

positionentity bot,0,0,0

end function

CreateBot(thebotmesh)


anderstone(Posted 2005) [#3]
Is there anyway where i wouldn't have to use x,y,z cords for everything, like using a level editor. I was just wondering different ways in which people have done this. If worse comes to worse the CreatBot() function will have to be used.


Stevie G(Posted 2005) [#4]
Just knocked up but may be of use ...

Graphics3D 640,480,16,1

Global light = CreateLight()
Global camera = CreateCamera():PositionEntity camera, 0, 50,0
Global Plane = CreatePlane():EntityColor Plane,50,50,250:EntityPickMode Plane, 2
Global Bot = CreateSphere():EntityColor Bot,250,50,50:UpdateNormals Bot:HideEntity Bot
Global BotPivot = CreatePivot()
PointEntity camera, plane

While Not KeyDown(1)

	ML = MouseDown(1)
	MR = MouseDown(2)

	;add bot
	If ML
		CameraPick ( camera, MouseX(), MouseY() )
	 	NewBot =  CopyEntity( Bot , BotPivot )
		PositionEntity NewBot, PickedX(), PickedY(), PickedZ()
		Delay 250
	EndIf
	
	Bots = CountChildren( BotPivot )
		
	;remove bot
	If MR And Bots > 0
		FreeEntity( GetChild( BotPivot , Bots ) )
		Delay 250
	EndIf	
	
	RenderWorld()

	;draw cursor
	Color 255,255,255
	Line MouseX()-16,MouseY(), MouseX()+16, MouseY()
	Line MouseX(),MouseY()-16, MouseX(), MouseY()+16
	
	Text 0,0,"Bots Placed : "+ Bots
	
	Flip

Wend




anderstone(Posted 2005) [#5]
Ok but i need a permanent solution for having the bots on the level. Like they start at a certain spot. Guess ill just use cords for everything.


WolRon(Posted 2005) [#6]
Well, anderstone, you'll have to create a level editor yourself. Stevie G provided you with some starting code. Now modify it to your needs. Add a save function that saves to your own custom file type.

Or you can purchase/download a 3d editor...


anderstone(Posted 2005) [#7]
Well im kinda in a jam thats why i was wondering if there was a level editor available that everyone already uses. Because i do not want to start more projects to get one done.


Luke.H(Posted 2005) [#8]
Mine will let you place bots, etc soon in the next update (some time next week, hopefully):

http://www.blitzbasic.com/toolbox/toolbox.php?tool=123


WolRon(Posted 2005) [#9]
Because i do not want to start more projects to get one done
I think that whether you like it or not, that is what will happen.

Think about it this way. Would you rather type in all of the coordinates by hand for every single object in the game (which may take several attempts for each object due to trying to tweak values), or just do it once, with a level editor?

Either way, you're going to spend time somewhere. The advantage of having the level editor will prove itself useful when you later want to add more levels or Version 2 of the product, or maybe ship a level editor with your product, or maybe slightly modify the editor to work in an entirely different project.


BlackJumper(Posted 2005) [#10]
Give Rob Farley's Droplet a try... and have a root around in the toolbox section for anything else that might help with your project.