Page 11 of 180

Re: What's everyone working on? (tigsource inspired)

Posted: Mon Jun 27, 2011 5:11 pm
by vrld
I'm having a little fun with the latest version of love-glsl (which gives you access to pixel shaders).

This one is pretty trippy:


Code (requires love-glsl to run):

Code: Select all

function love.load()
	e = love.graphics.newPixelEffect [[
		uniform sampler2D tex;
		uniform float time;
		uniform float distort;
		uniform float chroma;

		void main() {
			vec2 tc = vec2(gl_TexCoord[0]);
			tc = vec2(1.0,1.0) - abs(2.0 * tc - vec2(1.0,1.0));
			tc.x += sin(tc.y * 100 + time * 10.0) * .03 * distort;
			vec2 rb = vec2(1.0,1.0) * .002 * chroma;
			gl_FragColor = vec4(texture(tex, tc+rb).r, texture(tex, tc).g, texture(tex, tc-rb).b, 1.0);
		}
	]]
	e:send("time", 0);
	e:send("distort", .01);
	e:send("chroma", 10);
	t= 0

	fb = love.graphics.newFramebuffer()
	rects = {}
	for i = 1,100 do
		rects[i] = {math.random(0,800)-400, math.random(0,800)-400}
	end
end

function love.draw()
	love.graphics.setPixelEffect()
	fb:clear()
	fb:renderTo(function()
		love.graphics.push()
		love.graphics.translate(400,300)
		love.graphics.rotate(t)
		for i = 1,#rects do
			love.graphics.rectangle('fill', rects[i][1], rects[i][2], 50,50)
		end
		love.graphics.pop()
	end)

	love.graphics.setPixelEffect(e)
	love.graphics.draw(fb)
end

function love.update(dt)
	t = t + math.min(dt, 1/30)
	e:send("time", t)
	e:send("chroma", 10 + math.sin(t) * 5)
	e:send("distort", .5 + math.sin(t) * .25)
end
Edit: New video

Re: What's everyone working on? (tigsource inspired)

Posted: Mon Jun 27, 2011 10:12 pm
by BlackBulletIV
Looks pretty awesome vrld. Wish we had shaders in the main LOVE.

Re: What's everyone working on? (tigsource inspired)

Posted: Thu Jul 14, 2011 2:21 am
by Jasoco
Currently working on a side-scrolling engine, and it actually works this time! I decided in order to get around my problem of slowdown and shortened jumps due to slowness as well as the other problems my last version had, I had to limit the framerate to exactly 60 or 30FPS as well as making sure every frame is exactly 1/60th or 1/30th of a second. Never more, never less. Most of the time it will display fine, but if the computer slows down to the point the DT is actually more than that fraction, the game will slow down as well. But this is by design.

It also let me do what I wanted to do before... recording replays! Since every frame is exactly the same length (Give or take) it can record everything into a table every frame, and then replay it later. I even have a save feature so far with a progress bar to save the replay to the disk for later.

The engine feel is inspired by Super Meat Boy and I hope to make a game with it that can inspire that feeling too.

There is no game yet though, but the engine is coming along. I didn't want to post an official thread yet though since I want to polish it enough first. When it's done. WHEN IT'S DONE.

Also, no Box2D. But it does have its own physics to move the character. And currently you can double-jump. Next I'll implement wall jumps. And eventually weapons.

Re: What's everyone working on? (tigsource inspired)

Posted: Thu Jul 14, 2011 2:48 am
by tentus
Jasoco wrote:Currently working on a side-scrolling engine, and it actually works this time! I decided in order to get around my problem of slowdown and shortened jumps due to slowness as well as the other problems my last version had, I had to limit the framerate to exactly 60 or 30FPS as well as making sure every frame is exactly 1/60th or 1/30th of a second. Never more, never less. Most of the time it will display fine, but if the computer slows down to the point the DT is actually more than that fraction, the game will slow down as well. But this is by design.

It also let me do what I wanted to do before... recording replays! Since every frame is exactly the same length (Give or take) it can record everything into a table every frame, and then replay it later. I even have a save feature so far with a progress bar to save the replay to the disk for later.

The engine feel is inspired by Super Meat Boy and I hope to make a game with it that can inspire that feeling too.

There is no game yet though, but the engine is coming along. I didn't want to post an official thread yet though since I want to polish it enough first. When it's done. WHEN IT'S DONE.

Also, no Box2D. But it does have its own physics to move the character. And currently you can double-jump. Next I'll implement wall jumps. And eventually weapons.
Huh, that's a really interesting approach. Doesn't having it record every frame to a table get awful heavy really quick though?

Re: What's everyone working on? (tigsource inspired)

Posted: Thu Jul 14, 2011 7:04 am
by Jasoco
tentus wrote: Huh, that's a really interesting approach. Doesn't having it record every frame to a table get awful heavy really quick though?
Probably. I haven't done enough tests. And right now I'm only recording the player's major appearance and location data (i.e. it only needs to remember a characters X, Y and appearance tile) and not any of the enemies which I haven't completely implemented yet. In the end it would need to record the player, every enemy and every other piece of moving environment like platforms and hazards. I assume the table would get big. But I haven't noticed it take any big toll yet. When I have a working prototype to upload we can do some tests.

See, being able to record an entire level can be used for replays, or even for games like Braid where you can rewind time. With work I could probably make it have rewinding if I wanted to. For now however I just want to record the current play through.

In Super Meat Boy the game records EVERY ATTEMPT in a level, and when you finish the level, it replays EVERY ATTEMPT at the same time. Every life you lost all running and jumping around the level at the same time. But SMB is also designed so hazards and enemies move the exact same way every time, so it doesn't need to record their locations. Just the player. Assuming the game runs at 60FPS (Maybe? Or 30?) and the player can potentially die a lot, it is going to be recording a lot of data. I'm not sure if the game has a cut-off for displayed life playback. Like does it only play the last 50 at once? Or maybe it will show all 1000 if you happen to die 1000 times. I dunno.

Here's a sample 1.4 second recording of a player:

Code: Select all

return {[1] = {[1] = {time = 0.016666666666667,player = { x = 100, y = 100, facing = 1}},[2] = {time = 0.033333333333333,player = { x = 100, y = 100, facing = 1}},[3] = {time = 0.05,player = { x = 100, y = 100, facing = 1}},[4] = {time = 0.066666666666667,player = { x = 100, y = 100, facing = 1}},[5] = {time = 0.083333333333333,player = { x = 100, y = 101, facing = 1}},[6] = {time = 0.1,player = { x = 100, y = 102, facing = 1}},[7] = {time = 0.11666666666667,player = { x = 100, y = 102, facing = 1}},[8] = {time = 0.13333333333333,player = { x = 100, y = 103, facing = 1}},[9] = {time = 0.15,player = { x = 100, y = 105, facing = 1}},[10] = {time = 0.16666666666667,player = { x = 100, y = 106, facing = 1}},[11] = {time = 0.18333333333333,player = { x = 100, y = 107, facing = 1}},[12] = {time = 0.2,player = { x = 100, y = 109, facing = 1}},[13] = {time = 0.21666666666667,player = { x = 100, y = 111, facing = 1}},[14] = {time = 0.23333333333333,player = { x = 100, y = 112, facing = 1}},[15] = {time = 0.25,player = { x = 100, y = 114, facing = 1}},[16] = {time = 0.26666666666667,player = { x = 100, y = 117, facing = 1}},[17] = {time = 0.28333333333333,player = { x = 100, y = 119, facing = 1}},[18] = {time = 0.3,player = { x = 100, y = 121, facing = 1}},[19] = {time = 0.31666666666667,player = { x = 100, y = 124, facing = 1}},[20] = {time = 0.33333333333333,player = { x = 100, y = 127, facing = 1}},[21] = {time = 0.35,player = { x = 100, y = 129, facing = 1}},[22] = {time = 0.36666666666667,player = { x = 100, y = 132, facing = 1}},[23] = {time = 0.38333333333333,player = { x = 100, y = 135, facing = 1}},[24] = {time = 0.4,player = { x = 100, y = 139, facing = 1}},[25] = {time = 0.41666666666667,player = { x = 100, y = 142, facing = 1}},[26] = {time = 0.43333333333333,player = { x = 100, y = 144, facing = 1}},[27] = {time = 0.45,player = { x = 100, y = 144, facing = 1}},[28] = {time = 0.46666666666667,player = { x = 100, y = 144, facing = 1}},[29] = {time = 0.48333333333333,player = { x = 100, y = 144, facing = 1}},[30] = {time = 0.5,player = { x = 100, y = 144, facing = 1}},[31] = {time = 0.51666666666667,player = { x = 100, y = 144, facing = 1}},[32] = {time = 0.53333333333333,player = { x = 100, y = 144, facing = 1}},[33] = {time = 0.55,player = { x = 100, y = 144, facing = 1}},[34] = {time = 0.56666666666667,player = { x = 100, y = 144, facing = 1}},[35] = {time = 0.58333333333333,player = { x = 100, y = 144, facing = 1}},[36] = {time = 0.6,player = { x = 100, y = 144, facing = 1}},[37] = {time = 0.61666666666667,player = { x = 100, y = 144, facing = 1}},[38] = {time = 0.63333333333333,player = { x = 100, y = 144, facing = 1}},[39] = {time = 0.65,player = { x = 100, y = 144, facing = 1}},[40] = {time = 0.66666666666667,player = { x = 100, y = 144, facing = 1}},[41] = {time = 0.68333333333333,player = { x = 100, y = 144, facing = 1}},[42] = {time = 0.7,player = { x = 100, y = 144, facing = 1}},[43] = {time = 0.71666666666667,player = { x = 100, y = 144, facing = 1}},[44] = {time = 0.73333333333333,player = { x = 101, y = 144, facing = 1}},[45] = {time = 0.75,player = { x = 102, y = 144, facing = 1}},[46] = {time = 0.76666666666667,player = { x = 102, y = 144, facing = 1}},[47] = {time = 0.78333333333333,player = { x = 103, y = 144, facing = 1}},[48] = {time = 0.8,player = { x = 105, y = 144, facing = 1}},[49] = {time = 0.81666666666667,player = { x = 106, y = 144, facing = 1}},[50] = {time = 0.83333333333333,player = { x = 107, y = 144, facing = 1}},[51] = {time = 0.85,player = { x = 109, y = 144, facing = 1}},[52] = {time = 0.86666666666667,player = { x = 111, y = 144, facing = 1}},[53] = {time = 0.88333333333333,player = { x = 112, y = 144, facing = 1}},[54] = {time = 0.9,player = { x = 114, y = 144, facing = 1}},[55] = {time = 0.91666666666667,player = { x = 117, y = 144, facing = 1}},[56] = {time = 0.93333333333333,player = { x = 119, y = 144, facing = 1}},[57] = {time = 0.95,player = { x = 121, y = 144, facing = 1}},[58] = {time = 0.96666666666667,player = { x = 123, y = 144, facing = 1}},[59] = {time = 0.98333333333333,player = { x = 125, y = 144, facing = 1}},[60] = {time = 1,player = { x = 127, y = 144, facing = 1}},[61] = {time = 1.0166666666667,player = { x = 129, y = 144, facing = 1}},[62] = {time = 1.0333333333333,player = { x = 132, y = 144, facing = 1}},[63] = {time = 1.05,player = { x = 134, y = 144, facing = 1}},[64] = {time = 1.0666666666667,player = { x = 136, y = 139, facing = 1}},[65] = {time = 1.0833333333333,player = { x = 138, y = 135, facing = 1}},[66] = {time = 1.1,player = { x = 140, y = 131, facing = 1}},[67] = {time = 1.1166666666667,player = { x = 142, y = 127, facing = 1}},[68] = {time = 1.1333333333333,player = { x = 144, y = 124, facing = 1}},[69] = {time = 1.15,player = { x = 146, y = 120, facing = 1}},[70] = {time = 1.1666666666667,player = { x = 149, y = 117, facing = 1}},[71] = {time = 1.1833333333333,player = { x = 151, y = 113, facing = 1}},[72] = {time = 1.2,player = { x = 153, y = 110, facing = 1}},[73] = {time = 1.2166666666667,player = { x = 155, y = 107, facing = 1}},[74] = {time = 1.2333333333333,player = { x = 157, y = 104, facing = 1}},[75] = {time = 1.25,player = { x = 159, y = 102, facing = 1}},[76] = {time = 1.2666666666667,player = { x = 161, y = 99, facing = 1}},[77] = {time = 1.2833333333333,player = { x = 163, y = 97, facing = 1}},[78] = {time = 1.3,player = { x = 165, y = 94, facing = 1}},[79] = {time = 1.3166666666667,player = { x = 167, y = 92, facing = 1}},[80] = {time = 1.3333333333333,player = { x = 169, y = 90, facing = 1}},[81] = {time = 1.35,player = { x = 171, y = 88, facing = 1}},[82] = {time = 1.3666666666667,player = { x = 173, y = 87, facing = 1}},[83] = {time = 1.3833333333333,player = { x = 175, y = 85, facing = 1}},[84] = {time = 1.4,player = { x = 176, y = 84, facing = 1}},[85] = {time = 1.4166666666667,player = { x = 178, y = 82, facing = 1}},[86] = {time = 1.4333333333333,player = { x = 180, y = 81, facing = 1}},}}

Re: What's everyone working on? (tigsource inspired)

Posted: Thu Jul 14, 2011 7:16 am
by slime
If your code is deterministic then you don't need to record every frame.

Re: What's everyone working on? (tigsource inspired)

Posted: Thu Jul 14, 2011 7:18 am
by bartbes
I would assume for a similar function to record actions, instead of status. "At 33.87 seconds, jump." That kind of stuff.

Re: What's everyone working on? (tigsource inspired)

Posted: Thu Jul 14, 2011 7:47 am
by Jasoco
bartbes wrote:I would assume for a similar function to record actions, instead of status. "At 33.87 seconds, jump." That kind of stuff.
I'll look into it. I'd have to see how reliable and predictable my own physics are. I was also looking into only recording something if it changed since the last time.

Re: What's everyone working on? (tigsource inspired)

Posted: Thu Jul 14, 2011 7:37 pm
by Lafolie
Assuming there's no random factors involved, you could just record each key press and feed that to the game during a replay.

Re: What's everyone working on? (tigsource inspired)

Posted: Thu Jul 14, 2011 8:08 pm
by bartbes
And when there is randomness involved, perhaps storing the seed might help.