Tiled maps DRAWIMAGE and 3D? whats best?

BlitzMax Forums/BlitzMax Programming/Tiled maps DRAWIMAGE and 3D? whats best?

Trader3564(Posted 2008) [#1]
This might be "yet another" of those topics but what ever i found over the search doesnt entirely awnser my question, i think.

Im working on a 800x600 RPG game with scrolling. I currently have all 32x32 tiles rendered on the screen (includes animated water and such) and a player, and speech bubbles, and basicly the game runs at 45 fps. I think this should have been 50+
I mean, what i want todo is add HUE and HSL effects and als particle effects like fire, and that is where blending and coloring and everything kicks in.
Not to mention i still have to implament a GUI. So im sort of a afraid that its gonne do a drop to 30FPS, which in my opinion, is a bit bad.
Altough, that only is because the "jittering" is what bothers me. E.g. if for some reason 1 frame takes longer to render than the other, you would notice that.
But ive seen some games and demo's that demonstrate like TONS of tiles, and full FPS. i assume that can only be because these engines use Hardware Acceleration?
If so, that maybe i could consider using that? and if it is possible to make a full 2D RPG about the same way as in 2D, but then using a 3D in BlitzMax, without tile bleeding and such... than that might be a good way to gain FPS?
Also, the game is suppose to be cross-platform.


MGE(Posted 2008) [#2]
Blitzmax is 3d. It renders all of the 2d graphics using the 3d hardware pipleline.

You would be surprised at the frame rate of some of those rpg games. A stable consistant 30fps is better than a jittery 45-60fps. So sometimes they slow it down to a constant 30 or even 20fps if needed. Nothing worse than a heaby gui oriented game with a choppy, stuttering frame rate.

And yes, adding particles and a gui, etc, will probably slow your game down even more. Have you looked into some kind of fixed logic handling so your game plays at the same logic rate even if render speed slows or speeds up?

Tile Bleeding: Make sure you put at least 1 empty pixel border around your tiles. This will stop the artifacting.

What are your specs btw? And if possible upload a demo so we can evaluate your frame rate, etc.


Jesse(Posted 2008) [#3]
have you profiled it?

I don't consider myself as a good programmer but I know that most of the fpu are used in graphics. In games nothing is what it seems and as long as something looks good then it's valid. There are alot of tricks used by the pros that make something look impresive even if it's something simple.

Some obvious hints:

Don't draw outsied the view area more than necessary(very important).
Don't draw tiles on top of tiles that are not transparent.
Don't use intense calculations for each tile(figure out the first and sequentially put the rest where possible).
Don't exagerated the amount of animation(animation for realistic look is a frame rate killer).
Limit particles from decent to barely acceptable numbers( as your game permits).
Study other tile engines see what they did. and how the did it. learn from them.

look at this tile engine:
http://www.blitzmax.com/codearcs/codearcs.php?code=1999

it's 800x600 has zooming to where you can see the whole map and baddies, alot of enemies, a basic AI(really basic but none the less), different tile levels and transcitions(land, sand and water), and bonuses. keeps water creatures in water, land creatures in land. it is a self generated tile map and has smart map movement.
The frame rate on my machine goes from 300 fpus(at small section view) to 30fps(at full map view) while not looking choppy or pausing.

I believe that is the same basic engine from where Crimsomland was created:
http://www.crimsonland.com/
I am not saying it's a great game, just that if it is goond enough to make money, it should be be good enough to learn from.

conclusion:

BE CREATIVE


tonyg(Posted 2008) [#4]
What timing method do you use and what profiling have you done?


Brucey(Posted 2008) [#5]
Blitzmax's drawing commands are very generic.
Most things can be done much more efficiently, like using a single-surface for tiles, etc.

However, I have a game here of 24x24 sized-tiles at 71 by 44, with AI running on 100+ tiles and running on "bots", with particle effects etc, and it all easily runs in the default 60fps.

I would guess that you have other issues not directly associated with rendering. Perhaps your design could be improved ?


Trader3564(Posted 2008) [#6]
Brucey, sounds like you got a solution.

Let me post the code guys, i hope this clarifies things.

	'main loop
	Local execution_time:Float = 0
	Local t:Int = MilliSecs() 
	While Not (KeyHit(KEY_ESCAPE) Or AppTerminate() Or cancel) 
		execution_time:+(MilliSecs() - t) 
	 	t = MilliSecs() 
		console.Listen() 
		
	    While execution_time >= update_time
			_Update() 
			UPS.Update() 
			execution_time:- update_time
		Wend
	
		_Render(execution_time / update_time) 
		FPS.Update() 
	Wend


and for tweening


Function _Update()
	player.vx = player.x + Cos(player.angle) * (player.speed * 32) / (1000.0 / Float(update_time)) 
	player.vy = player.y - Sin(player.angle) * (player.speed * 32) / (1000.0 / Float(update_time)) 



Function _Render(tween:Float) 
	Local tx:Int = Int(player.x * tween + player.oldx * (1.0 - tween)) 
	Local ty:Int = Int(player.y * tween + player.oldy * (1.0 - tween)) 


here is the ticker class

Type TTicker
	Field count:Int
	Field timeout:Float = 1
	Field timer:Float
	Field counter:Int
		 
	Method update() 
		If Self.timer < MilliSecs() 
			Self.timer = MilliSecs() + (Self.timeout * 1000) 
			Self.count = Self.counter
			Self.counter = 0
		Else
			Self.counter:+1
		End If
	End Method
End Type



tonyg(Posted 2008) [#7]
Might just be me but the code doesn't help show how you're doing you tile drawing, how your profiling or much of anything else.


Trader3564(Posted 2008) [#8]
Ok. Then what do i do? Post the entire game code? thats quite a lot... hehe.

?


Philip7(Posted 2008) [#9]
This is just a hunch but i think you're double-tweening.
Try removing:

/ (1000.0 / Float(update_time))

From Update

Disclaimer: I may very well be very very wrong.


Trader3564(Posted 2008) [#10]
lol @ disclaimer..

(i will cut you in half!)
http://www.medievalmmog.com


Jesse(Posted 2008) [#11]
You are drawing your player only once per cycle so I doubt that is your problem but the tiles are drawn in the hundreds. The problem might be the way you are processing them. Although, If you are processing your tiles the same way you are processing your player, I can see why that might be a problem. If you don't mind posting the tile code, maybe someone here can help you.


Trader3564(Posted 2008) [#12]
i dont mind pasting the code, its just huge alltogether. I have no idea how to strip it down as its a whole integrated packes with binary loaders and stuff.


Jesse(Posted 2008) [#13]
If you want to post it(just the tile section) or send it to me, maybe I can help you but the more heads to help you the more solutions you will have. Oher than that, you are on your own.


tonyg(Posted 2008) [#14]
Ok. Then what do i do? Post the entire game code? thats quite a lot... hehe.

... or zip it up and make it available as a link?
I still think the best way to go is do some profiling.