I have game idea, please make it for me... - Page 2

I have game idea, please make it for me...

Post just about everything that isn't directly related to Spring here!

Moderator: Moderators

User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: I have game idea, please make it for me...

Post by Beherith »

sqrt(2)/2
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: I have game idea, please make it for me...

Post by SinbadEV »

Beherith wrote:sqrt(2)/2
oops... I didn't notice you post... I worked it out to r.sqrt(3) which was right (my circles have a radius of 50 and the offset of each row is ~86.6 so I've used 87)...
and I don't see what "sqrt(2)/2" is supposed to mean... where's the variable?
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: I have game idea, please make it for me...

Post by Beherith »

whoops, my bad, it is sqrt(3). Height of equilateral triangle. so the answer is sqrt(3). You get no variable because you asked for ratio.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: I have game idea, please make it for me...

Post by zwzsg »

SinbadEV wrote:what is the ratio of vertical offset to radius for the second row in a hexagonal latice?
Ambigious question.

1) What kind of hexagonal lattice? There are two non-retarded orientations:

Do you mean:

Image

Or

Image


2) Which second row do you mean? The second row that is vertically aligned, or the second row that closer but shifted?

Image

Or

Image


The answers are 5/2, 3/2, sqrt(3), sqrt(3)/2.


SinbadEV wrote:where's the variable?
You asked for a ratio. For the ratio h/r. So there is no r. Ask about h expressed in function of r if that is what you want.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: I have game idea, please make it for me...

Post by SinbadEV »

Now I feel bad for having figured it out before people gave me intelligent responses... thanks for the effort anyways... and @zwzsg since you know what I'm talking about, do any of the mentioned numbers come out to finite ratios for the "closer but horizontally offset next row"?

also, I had forgotten I was asking for a ratio... I get it now.

edit and attachment:
This is the grid I'm using right now...
Image
To move around the grid you have 6 directions
NW = Up
NE = Up-Right
E = Right
SE = Down
SW = Down-Left
W = Left
Attachments
HTML5HexGrid-Simple.PNG
(25.99 KiB) Downloaded 1 time
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: I have game idea, please make it for me...

Post by SinbadEV »

In case you were wondering how freaking fast javascript is, check out my test page... it does the following every time you move your mouse:

Code: Select all

		function intersects(x, y, cx, cy, r) {
			dx = x-cx
			dy = y-cy
			return dx*dx+dy*dy <= r*r
		}

		function mouseMove(e)
		{
			var mouseX=0, mouseY=0;

			if(e.offsetX) {
				mouseX = e.offsetX;
				mouseY = e.offsetY;
			}
			else if(e.layerX) {
				mouseX = e.layerX;
				mouseY = e.layerY;
			}

			/* do something with mouseX/mouseY */
			var coords=document.getElementById("coords");
			coords.innerHTML = mouseX+", "+mouseY;
			var found = false;
			for (x=0;x<x_cols;x++) {
				for (y=0;y<y_rows;y++) {
					
					cxt.fillStyle="#000000";
					coordText = "("+x+","+y+")";
					metrics = cxt.measureText(coordText)
					wo = Math.floor(metrics.width/2);
					if (intersects(mouseX,mouseY,x*2*r+r+(y*r),y*o+r, r) && !found) {
						data.innerHTML = x+", "+y;
						found = true;
					}
					
				}
			}
			if (!found) {data.innerHTML = "none"};
		}
and there is no perceptible lag

edit: and don't bother pointing out that a bunch of the stuff it's doing is redundant... I've fixed it, it looks like this now

Code: Select all

		function intersects(x, y, cx, cy, r) {
			dx = x-cx
			dy = y-cy
			return dx*dx+dy*dy <= r*r
		}

		function mouseMove(e)
		{
			var mouseX=0, mouseY=0;

			if(e.offsetX) {
				mouseX = e.offsetX;
				mouseY = e.offsetY;
			}
			else if(e.layerX) {
				mouseX = e.layerX;
				mouseY = e.layerY;
			}

			/* do something with mouseX/mouseY */
			coords.innerHTML = mouseX+", "+mouseY;
			var found = false;
			for (x=0;x<x_cols;x++) {
				for (y=0;y<y_rows;y++) {
					if (intersects(mouseX,mouseY,x*2*r+r+(y*r),y*o+r, r) && !found) {
						data.innerHTML = x+", "+y;
						found = true;
					}
					
				}
			}
			if (!found) {data.innerHTML = "none"};
		}
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: I have game idea, please make it for me...

Post by Caydr »

How many of these threads have you made, Sinbad? You're making me feel inadequate.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: I have game idea, please make it for me...

Post by PicassoCT »

This one is diffrent, he contributed java-code, the usual un-productive pingpong and trolling ended for a moment. Sinbad can do it, i see contribooty. If its good i have the right to steal it.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: I have game idea, please make it for me...

Post by SinbadEV »

due to popular demand I have have shifted my place for posting of crazy ideas to http://sinbadev-benjie.blogspot.com/
Post Reply

Return to “Off Topic Discussion”