TileMax

Community Forums/Showcase/TileMax

_Skully(Posted 2009) [#1]
Hi there,

A fair bit of work done under the hood.. I'm curious how it runs on other machines.. there are still anomalies with the player movement but its getting better.

BTW: This is a split pane view so that my daughters don't argue about whose turn it is to try it out LOL...

Oh, clicking on the lower pane will add dumb actors that just follow the nearest player.. they don't even know how to jump yet :)


TileMax

{edit} Oops.. I labeled the window key controls backwards... 8)
{edit} Fixed that.. and included a new version that constrains the actors apart (so they don't bunch up outside pits)
Cheers


therevills(Posted 2009) [#2]
Pretty smooth on my rig with 250 actors (never dropped below 30):

i920, 6GB, Win7RC1


_Skully(Posted 2009) [#3]
Thanks therevills,

Any weirdnesses / anomalies that you noticed?


Nate the Great(Posted 2009) [#4]
Pretty cool so far. Are you using farseer, and ahh I see why my physics engine wouldnt work for tile max. It needs to be a little more developed to be used as a physics engine for your purposes. BTW if you are using farseer, why not add a bunch of boxes?

anyway, nice job so far.


_Skully(Posted 2009) [#5]
Thanks Nate... no its all custom code so far... extremely basic stuff right now.. I've just added a constraint class with one constraint type (ActorSeparation) that keeps actors at a distance instead of piling on top of each other, but its not working 100% yet... I'm feeling your pain with the balancing act you were talking about LOL

The problem I was having with VerletMax is the same problem I would have with any physics system... mixing pixel collisions with the rest of the lot... and.. with the way the tiles are connected as I explained earlier. So I'm stuck coding my own. The benefits I see with this system will be seen when I add the network code :)

Cheers


_Skully(Posted 2009) [#6]
Well, I found my constraint problem... wasn't the constraint code it was the execution ;)

Updated the DL and Screenshot


InvisibleKid(Posted 2009) [#7]
stayed at about 30, until i got to about 220 actors then dipped to about 27-28.


_Skully(Posted 2009) [#8]
Thanks KingNothing,

Its using a timer to keep it at 30 :) It shouldn't be consuming huge processor time... heres the main game loop :)

'--------------------------------------------------------------------------
Global timer:TTimer=CreateTimer(30)
While Not KeyDown(KEY_ESCAPE)
	WaitEvent()
	If EventSource()=timer Then RunGame()
Wend
'--------------------------------------------------------------------------
EndGraphics
End


I'm happy with 220 since they are interacting with constraints as well now... further optimization allows for deactivating actors while not on screen or within a range of a player as well.

Cheers


Nate the Great(Posted 2009) [#9]
The problem I was having with VerletMax is the same problem I would have with any physics system...


Oh I see. So you are making it network based? I am working with making my game FLOOD online but after some experiments I dont think online real time mass physics is achievable at this point. Let me know if you discover otherwise :)

BTW, nice job on the constraints. Are you using a grid based acceleration system for everything? if not then you definitely should... you should be able to fit thousands of actors in with a grid acceleration, and it wouldnt be nearly as confusing as my physics grid.


_Skully(Posted 2009) [#10]
Sure am.. the tiles are the grids and actors are added to and removed from appropriate tile-Tlists as they move around the map... so when doing the constraints it tests against surrounding tiles (or further if the actor is bigger)

Your game over a network ... yes hard. Maybe if you just send the verlet location/vector information and the client just plays that out until it receives new information...(you would have to smooth the update so it doesn't jerk) and just send client actions back to the server.


MGE(Posted 2009) [#11]
"you should be able to fit thousands of actors in with a grid acceleration"

Assuming fairly high spec cpu/gpu. ;)


_Skully(Posted 2009) [#12]
I don't think I'm going to need over 200 simultaneous actors as it is much less thousands anyway lol but I am all about making it as efficient as possible :) if the game plays well on my laptop I think it should be OK


Nate the Great(Posted 2009) [#13]
Assuming fairly high spec cpu/gpu. ;)


if you assume 2.6 ghz really high spec... Just sayin that maybe tile collisions should be more efficient than my verlet collisions since they involve a sqr() call and tile collisions are generally faster. and a thousand is not that much for certain applications like fluids...

I would say, if you arent, use grids for your actor-tile collisions too. For example, say you have 100 tiles in a scene... and 1 actor, for the scene collisions thats 100 collision checks every frame... now lets say you have 10 actors, thats 1000 checks per frame... 200 actors = 20,000 checks per frame.
Now what if you add the grid formula... maybe a millisecond to place the actors in their grids. then say we have 200 actors... thats only about 200-800 collision checks now with out grid.. :) yay much less than 20,000

for this in action see

http://www.blitzbasic.com/Community/posts.php?topic=86254

edit: this is all just assuming you need more actors... just a big fyi :) and im not sure if you are already doing this or not, if you are then im not sure where you can suck up much more speed from.


_Skully(Posted 2009) [#14]
The way collisions work in TileMax is that actors have "feelers" around them that I call "Appendages"... those are what "feel" for collisions and react to them... so I'm not doing and imagescollide calls just readpixels on surrounding tile pixelmaps

Thats also how the constraints are being done between actors... the actors are stored in a list on each tile and adjusted as they move, so when I compare the actor to other actors I just compare them to surrounding tiles not every actor on the entire map

For example.. here's the setup code for the actors in TileMax
Global player:Actor=actor.CreateActor(ID_Player,TMax.Currentlevel.First,10,10)
player.MaxVelocity=6
player.JumpSpeed=10
player.AddAppendage(-7,0,,False)	' lt arm
player.AddAppendage(7,0,,False)		' rt arm
player.AddAppendage(-3,19,False)	' lt leg
player.AddAppendage(3,19,False)		' rt leg
player.AddAppendage(0,-7)		' head
Local an:Anim=player.CreateAnim("walk left",walksprite,240,296,0.01)
an.AddFrames(0,5,0,4)
an.scaleX=-0.15
an.scaleY=0.15
an=player.CreateAnim("walk right",walksprite,240,296,0.01)
an.AddFrames(0,5,0,4)
an.scaleX=0.15
an.scaleY=0.15
player.SetAnim(an)



Nate the Great(Posted 2009) [#15]
oh, Ive never done a platformer so you kinda lost me there... ah well. you are much more experienced in that area than I am.


_Skully(Posted 2009) [#16]
Just think of the tiles as grids with a given size 32x32 in this case...