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
21
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:

http://demo-effects.sourceforge.net/

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.

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

23
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.

24
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.)

http://www.youtube.com/watch?v=XUGHoqM7myk

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

25
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?

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

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?

27
Thank you.

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

28
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.

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

30
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.

31
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.

32
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?

33
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.

34
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.

http://www.kongregate.com/games/GloamingSend/crazy-clowns

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.

http://slideme.org/applications?text=crazy%20clowns

Here is the Windows exe:

https://www.dropbox.com/s/qj6gsd5lol98onf/crazyclowns.zip

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

35
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:

https://www.dropbox.com/s/j71d12e7h43a3wc/voronoi.exe

36
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. 

37
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]
' VORONOI CREATOR PRO
' BROKEN BY SPATHI MCZOQFOT AND THE WAREZIRD
' GREETS TO SUPERPIRATES 612
Global WIDTH=1024
Global HEIGHT=768
Graphics WIDTH,HEIGHT
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
r=Rand(255)
g=Rand(255)
b=Rand(255)
End Method
End Type

Global vpointlist:TList = New TList

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

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
EndIf
Next
Return closestpoint
End Function

Function thesame(a#,b#,c#,d#)
If a=b And a=c And a=d
Return True
Else
Return False
EndIf
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
p1=closestvpoint(ux,uy)
p2=closestvpoint(lx,uy)
p3=closestvpoint(lx,ly)
p4=closestvpoint(ux,ly)

If thesame(p1.id, p2.id, p3.id, p4.id)
Local midpointx# = ux + ((lx-ux)/2)
Local midpointy# = uy + ((ly-uy)/2)
tempvor=closestvpoint(midpointx,midpointy)

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 < p1.uy p1.uy = uy
If ly > p1.ly p1.ly = ly

If mode = 2 Or mode = 3 drawhollowrect(ux,uy,lx,ly)
If recursions < 7 Flip
Return True
Else
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
EndIf  ' bailing out because recursions too high
End Function

Function lefthalf:Object(data:Object)
voronoirecursive(0,0,width/2,height,1)
End Function

Function righthalf:Object(data:Object)
voronoirecursive(width/2,0,width,height,1)
End Function



While Not KeyDown(KEY_ESCAPE)
Local p:voronoipoint = New voronoipoint
Cls
voronoirecursive(0,0,WIDTH,HEIGHT,1)
'Local thread1:TThread=CreateThread(lefthalf,"")
'Local thread2:TThread=CreateThread(righthalf,"")

Flip


'Local tv:voronoipoint = New voronoipoint
'For tv = EachIn vpointlist
'tv.randomize()
'Next

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

Local ticks = 0
Repeat

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

Flip
ticks = ticks + 1

Until MouseDown(1) Or ticks > 200

For tv = EachIn vpointlist
tv.randomize()
Next

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



Wend

'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

38
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.

39
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.

40
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