Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - spathi

Pages: 1 [2] 3 4
Are there some canonical algorithms for generating the smooth color lookup tables for copper, especially for the semi-metallic gradients on copperbars?  Do you simply move R, G, and B smoothly toward white and back on a sine function to give it the round gradation?

EDIT:  Well, I found this, which you most likely all know about:

I write retro games that need to run on phones so some of the ways of making things look flashy and good have become useful once again.  Everything is a circle.

Cobra / Re: Cobra Retires
« on: October 01, 2013 »
What exactly is Cobra?

General coding questions / Re: Simple 3D transform?
« on: August 27, 2013 »
Thank you.  This is for a game similar to Space Harrier-- needs scaling, pseudo-3D terrain and possibly atmospheric perspective (blending toward sky color toward horizon) and that's about it.

Looks like Shockwave's code is exactly what I needed.

General coding questions / Simple 3D transform?
« on: August 26, 2013 »
I am looking for a very simple method for coding 3D engines similar to those in early demos where things like spinning spheres made of pixels were featured.

Hidden line and surface elimination is not necessary, nor is rotation of the camera.

Something like this would be nice though pixels would satisfy, and shading is not necessary-- I can do that myself with surface normals on a lookup table.  (I do realize what vectorballs are.)

As Z moves away from the camera toward the horizon, how are X and Y transformed by Z?

General coding questions / Re: Pixel Shader Question
« on: August 26, 2013 »
Thank you, kind sir.

Do you have any further information on doing shader operations on video?

General coding questions / Pixel Shader Question
« on: August 26, 2013 »

How difficult would it be to write a shader that does simple per-pixel coloring operations based on previous colors of that pixel?

Is that one of the things that borders on impossible for shaders to do?  Can pixels keep track of their states?

Thank you.

Unfortunately the link shared in that thread appears to be broken.

General coding questions / Re: LISP?
« on: August 26, 2013 »
Holy moley!  Been a year and a half since I initially posted this.

There has been a game released written in Common Lisp.  It's called 2x0ng (that's a zero) and it's sort of an abstract roguelike, in a way.  Reminds me of something out of TRON.

I am mainly studying functional programming in order to get better at other programming, if that makes sense.  I still do not *get* LISP but I have been able to glean a number of benefits out of it, like better understanding of recursion and a number of other things.

I should totally read Land of Lisp.  I have been studying it from SICP, and from the MIT and Berkeley Youtube lectures that go along with that.

General coding questions / Re: HARLAN
« on: July 28, 2013 »
I am going to get on this as soon as I return from vacation.

Does anyone have a function giving rotational impulse force from a collision of 2D vector objects?

This seems like it should be fairly simple to do on the basis of how many degrees object B is traversing with respect to some mass center of object a.  And the closer the traversing tangent line is to the mass center, the more momentum transfers into x/y velocity as opposed to angular velocity.

This doesn't has to be accurate, it only has to look OK.

You're right that I should try it.  I can have precomputed distance fields and real raytracing might not be necessary if I could get specular and shadow.

Hey guys, quick question here.  How many pixels can be raytraced or raymarched per second on a mid-range CPU these days?

The application is this:  I want to do a game similar to 80s style games where there were a limited number of sprites active on screen at once.  The sprites will be depth sprites with a color map (texturemap), a normal map and a height map.  If the sprites were 64x64, how many of them would it be possible to raymarch per second?

Further, what if the raytracing was cached for a few frames?  EG. we raytrace four per frame, and we have a total of twelve onscreen at once, so the shading and hilighting only updates for each object once every three frames?  Are getpixel routines fast enough for this?

Furthermore, perhaps even tilemap tiles could receive some sort of dirtyrect treatment-- the initial picture of a tile would be raytraced, but tiles under the effect of a light or shadow (determined by quick and dirty methods) might also be raytraced.

What if the main light is coming from a standard direction, eg. 45 degrees?

Of course any rational person would use OpenGL.  But I am not a rational person.

Am I chasing my tail here?

Let's say we allowed ten to be raytraced per frame.  If they were 64x64, that ends up being 6400 pixels, or an 80x80 window.  Surely even midrange PCs could handle that, yes?

Any ideas for what could be improved?  Obviously I need to add more clown faces.  A "game over" screen and a "how to play" screen would be good too, it's not exactly self explanatory.

Projects / Crazy Clowns: My first commercial game
« on: July 11, 2012 »
Since Kiri posted his commercial game project, here's mine.  This is just a demo version and I'll be releasing a more fully featured product when I get another project finished.

I'm interested to know what people think of this and how I could improve it.  It's a kid's game but it's actually surprisingly difficult and fun.

It's on Slideme for free here.  They seem to like it quite well, I've had over a thousand downloads since I uploaded it two days ago.

Here is the Windows exe:

If the mods would like to host the HTML5 version right here in this post I can provide that.

Projects / Re: Voronoi
« on: July 11, 2012 »
Turned it into a screen saver / high toy.  (Doesn't actually screensave, my screensaver module broke a number of Blitz revisions ago...)

An exe is here:

Projects / Re: Voronoi
« on: July 11, 2012 »
Can you think of any way to make it faster?

Originally I was walking the pixels brute force, but that was extremely slow-- [centroid number] distance checks for each pixel.  Adding the recursion made it far faster and it's now seemingly just as fast for huge images.

Perhaps I can use binning and check only the few closest centroids to the bin that a pixel is in.  That should decrease the number of distance checks gigantically. 

Projects / Voronoi
« on: July 10, 2012 »
Voronoi diagrams are apparently a rather bonecrushing algorithm.  I forget the O notation but the best possible is pretty slow.  Adding recursion sped it up hugely.  I'm doing this for a reason but I thought it was interesting enough to share.

It seems like you could pretty easily cull the tree by running paths between different regions, bailing out on the second region, and building up a list, per centroid, of neighbors.  Probably the smart people already thought of this.

If you watch you'll see some very strange artifacts around some of the edges.  I'm not quite sure why they are in there, probably some sort of precision error.

Code: [Select]
Global WIDTH=1024
Global HEIGHT=768
Global mode# = 0

Type voronoipoint
Field x#,y#
Field r#,g#,b#
Field id#

' bounding box for region
Field ux#,uy#,lx#,ly#

Method randomize()
x = Rand(WIDTH)
y = Rand(HEIGHT)
ux = x
uy = y
lx = x
ly = y
End Method
End Type

Global vpointlist:TList = New TList

For Local i# = 1 To 32
Local tempvpoint:voronoipoint = New voronoipoint
tempvpoint.randomize() = i

Function closestvpoint:voronoipoint(x#, y#)  ' returns closest voronoi point for x and y
Local closestpoint:voronoipoint = New voronoipoint
Local closestdistance:Double = 10000
Local nextclosestdistance:Double = 10000
Local p:voronoipoint = New voronoipoint
For p = EachIn vpointlist
Local thisdistance:Float = Distance(x, y, p.x,p.y)
If thisdistance < closestdistance
nextclosestdistance = closestdistance
closestdistance = thisdistance
closestpoint = p
Return closestpoint
End Function

Function thesame(a#,b#,c#,d#)
If a=b And a=c And a=d
Return True
Return False
End Function

Global p1:voronoipoint = New voronoipoint
Global p2:voronoipoint = New voronoipoint
Global p3:voronoipoint = New voronoipoint
Global p4:voronoipoint = New voronoipoint
Global tempvor:voronoipoint = New voronoipoint

'Function voronoirecursive(ax, ay, bx, by, cx, cy, dx, dy)

Function voronoirecursive(ux, uy, lx, ly, recursions#)

If recursions < 5 And KeyDown(KEY_ESCAPE) recursions = 1000

If recursions < 12

' check all four points clockwise

If thesame(,,,
Local midpointx# = ux + ((lx-ux)/2)
Local midpointy# = uy + ((ly-uy)/2)

SetColor p1.r,p1.g,p1.b
DrawRect ux, uy, lx-ux, ly-uy
SetColor 0,0,0

' Increase extents of bounding box
If ux < p1.ux p1.ux = ux
If lx > p1.lx p1.lx = lx
If uy < = uy
If ly > = ly

If mode = 2 Or mode = 3 drawhollowrect(ux,uy,lx,ly)
If recursions < 7 Flip
Return True
midpointx# = ux + ((lx-ux)/2)
midpointy# = uy + ((ly-uy)/2)
voronoirecursive(ux, uy, midpointx, midpointy, recursions+1)
voronoirecursive(midpointx, midpointy, lx, ly, recursions+1)
voronoirecursive(ux, midpointy, midpointx, ly, recursions+1)
voronoirecursive(midpointx, uy, lx, midpointy, recursions+1)

EndIf  ' bailing out because recursions too high
End Function

Function lefthalf:Object(data:Object)
End Function

Function righthalf:Object(data:Object)
End Function

While Not KeyDown(KEY_ESCAPE)
Local p:voronoipoint = New voronoipoint
'Local thread1:TThread=CreateThread(lefthalf,"")
'Local thread2:TThread=CreateThread(righthalf,"")


'Local tv:voronoipoint = New voronoipoint
'For tv = EachIn vpointlist

Local tv:voronoipoint = New voronoipoint
For tv = EachIn vpointlist
SetColor 255,255,255
'drawhollowrect(tv.ux,, tv.lx,

Local ticks = 0

For tv = EachIn vpointlist
SetColor 255,255,255
If mode = 1 Or mode = 3 drawhollowrect(tv.ux,, tv.lx,
If mode = 5 Or mode = 3 DrawRect tv.x-2,tv.y-2, 5,5

ticks = ticks + 1

Until MouseDown(1) Or ticks > 200

For tv = EachIn vpointlist

mode = mode + 1
If mode > 5 mode = 0


'get 4 points
' if all the same, color according to closest and bail.
' else subdivide

Function drawhollowrect(ux, uy, lx, ly)
DrawLine ux, uy, lx, uy
DrawLine lx, uy, lx, ly
DrawLine lx, ly, ux, ly
DrawLine ux, ly, ux, uy
End Function

Function Distance(Point1X,Point1Y,Point2X,Point2Y)
  'calculate the x/y distances
  dX = Point1X - Point2X
  dY = Point1Y - Point2Y

  'calculate exact distance
  'Sqr() always returns an absolute value
  Return Sqr( (dx^2) + (dy^2) )
End Function

C / C++ /C# / Re: Good Features for Sprite Library?
« on: April 07, 2012 »
That's true, Hellfire, and what I am making is at least partly a harvested framework, but when you're polishing up each part of it, it does make sense to add a few more things.  I know what I need in my games and instead of just writing those things I am making an effort to generalize them so that they are usable in a wider context.

C / C++ /C# / Re: Good Features for Sprite Library?
« on: April 07, 2012 »
Blitz doesn't quite have the per-pixel processing power for normal-mapped sprites, at least not in its 2D library.  It will do OpenGL though and that could look really nice. 

I was thinking of actually writing some sort of normal-mapping system that would use alphablending of lights from 4 angles (lit from north, south, east or west, then blending from those 4 directions depending on where the light was) but if I am going to go the 3D modeling route I will just do OpenGL.

I've also been thinking of making a procedural ship generator that "evolves" shooter enemies out of numerous component sprites.

C / C++ /C# / Re: molecular display
« on: April 06, 2012 »
GLUT does absolutely run in windows 7.  You have to install the GLUT libraries manually and put them in your link path and your compile command, eg. -lGLUT or the like.

Pages: 1 [2] 3 4