• Create Account

# agm_ultimatex

Member Since 21 Dec 2007
Offline Last Active Jun 12 2012 02:35 PM

### Currently drafting up a 2d game, suggested tools?

11 June 2012 - 08:35 PM

Hi gamedev. I thought I'd ask this question here, feel free to move if you think it belongs elsewhere .

Anyways, I'm currently putting together a GDD on a 2d platformer idea i have. A few years ago i built an extremely simple sidescroller in Java. https://github.com/agmcleod/GunzAblazin. It just has simple movement and floor collision detection (althought running it the other day seemed to prove otherwise on the floor detection). I'm thinking on perhaps re-using some of this code and continuing from there with Slick 2d. However, I'm also intrigued by perhaps developing it to work in the browser using modern javascript and perhaps one of the libraries out there. The benefits here for me would be that I am much more familiar with JavaScript as a language. I am a web developer by profession so languages such as JS and ruby are where I call home.

However, I'm wondering if you have any opinions on pros/cons of going the JS route vs a desktop language such as Java (other then stating the obvious that a desktop game coded in Java or C++ would more likely be supported). Or if there are some other frameworks you could recommend. Thanks!

### Mathematically positioning hexagons in a grid format

05 October 2011 - 08:19 PM

I'm working on getting a grid using hexagons in a honeycomb pattern. Thanks to the work of the previous developer, here's where it stands in terms of layout:

http://imgur.com/BBDZB

The code is:

```
generateTiles : function(f) {
var xyz = [0,0,0];
var max_out = 14;
var deltas = [[1,0,-1],[0,1,-1],[-1,1,0],[-1,0,1],[0,-1,1],[1,-1,0]];
var output = ""
for (var i = 0; i < radius; i++) {
var x = xyz[0];
var y = xyz[1]-i;
var z = xyz[2]+i;
for (var j = 0; j < 6; j++) {
for (var k = 0; k < i; k++) {
x = x+deltas[j][0]
y = y+deltas[j][1]
z = z+deltas[j][2]
f(x,y,z);
}
}
}
},
```

The f function that is called passes an x and y value for coordinates:

```    var coords = [0,0,0];

this.x = function() {
var x = (Math.sqrt(3) * (radius + 1) * (coords[2]/2 + coords[0]));
return GridInterface.HexGrid.x_offset + x;
};

this.y = function() {
var y = (3/2 * (radius + 1) * coords[2]);
return GridInterface.HexGrid.y_offset + y;
};
```

The x/y offset values is the center of the grid.

What I want to achieve is to have it work when the hexagons are rotated 30 degrees, so the sides are flat at the top and bottom. When i rotate them now, the points are touching as supposed to being directly side by side. Any suggestions on how i can make this happen would be greatly apprecated.

### draw an arc to wrap around an oval

26 March 2011 - 12:24 PM

Hello. Im using raphaeljs to generate 2d svg graphics in a web browser. I currently draw a few ovals, where the x radius is 92% of the y radius. For example, i call the ellipse function of raphael:

```ellipse(x, y, this.r * 0.92, this.r);
```

I am then drawing an arc around this oval. The problem is, I can't figure out how best to keep it to the path of the oval. This function works 100% when it's a perfect circle, but otherwise there's a bit of spacing, and it's not aligned correctly.

```// radius is this.r from above, x & y are same values. The scale is used to draw different sizes of ovals.

var arc = function(center, radius, startAngle, endAngle, scale) {
if(!scale) {
scale = 1
}
angle = startAngle;
coords = toCoords(center, radius, angle, scale);
path = "M " + coords[0] + " " + coords[1];
while(angle <= endAngle) {
coords = toCoords(center, radius, angle, scale);
path += " L " + coords[0] + " " + coords[1];
angle += 1;
}
return path;
}
```

```function toCoords(center, radius, angle, scale) {
if(!scale) {
scale = 1;
}
var radians = (angle/180) * Math.PI;
return [x, y];
}
```
Any ideas? Here's an example of what's currently rendering: http://img98.imagesh.../7863/ovalt.png

### Where's the christmas theme?

14 December 2010 - 12:56 PM

Just asking, as it always looks quite nice :)

### Recommended resources for client/server multiplayer

14 June 2010 - 12:54 AM

A friend of mine and I are currently in the stage of planning out and designing a 2d online rpg we want to make. We're aiming for the client/server route, but we don't have much experience in it. I did some client server stuff with java last year for school. It had a login system and other text commands that were sent to the server through a socket connection, and then responded to appropriately by the server. We have "killer game programming", which covers networking for games, but I am wondering if there's any other resources you could recommend. This is going to be an applet on a website. I guess you could say like runescape.

PARTNERS