Considering TGB instead of Max..

Miscellaneous Forums/General Discussion/Considering TGB instead of Max..

Before anyone says anything: I've already spent time browsing through old "TGB vs. Max" threads, but most of them are 5+ months old.

Anyway, recently I've been planning on buying Torque Game Builder for my next project. Aside from it costing too much, I would rather build my game from scratch than off of someone else's engine.

The biggest gimmick that catches my attention is all the separate editors it includes. Mostly the map editor since I haven't had an easy time learning how to do tilemaps in Max. The sprite editor is nice too, but that and the other tools are things I can spend a little bit more time on manually instead (if I must).

I was also going to say "built-in multiplayer" but it only includes turn-based network support in the non-source version. You would have to buy the Pro license with source code to modify that, so in the end it would be just as hard (if not harder) to make multiplayer from scratch in Max.

I guess this all comes down to my horrible ability of understanding 2D maps (scrolling, iso, etc.). I guess this thread is just to help me decide, even though I already have my own opinions. I guess I'm also still just stuck on this whole new language (BlitzMax) since all I have is an unfinished wiki and some tutorials. It's the OOP that's tricky..

Thanks.

The way they show the editors is a bit misleading. Theyre all built into the engine so you kind of have to build around them whether you want to or not.

I have TGB pro and was gonna go that route. All the little tools built into the editor is nice and all, but a few things you should also know about TGB : the way TGB handles coordinates is a bit wacky. Torque script isn't as flexible as you'd think. You have to reload the editor everytime there is a change in the code. The GUI editor is one of the most archaic things ever, getting it to work is another challenge. Map editor is nice for making maps, but tiling is another weird one. Otherwise, its pretty cool. But flexibility is key to me, and i'm back to using BlitzMax...

does it have 0,0 in the center of the screen like the 2D engine did? And is it all vector based crap like 2D engine was? Cuz if it is, they can shove it.

Hey man, that's too bad you might leave.

I haven't had an easy time learning how to do tilemaps in Max ... this all comes down to my horrible ability of understanding 2D maps (scrolling, iso, etc.)


Alright, that's fair. But before you go, could you give my code here a try? I have been
improving and developing this method of map scrolling for years now. I normally wouldn't
just give it away to people, but I like Blitz too much to let people leave. I'd rather
try to help ya.

It's an absolute barebones build that just shows off the basic techniques of fast tilemapping
and zooming. If you spend some time going through the code, you might learn a thing or two.
SuperStrict
AppTitle = "My Experimental Racer v.001"
Global screenX:Int = 800, screenY:Int = 600
Graphics screenX, screenY,0,60

Type userInputType
	Field debug:Int = 1
	Method keys()
		'DELETE DEBUG VARIABLES + RELATED CRAP ... eventually
		If KeyDown(key_lshift) Or KeyDown (key_rshift) Then debug = 5			'hit shift for speedier scrolling/zooming
		If KeyDown(key_escape) Then End
		If KeyDown(key_a) Or KeyDown (key_left) Then camera.xTarget:-16 * debug
		If KeyDown(key_d) Or KeyDown(key_right) Then camera.xTarget:+16 * debug
		If KeyDown(key_w) Or KeyDown (key_up) Then camera.yTarget:-16 * debug
		If KeyDown(key_s) Or KeyDown(key_down) Then camera.yTarget:+16 * debug
		If KeyDown(key_e) Or KeyDown(key_insert) Then camera.zoomTarget:+camera.zoomTarget * camera.zoomTarget * debug *.06
		If KeyDown(key_q) Or KeyDown (key_delete) Then camera.zoomTarget:-camera.zoomTarget * camera.zoomTarget * debug *.06
		debug = 1
	EndMethod
	Method mouse()
	EndMethod
EndType

Type maptype
	'TODO: set imagehandles for terraintiles to the bottom right, so that I can make arbitrary sizes.  (128x1024 ?)
	'That way, I could draw some of the cliffs, hoodoos or buildings etc using the terrain tiles, not objects.
	'(bottom right because the tile draw order is left-to-right, return, left-to-right, return ... and so on.)
	Field worldMap:Int[100,100]
	Field camZoomInverted:Float
	Field xOffset:Float, yOffset:Float, arrayX:Int, arrayY:Int
	Method draw(camX:Float,camY:Float, camZoom:Float)
		xOffset = camX Mod 128
		yOffset = camY Mod 128
		arrayX = camX / 128
		arrayY = camY / 128
		camZoomInverted = 1/camZoom				'this is done here so that I don't have to do it 4 times later.  Speed, you know.
		For Local y:Int = camZoomInverted*-2.4-1 To camZoomInverted*2.4+2
			For Local x:Int = camZoomInverted*-3.2-1 To camZoomInverted*3.2+2
				If x+arrayX> -1 And x+arrayX < 100 Then
					If y+arrayY> -1 And y+arrayY < 100 Then
						SetColor worldMap[x+arrayX,y+arrayY],255,255
						DrawRect (x*128-xOffset)*camZoom+screenX*.5,(y*128-yOffset)*camZoom+screenY*.5,128*camZoom,128*camZoom
'						DrawImage grass[worldMap[x+arrayX, y+arrayY]], (x*128-xOffset)*camZoom+screenX*.52,(y*128-yOffset)*camZoom+screenY*.53
					EndIf
				EndIf
			Next
		Next
		SetScale 1,1
		SetColor 255,255,255
	EndMethod
	Method New()				'-------------debug random map creation
		For Local y:Int = 0 To 99
			For Local x:Int = 0 To 99
				worldmap[x,y] = Rand(255)			'each tile = a different kind of terrain. (ie. 1 = grass01.png, 2 = grass02.png ...)
			Next
		Next
	EndMethod
EndType
Type cameraType
	Field x:Float, y:Float, xTarget:Float, yTarget:Float, zoom:Float = 1.0, zoomTarget:Float = 1.0
	Method update()
		x:+(xTarget-x)*.1
		y:+(yTarget-y)*.1
		zoom:+(zoomTarget-zoom)*.1
		If zoom > 4 Then zoom = 4
	EndMethod
EndType

Type timerType
	Field oneSecondFlag:Int, oneSecondAgo:Int = MilliSecs()
	Method update()
		oneSecondFlag = 0
		If MilliSecs() - oneSecondAgo > 995 Then  'The game refreshes at 60 hz (or 30?), so 980 Millisecs
			oneSecondAgo = MilliSecs()
			oneSecondFlag = 1
		EndIf
	EndMethod
EndType

Global camera:cameraType = New cameraType
Local userInput:userInputType = New userInputType
Local map:mapType = New mapType
Local timer:timerType = New timerType

Local fps:Int, frames:Int, time:Int = MilliSecs()  '-----------for fps counter.  debug

Repeat
	userInput.keys()
	camera.update()
	map.draw(camera.x, camera.y, camera.zoom)
	SetColor 250, 80, 80
	DrawText "FPS:"+fps+", cam x,y,z"+ camera.x+", "+camera.y+", "+camera.zoom, 10,5
	DrawText "USE WASD OR ARROWS TO MOVE.  USE INSERT OR DELETE TO ZOOM", 180, 20
	Flip;Cls
	timer.update()
	'----------------fps counter (debug)
	frames:+1
	If timer.oneSecondFlag Then
		fps = frames
		frames = 0
	EndIf
Until AppTerminate()


I don't mean to toot my own horn here, but it's very efficient, very powerful, reasonably
portable, and the code is as simple as logically possible. I'm offering years of research here,
I'm sure you might find it useful!

That is really good drew, if he doesnt find that useful, nothing will! ;)

Dabz

Thanks everyone!

@ drew: Thanks for the code! I'll have a look at it later when I get home.

I was never planning on leaving Blitz. Mostly because of it's great community, as Drew just demonstrated. I was just having a hard time deciding what to use for this upcoming project.

Thanks again :)

slave labour in india could be an alternative? (or IT outsourcing as its commonly called :p )