i can create a DDA algoritm.. but pixel a pixel.
so what is the best speed for it?
IncrementPixel = 2
For RayAngle = StartAngle To EndAngle Step IncrementAngle
Distance = 0
Wall = 0
RayActualX = RayX
RayActualY = RayY
IncrementStepSin = Sin(RayAngle) * IncrementPixel
IncrementStepCos = Cos(RayAngle) * IncrementPixel
Do While (Wall = 0)
Wall = LevelMap(Floor(RayActualY / MapResolution))(Floor(RayActualX / MapResolution))
If Wall <> 0 Then Exit Do
RayActualX = RayActualX + IncrementStepCos
RayActualY = RayActualY + IncrementStepSin
Distance = Distance + IncrementPixel
Loop
' Cast a ray from the player's position at this angle
' Check for collision with any walls
' Calculate the distance to the collision point
' Draw the wall section on the screen using the distance for perspective
DrawLine CLng(RayX), CLng(RayY), CLng(RayActualX), CLng(RayActualY), vbCyan
'Me.Line (CLng(RayX), CLng(RayY))-(CLng(RayActualX), CLng(RayActualY)), vbCyan
Next RayAngle
these code ins't 100% completed, but what i need is just understand how can i speed up my calculations and win more speed.