• Create Account

# Djfix

Member Since 16 Aug 2012
Offline Last Active Apr 27 2016 05:43 AM

### In Topic: Poll: Does Gladwell's rule apply to game programming?

13 July 2013 - 08:58 AM

Could a game programmer ever achieve mastery? I guess that even if you work like 5 years in a domain (like the physics engine programmers for a modern FPS), how can you say that you are an expert in Game programming,when, for example you can't do the graphics part, or the structural organisation part? For me, everyone has room for improvement.

Let me give you one of Bjarne Stroustrup's quotes: "People who think they know everything really annoy those of us who know we don't". For me, the quote suggests that he acknowledges the fact that there is always room for improvement.

Meh, my opinion is pretty fixed, and i would never say that I am an expert even if at 60 years old i would have invented some awesome algorithm that produces pizza from my own programming language code. Especially if a teen comes to me with his own language that would give me soda with a while(1) loop.

### In Topic: Isometric map problem

12 July 2013 - 05:04 PM

This change makes it work, but i'm not sure whether it is...good...or elegant...and i'm sure it will mess with getting the tile positions and so forth...

```for (tileNum in range(length(line)))
{
if (line[tileNum] == '0')
tiles.append(Tile((t*32)+160,(tileNum*32)-32,grass))

if (line[tileNum] == '1')
tiles.append(Tile((t*32)+128,(tileNum*32)-64,cube)
}
```

it gives me this:

### In Topic: Sprite and Animation

12 July 2013 - 03:24 PM

I don't get what you are asking for exactly, but I am asuming that you need to animate a Sprite.

From what I understand from your post, you seem to be the kind of programmer that has found OOP and thinks it is the best and most elegant solution for everything.

You don't need all those classes to animate a sprite. You just need an array that holds all the animation frames, and you loop over it once per main loop tick, changing the sprite's image with the one that the array index reaches. At the end of the animation just have an image that shows the sprite being idle.

for example, have only a Sprite class like this (pseudocode - also encompasses an animation function that goes over the frames in an array once per loop tick):

```class Sprite:
constructor::set(x,y,image,moving,frames,currentFrame,extraTime) // give it some attributes
assign_attributes
{
x = 100
y = 100
image = image1
moving = False //this is a boolean that changes state when a movement key is pressed
frames = [image1,image2,image3,image4] // array of animation frames, taken from a spritesheet
currentFrame = 0
extraTime = 0
}
function AnimateSprite(int secondsPast)
{
if moving == true
{
extraTime += secondsPast
timeBetweenFrames = 1.0/30.0
while (extraTime > timeBetweenFrames)
{
extraTime -= timeBetweenFrames
currentFrame+=1
if currentFrame > maxNumberOfFrames:
currentFrame = 0
}
image = frames[currentFrame]
}
else
image = image1
}

```

### In Topic: 2D Tile World Generation

16 September 2012 - 11:06 AM

In tile-based games I'd see plenty of solutions. Perlin noise is only one of the many solutions.

As nox_pp above pointed out you would need to model the "standards" to best suit your needs.

You can use a tile based approach for small things where you "select" a tile and only consider it's neighbours. It's more or like cellular automata but I think it's only suited if you want to design small stuff because it gets lost in large map generation.

One solution that is greatly used also is by dividing your "map" into parts and specifically coding these out.(if you want, biomes like in Minecraft,Terraria or DF).For those Perlin Noise does its charm.

You can always read Notch's (Minecraft's creator) map generation article (just google it).His world generation algorithm, for me, is a technical marvel (In the early versions of Minecraft I suspect a Perlin Noise *again* heightmap was used).

Whatever method you decide to approach,
Good Luck!

### In Topic: RPG Inventory HUD

03 September 2012 - 04:08 AM

Thanks for your help...I've managed to put together an algorithm and i've also integrated a small GUI for the inventory.

Cheers!

PARTNERS