Page 2 of 3

Re: CodeName: DontGoLeft

Posted: Thu Aug 04, 2011 2:32 pm
by GijsB
its strange that your poll has no 'no' ._.

Re: CodeName: DontGoLeft

Posted: Sat Aug 06, 2011 10:41 am
by kraftman
Updated it a bit. I've finished off the edging on the dirt when it is exposed to air, so it all looks a bit better.
If you spawn halfway through the ground, jump a bit while its loading.
Maybe I should rename it "DontGoLeftAndJumpABitWhileLoading" I could fix those errors, but then where is the challenge?!

Re: CodeName: DontGoLeft

Posted: Sat Aug 06, 2011 12:37 pm
by GijsB
I have been working on Minecraft2D, pretty much the same, but mine doesnt crash when going left, it actualy never crashes :awesome:
the only problem is that it goes pretty slow when using normal LÖVE instead of LÖVEJIT
here :

(re-run when stuck or re-run when below landscape X3)

Re: CodeName: DontGoLeft

Posted: Sat Aug 06, 2011 9:35 pm
by Trappingnoobs
GijsB wrote:I have been working on Minecraft2D, pretty much the same, but mine doesnt crash when going left, it actualy never crashes :awesome:
the only problem is that it goes pretty slow when using normal LÖVE instead of LÖVEJIT
here :

(re-run when stuck or re-run when below landscape X3)
Umm
if math.sqrt((x1-x2)^2+(y1-y2)^2) < 100 then--you dont have to check collision with blocks that are not closeby
Isn't that slower than detecting collision in the first place?!


@Kraftman

I like the terrain, I've been wondering for a while how terraria did that so that the block's appearance changes depending on the one next to it. You actually create the images in a script? Does terraria do that too?

Edit
Ooh, 'World.lua:108:Cannot create framebuffer. Error in implementation, please inform love devs'
I think I dug too low down :(

Re: CodeName: DontGoLeft

Posted: Sat Aug 06, 2011 9:57 pm
by kraftman
I have no idea how terraria does it.

I thought it would be interesting to see how much i could do purely in code:

For each type of block, i make a few variations of colour, and then i check the blocks around the current block, and make a random edge based on what it finds.

There is probably a better way to do it but I havnt thought of it yet. This way means there is a large amount of variation and a finite amount of images generated.

The grid layout of the blocks makes collision detection nice and simple, you can pretty much just floor the player x and y and you have the location of the block that the player is potentially colliding with.

Re: CodeName: DontGoLeft

Posted: Sat Aug 06, 2011 10:00 pm
by Trappingnoobs
kraftman wrote:I have no idea how terraria does it.

I thought it would be interesting to see how much i could do purely in code:

For each type of block, i make a few variations of colour, and then i check the blocks around the current block, and make a random edge based on what it finds.

There is probably a better way to do it but I havnt thought of it yet. This way means there is a large amount of variation and a finite amount of images generated.

The grid layout of the blocks makes collision detection nice and simple, you can pretty much just floor the player x and y and you have the location of the block that the player is potentially colliding with.
I decompiled terraria a while ago to look at the source but they've got so many files it scared me off.

Your code approach is great. If you make the transition between things smoother like terraria does, it'd be amazing.

Don't you have to test multiple blocks for collisions though? I saw some almost transparent lines seperating blocks of something like 10x10 tiles, I assume you check for collisions in any block the player's in?

Also, are there any tutorials on framebuffers you can link me to? I've never bothered using them but they do seem to be used quite a lot so I expect from that that it's good practise to use them.

Re: CodeName: DontGoLeft

Posted: Sat Aug 06, 2011 10:14 pm
by kraftman
Trappingnoobs wrote:
I decompiled terraria a while ago to look at the source but they've got so many files it scared me off.

Your code approach is great. If you make the transition between things smoother like terraria does, it'd be amazing.

Don't you have to test multiple blocks for collisions though? I saw some almost transparent lines seperating blocks of something like 10x10 tiles, I assume you check for collisions in any block the player's in?

Also, are there any tutorials on framebuffers you can link me to? I've never bothered using them but they do seem to be used quite a lot so I expect from that that it's good practise to use them.
I think terraria precalculates the entire world (since it is finite) which is why it loads more smoothly. I planned on moving the code that creates the new tiles/framebuffers over into a thread, but it seems its a lot more complicated than I thought, so I'll have to think of something else.

The thin lines are the overlap between framebuffers, the positions are slightly wrong because I was trying to stop them blurring sometimes.

Currently, the most blocks i need to check for collisions with at any one time is 5, 3 for the x and 2 for the y.

EDIT:
here's a quick update where you can actually collect the blocks, and hopefully the thin lines have gone too.

Re: CodeName: DontGoLeft

Posted: Sun Aug 07, 2011 5:58 pm
by Trappingnoobs
kraftman wrote:
Trappingnoobs wrote:
I decompiled terraria a while ago to look at the source but they've got so many files it scared me off.

Your code approach is great. If you make the transition between things smoother like terraria does, it'd be amazing.

Don't you have to test multiple blocks for collisions though? I saw some almost transparent lines seperating blocks of something like 10x10 tiles, I assume you check for collisions in any block the player's in?

Also, are there any tutorials on framebuffers you can link me to? I've never bothered using them but they do seem to be used quite a lot so I expect from that that it's good practise to use them.
I think terraria precalculates the entire world (since it is finite) which is why it loads more smoothly. I planned on moving the code that creates the new tiles/framebuffers over into a thread, but it seems its a lot more complicated than I thought, so I'll have to think of something else.

The thin lines are the overlap between framebuffers, the positions are slightly wrong because I was trying to stop them blurring sometimes.

Currently, the most blocks i need to check for collisions with at any one time is 5, 3 for the x and 2 for the y.

EDIT:
here's a quick update where you can actually collect the blocks, and hopefully the thin lines have gone too.
Lines are still there. I like how the blocks sort of give up chasing after you if you keep away from them too long.
Also, if I get a 3 high block of dirt, and dig it down to just the horizontally middle blocks, the player can walk through the middle block.

Re: CodeName: DontGoLeft

Posted: Sun Aug 07, 2011 10:22 pm
by kraftman
Did he just add cows that fall from the sky? I think he did.

Re: CodeName: DontGoLeft

Posted: Sun Aug 07, 2011 10:42 pm
by Trappingnoobs
kraftman wrote:Did he just add cows that fall from the sky? I think he did.
Wow. Your texture transitions are as good, if not better than, terraria's. I've so got to look at how you did that in the morning.

I like the cows, but they have insane superjump ability? :L