Jump to content

  • Log In with Google      Sign In   
  • Create Account

JTippetts

Member Since 04 Jul 2003
Offline Last Active Yesterday, 11:38 PM

#4996978 How to find the closest interception point?

Posted by JTippetts on 03 November 2012 - 03:26 PM

Maybe this thread might be of some use:

http://www.gamedev.net/topic/614147-enemies-leading-their-shots/

It talks about leading shots on enemies, and one poster presents a solution to the shot-leading problem by solving a quadratic equation.


#4996714 Who would consider a game interface an art?

Posted by JTippetts on 02 November 2012 - 06:07 PM

Once upon a time, art wasn't really a word or a thing. People made stuff, that's it. Cave paintings, carved sticks, whatever. They didn't make it to be all hoity-toity in their stupid art magazines. Grok didn't look over at Blorg and say, "Blorg make carved stick, not rock people; carved stick not art. Blorg dumb." Blorg was probably dumb, but Grok's no-carved-sticks-are-art rule was still stupid. If some ass-hat can crap in a can and call it art, then game interfaces can be called art as well. Your average game interface certainly takes more creativity and skill to create than pooping in a tin can.


#4996599 Why is this terrain using 4d simplex noise not tiling?

Posted by JTippetts on 02 November 2012 - 11:03 AM

Yes, loopx0 and loopx1 are constant. If you were to map the range specified by loop to the entire map all at once, that map would tile with itself. mapx0 and mapx1 are specified as sub-ranges of loop, and correspond to each sub-chunk of the map. So if the loop range is 0 to 1 and there are 10 sub-chunks across the map, mapx0 for the first chunk would be 0, mapx1 would be 0.1. For the second chunk, mapx0 would be 0.1, mapx1 would be 0.2. But for all chunks, loop would be the same.

Now, there is a problem with mapping the range [0, tilewidth*numberoftiles] to loop. Say your tile width is 64 and you have 100 tiles. This means the looping range would be 0 to 6400. Mapping this range of noise does not produce anything meaningful, basically just white noise, unless you turn the frequency of the noise function WAY down. This is because, in Perlin noise (gradient as well as simplex, even the value-noise variant) there is roughly 1 "feature" per integral coordinate at the default frequency of 1. This means that in the range 0,6400 there would be produced approximately 6400 "hills" or "valleys". The output would be very much like the third screenshot in your original post. You need to turn down the range specified in loop to correspond what you wish to map.


#4995601 Why is this terrain using 4d simplex noise not tiling?

Posted by JTippetts on 30 October 2012 - 04:41 PM

It's a little tough reading your code, since it seems the forums ate your newlines, so correct me if I'm wrong about what you are trying to do.

1) You have an array of tiles, tiles indexed on i and j.
2) Each tile is a chunk of noise, the individual pixels of which are indexed on localx and localy.
3) You want to calculate each pixel of the tiles such that the whole map tiles seamlessly with itself

For reference, here is how the 2D tiling noise in ANL is constructed:
 {
	    size_t w=a.width();
	    size_t h=a.height();
	    static double pi2=3.141592*2.0;
	    size_t x,y;
	    for(x=0; x<w; ++x)
	    {
		    for(y=0; y<h; ++y)
		    {
			    double p=(double)x / (double)w;
			    double q=(double)y / (double)h;
			    double r;
			    double nx,ny,nz,nw,nu,nv,val=0.0;
			    double dx, dy, dz;
			    dx=ranges.loopx1-ranges.loopx0;
			    dy=ranges.loopy1-ranges.loopy0;
			    p=p*(ranges.mapx1-ranges.mapx0)/(ranges.loopx1-ranges.loopx0);
			    q=q*(ranges.mapy1-ranges.mapy0)/(ranges.loopy1-ranges.loopy0);
			    nx=ranges.loopx0 + cos(p*pi2) * dx/pi2;
			    ny=ranges.loopx0 + sin(p*pi2) * dx/pi2;
			    nz=ranges.loopy0 + cos(q*pi2) * dy/pi2;
			    nw=ranges.loopy0 + sin(q*pi2) * dy/pi2;
			    val=m.get(nx,ny,nz,nw);
				 
			   
			    a.set(x,y,val);
		    }
	    }

Now, comparing your code, these lines where you calculate your noise input coords look suspicious to me:

nx = absx + Math.cos(s * 2 * Math.PI)*dx/(2*Math.PI);		  
ny = absy + Math.cos(t * 2 * Math.PI)*dy/(2*Math.PI);		  
nz = absx + Math.sin(s * 2 * Math.PI)*dx/(2*Math.PI);		  
nw = absy + Math.sin(t * 2 * Math.PI)*dy/(2*Math.PI);

absx and absy are calculated as the global pixel coordinates of the sample, so they are going to change in value as the pixel coords change. In my original implementation, I use loopx0 and loopy0 here, which do not change. The only way the coordinates change is through the value of s and t, which should be calculated from the pixel coords.

In my implementation, I specify the ranges over which the noise loops explicitly, rather than tying the range to the tile coordinates. Similarly, I specify the ranges over which the tiles are mapped explicitly. The ranges loopx0 to loopx1 and loopy0 to loopy1 specify the range of noise mapped to the entire map. The ranges mapx0 to mapx1 and mapy0 to mapy1 specify the range of noise (a sub-range of the larger looping range) to map to a given tile. This would be calculated by dividing the larger loop range up into as many equal-sized pieces as there are tiles.

As far as getting different terrain, I implement a seeding technique where a seed is passed as another input to the noise function, and is hashed together with the input coordinates. Change the seed, get a different output.


#4994925 pong paddle

Posted by JTippetts on 28 October 2012 - 09:25 PM

You can import it into Gimp, color-select the white background, and fill it with black.

My suggestion is that you avoid using JPG for sprites, though. Typically, a sprite is going to have transparent areas, and JPG doesn't support alpha channel. Also, JPG compression is lossy, so you can lose detail. I'd suggest going with PNG, TGA or some other format that supports loss-less compression and a alpha channel.


#4994853 How do I avoid hundreds of identical scene graph traversals?

Posted by JTippetts on 28 October 2012 - 04:45 PM

Instead of each node pulling from its parent (which in turn pulls from its parent), push instead. Calculate the root node's transforms first, then push them out to all children, who will calculate their transforms and push to their children in turn.


#4994634 Why does this look so flat?

Posted by JTippetts on 27 October 2012 - 10:45 PM

If you're not yet skilled at pixel art, one trick you can do is to draw it several times larger than you want it to be, then scale it down to the size you need. If you are not good with form, you can try modeling with simple 3D shapes in something like Blender, then tracing over it with pen tools in Gimp to provide strokes and outlines. A quick (and pretty crappy) example of both techniques:

Posted Image

The anchor was quickly modeled by dragging some points in Blender and doing a Skin modifier plus a subdivision surface, then rendered and quickly traced with some outline, then scaled down. Working from a 3D render like this can also help you to work on your own hand-shading if that is the way you really want to go. The 3D render gives you a template to work from, and you can draw and shade on a layer over the top of it to practice your skills.


#4994550 Is it possible to draw Bezier curves without using line segments?

Posted by JTippetts on 27 October 2012 - 04:08 PM

I understand that I can subdivide the curve down so that I am drawing single pixel lines, but that is again drawing lines. What I am looking for is Bezier curve code that draws a Bezier similarly to Bresenham's line drawing code. In other words, the initial pixel is calculated and the rest are incrementally derived from some function. The curve would be plotted pixel by pixel by pixel.

My interest in this is really just personal. I have no need for it, but it always bothered me that I could not find any examples. I am just really curious if this has ever been done, and if so, I would like to see the code.


Well, if your line segments are only a single pixel long they're... uh.... just pixels. They're sequentially plotted from the function that is the Bezier curve. You're probably not going to find something as simple and elegant as a Bresenham algorithm for Bezier curves because the curvature is neither constant like a circle, nor easily predictable like an ellipse. You could possibly derive it to obtain the curvature (the curvature can be described as the rate of change of the tangent to the curve with respect to the arc-length, or dT/ds) and match curvature to a pixel pattern, but that just seems needlessly complex. Some quick googling turned up http://www.gamedev.net/topic/156180-curvature-of-a-bezier-solved/ in which a poster posted about how to find the curvature of a Bezier; couldn't say how accurate or correct it is, but it might be a place to start. Seems like, if you know the curvature at pixel N, then you should be able to use it to calculate pixel N+1. But, again, it's probably just easier to evaluate the curve for very small increments of t instead.


#4994546 Are you planning/making a Windows 8 (metro) app?

Posted by JTippetts on 27 October 2012 - 03:59 PM

I am actually planning to stop programming when 9 comes out. I don't like gatekeepers, and when they're forced on me, I'll find something else to spend my time on. The field is moving on, going into places I'm not comfortable following. Just getting old, I guess.


#4994479 Are you planning/making a Windows 8 (metro) app?

Posted by JTippetts on 27 October 2012 - 12:48 PM

You forgot "hell no."


#4994136 Ethics of Placeholder Art

Posted by JTippetts on 26 October 2012 - 07:46 AM

I find it odd that anyone would need comments on their interface if it was using placeholder anyway. Wait until you have elements of your own before you show it off, otherwise it only means that the original design team did a good job, and you know how to copy paste. What's the point of that?


#4993980 Codeblock ISO scoping problem

Posted by JTippetts on 25 October 2012 - 06:41 PM

You have a semi-colon after your for(unsigned int q=... line, which terminates the loop at the line, rather than looping through the block. Everything in the block that tries to use q then violates the rule that you shouldn't use a variable declared locally to a block or loop like that after the loop terminates. Also, later, you try to reference i, which doesn't exist. (Probably need to change that to q, after you eliminate the semi-colon).


#4993978 What's the deal with IDE's?

Posted by JTippetts on 25 October 2012 - 06:33 PM

Define "too often". I've used C::B for a long time, five or six years, maybe longer. Never had a crash. Now, I'm sure it does crash, but most modern software is relatively unstable. Just save often. That has been a good guideline to follow for decades.


#4992162 [Open source project] Voxel based mesh generator

Posted by JTippetts on 20 October 2012 - 08:42 AM

C:\Python33>python knot.py
Traceback (most recent call last):
File "knot.py", line 2, in <module>
from vBaum import *
ImportError: DLL load failed: %1 is not a valid Win32 application.


ummm


Looks like the pre-compiled binary is 64-bit, but your python is only 32-bit.

@LordOfTheBytes: Looks pretty cool, I'm going to check it out.


#4991425 Texturing a procedural Icosahedron

Posted by JTippetts on 18 October 2012 - 07:46 AM

Have you looked into procedural solid texturing?

Basically, instead of generating a bunch of 2D textures and trying to project them onto the icosahedron, you would construct a 3-dimensional function, evaluated on a point (x,y,z), that would return texture information for that input point. Then you could rasterize triangles in the UV map, and for each triangle you would interpolate the 3D positions of the vertices and pass the interpolated values in to the 3D function. An example:

Posted Image

An icosphere with a crude UV mapping.

Posted Image

A basic F2-F1 cellular 3D function baked to the texture map.

Posted Image

The icosphere shown with the UV texture mapped on it.

This way, instead of having to manage 10 separate textures you simple "bake" the data directly from one solid texture to a single UV texture. If you create your UV mapping more intelligently than I did for this example, you have less texture waste.




PARTNERS