Please test my rain system

BlitzMax Forums/BlitzMax Programming/Please test my rain system

i've been playing around with my weather system a bit, and I would like to see what you guys think of it. Any ideas of how to make it better?

Also, what are some weather/camera effects that you would like to see?

http://www.altitude-studios.com/blitzmax/raindemo.zip

I like it looks good, wouldn't mind look at the source:P

also do you have a good open source collision system using arrays I have seen your other one just wanting to know.

Nice one altitudems, looks good, how about randomizing the scale of the splash/ripple anim, might add a bit of variety.
Also I quite like the look of double flashes for lightning, seems more realistic to me, maybe you could try that, sometimes one flash and sometimes two.

Also, what are some weather/camera effects that you would like to see?


You could add some moving cloud shadows when its sunny. (and obviously brighten things up a bit as well)

Really nice.

very nice, i like the split screen also.

Altitudem, if this is another part of your 2d engine then it's looks as if it's going to be fantastic.
Have you got a worklog so people can keep an eye on any progress?

Nice!

I like! Not so much that it obscures the gameplay elements, but enough that it adds atmosphere. Probably could use an occasional larger or smaller splash sprite (they all looked the same size to me), but it is top notch.

Thanks for the support guys. The weather system is part of the game engine I am making. When I have the engine fairly far along I will post the source and maybe turn it into a community project. So far things have been going very smoothly. I will keep uploading demos for you guys so that you can see its progress.

@FBEpyon
What sort of collision code are you looking for again? Give me some more info and give you some source.

@Papa Lazarou
Those are some great ideas keep them coming.

@tonyg
If I get time I might start a worklog, but to be honest I would much rather post my progress in the forums. Not everyone reads the worklogs.

Im lookin for Tilemap(Array) collision thats not sticky

basicly Im looking for collision that if your in a corner you stop, but you can slide against a wall if you are pressing down and left against the wall.. down being the direct you can still move.

@FBEpyon
Give me a few minutes and I'll post some source for you.

very nice.
1. agree with Papa about the ripple sizes
2. lightning/thunder should not make the cam shake. maybe reserve that for an explosion of some sort (bomb, etc)
3. possibly create a storm center that has a varying degree of rain. when storm center is further away, delay between lightning and thunder is greater.
ZAP--BANG! (louder)
ZAP----------------------bang (Softer)

@bradford6
You're right the camera shouldn't shake when lightning strikes, but I just thought it added to the effect. Actualy, thunder can create vibrations, so there you go.
Storm center sounds like a good idea too.

@FBEpyon
Here is your code:
Strict
	
Const MapWidth:Int = 10, MapHeight:Int = 10		'Define map size
Const CellSize:Float = 32								'Define cell size
Global CollisionMap:Int [MapWidth,MapHeight]	'Create map array

Local P1_X:Float, P1_Y:Float					'The player's position
Local P1_AABB:Float [] = [-16.0,0.0,16.0,16.0]	'The player's bounding box


'Create some walls:
CollisionMap[2,2] = 1
CollisionMap[2,3] = 1
CollisionMap[2,4] = 1
CollisionMap[3,2] = 1
CollisionMap[5,5] = 1
CollisionMap[5,6] = 1
CollisionMap[5,7] = 1
CollisionMap[4,5] = 1
CollisionMap[3,5] = 1


Graphics 640,480,0

While Not KeyHit(KEY_ESCAPE)

	P1_X :+ (KeyDown(KEY_RIGHT) - KeyDown(KEY_LEFT)) * 2'Move player along X axis
	P1_Y :+ (KeyDown(KEY_DOWN) - KeyDown(KEY_UP)) * 2	'Move player along Y axis
	
	'Test for collision and seperate objects:
	AABB_To_Map_Collision(P1_X,P1_Y,P1_AABB)
	
	Cls
	
	'Draw Map:
	For Local MapX:Int = 0 To MapWidth - 1
		For Local MapY:Int = 0 To MapHeight - 1
			Local ScreenX:Int = MapX * CellSize
			Local ScreenY:Int = MapY * CellSize
			If CollisionMap[MapX,MapY] <> 0 SetColor 255,0,0 Else SetColor 0,64,0
			DrawRect ScreenX,ScreenY,CellSize,Cellsize
		Next
	Next
	
	'Draw Player:
	SetColor 255,255,255
	DrawRect P1_X+P1_AABB[0],P1_Y+P1_AABB[1],P1_AABB[2],P1_AABB[3]


	Flip
	FlushMem
Wend

Function AABB_To_Map_Collision (_X:Float Var,_Y:Float Var,_AABB:Float [])
	'Convert x/y coordinates to map cell space:
	Local MapCellX:Int = _X / CellSize
	Local MapCellY:Int = _Y / CellSize
	
	Local CollisionDetected:Byte = False
	
	'Loop through each possible collision:
	For Local MapX:Float = MapCellX - 1 To MapCellX + 1
		For Local MapY:Float = MapCellY - 1 To MapCellY + 1
			If MapX >= 0 And MapX <= MapWidth - 1 And MapY >= 0 And MapY <= MapHeight - 1
				If CollisionMap[MapX,MapY] <> 0
					Local Map_AABB:Float [] = [0.0,0.0,CellSize,CellSize]
					'Check for a collision on each axis:
					If (_AABB[0] + _X > Map_AABB[0] + Map_AABB[2] + MapX * CellSize) Continue
					If (_AABB[0] + _AABB[2] + _X < Map_AABB[0] + MapX * CellSize) Continue 
					If (_AABB[1] + _Y > Map_AABB[1] + Map_AABB[3] + MapY * CellSize) Continue 
					If (_AABB[1] + _AABB[3] + _Y < Map_AABB[1] + MapY * CellSize) Continue
					
					'If we get this far we have a collision:
					CollisionDetected = True
					
					'Determine the shortest seperation vector and seperate the object:
					Local vx1:Float,vx2:Float,vx3:Float,vx4:Float
					vx1 = (Map_AABB[0] + MapX * CellSize) - (_AABB[0] + _AABB[2] + _X)
					vx2 = (Map_AABB[0] + Map_AABB[2] + MapX * CellSize) - (_AABB[0] + _X)
					Local vy1:Float,vy2:Float,vy3:Float,vy4:Float
					vy1 = (Map_AABB[1] + MapY * CellSize) - (_AABB[1] + _AABB[3] + _Y)
					vy2 = (Map_AABB[1] + Map_AABB[3] + MapY * CellSize) - (_AABB[1] + _Y)
					If (vy1*-1) < vy2 Then vy3 = vy1 Else vy3 = vy2
					If (vx1*-1) < vx2 Then vx3 = vx1 Else vx3 = vx2
					If vx3 < 0 vx4 = vx3 * -1 Else vx4 = vx3
					If vy3 < 0 vy4 = vy3 * -1 Else vy4 = vy3
					If vx4 > vy4
						_Y :+ vy3
					Else
						_X :+ vx3
					End If
				End If
			End If
		Next
	Next
		
	Return CollisionDetected
End Function



I agree that thunder would shake it a little, i would just reserve the BIG shakes for explosions and such. It is a very cool effect nonetheless!

@altitudems

wow thats some insain code, im still rather new to this.. My old collision system works okay, but lost it and was really basic this one is a bit advance can you put in a little more comments..

if you want email me...

here is what I have now.

Function TESTLINKCOLLISION:Int(COL_X:Int,COL_Y:Int,DIRECTION:Int)

	If DIRECTION = LINK_NORTH
	
		If TILEMAP[(((COL_X+16)+MAP_X)/16),((COL_Y+MAP_Y)/16),LAYER_S] = MASK_SOLID Or TILEMAP[((COL_X+MAP_X)/16),((COL_Y+MAP_Y)/16),LAYER_S] = MASK_SOLID
			LINK_Y = LINK_Y + LINK_SPEED
		EndIf 
	
	ElseIf DIRECTION = LINK_EAST
		
		If TILEMAP[(((COL_X+16)+MAP_X)/16),((COL_Y+MAP_Y)/16),LAYER_S] = MASK_SOLID Or TILEMAP[(((COL_X+16)+MAP_X)/16),(((COL_Y+16)+MAP_Y)/16),LAYER_S] = MASK_SOLID
			LINK_X = LINK_X - LINK_SPEED			
		EndIf
		
	ElseIf DIRECTION = LINK_SOUTH
	
		If TILEMAP[(((COL_X+16)+MAP_X)/16),(((COL_Y+16)+MAP_Y)/16),LAYER_S] = MASK_SOLID Or TILEMAP[((COL_X+MAP_X)/16),(((COL_Y+16)+MAP_Y)/16),LAYER_S] = MASK_SOLID	
			LINK_Y = LINK_Y - LINK_SPEED
		EndIf
		
	ElseIf DIRECTION = LINK_WEST
	
		If TILEMAP[((COL_X+MAP_X)/16),((COL_Y+MAP_Y)/16),LAYER_S] = MASK_SOLID Or TILEMAP[((COL_X+MAP_X)/16),(((COL_Y+16)+MAP_Y)/16),LAYER_S] = MASK_SOLID
			LINK_X = LINK_X + LINK_SPEED			
		EndIf
end function


for the time being im using zelda graphics for testing of my engine once i get everything done I will convert to my own graphics for a oringal title..

I can't get the collision to work right going in two directions :(