This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Kingdaro's profile picture

A game with falling boxes! (that also kill you)

Started by Kingdaro, 17 May 2013 - 08:06 PM
Kingdaro #1
Posted 17 May 2013 - 10:06 PM
So for the past couple of days, I've been recoding an old concept of mine from the ground up, and the prototype I have is coming along really great so far.

How to play:
  • WASD to move
  • Hold L to pick up a block in front of you
  • Release L to launch the block
The objective is to pick up blocks, and launch them at the purple enemies that jump around, while trying to avoid being squished by a falling block. If you touch the enemy, you lose health. If you kill the enemy, it drops coins, which you can pick up for points.

Known bugs:
  • You sometimes die when landing on a block with high velocity
  • A lag spike can screw up physics a little bit
  • The enemies sometimes float(?)
  • Layering/z-indexing of drawing operations is weird (the FPS counter is behind the map blocks, for example)
  • You sometimes die before getting a chance to spawn
  • Coins can get stuck inside blocks (you can still collect them by walking over the block they're in)
  • There are small spaces between vertical stacks of blocks. (not sure if it's just me; I assume not because this occurs on two computers)
Known bugs (that aren't bugs):
  • Picking up a block from a stack and walking into it kills you
  • Blocks fall through some platforms - this is intentional, to prevent "umbrella platforms"
FAQ:
  • Q: How long have you been working on this?
  • A: I started development on Tuesday, May 14, 2013.
  • Q: Do you plan on having a different graphics style?
  • A: Yes. This is temporary, but I haven't fully decided on a graphics style. I'm thinking a vector graphics style with bright colors and thick lines, like Paper Mario.
  • Q: A story would go well with this.
  • A: A friend IRL is currently writing one and we'll see how that goes.
  • Q: Why aren't that many questions?
  • A: These were all asked by my friends in IT, and I have a terrible memory.


More Screenshots: http://imgur.com/a/TBAJe
Download: https://dl.dropboxus...falling-box.zip

Made with LÖVE

Also, if you rename the included .love to a .zip, you can see the source. Feel free to look around.
Spongy141 #2
Posted 17 May 2013 - 11:09 PM
Seems interesting, I'm going to try it out now.
Edit: Tried it, I LOVE IT! Very nice! I like how you added the FPS thing, and it ran very smooth for me, I suck at it, but still its fun :P/>
Kingdaro #3
Posted 17 May 2013 - 11:20 PM
Thanks!

Yeah, It's difficult, but hey, not much fun if there's no challenge. :D/>
lieudusty #4
Posted 18 May 2013 - 01:38 AM
Very nice game :D/>
Spongy141 #5
Posted 18 May 2013 - 02:39 AM
Lol hope you don't mind…. but I made a review for the game already :)/>.
Pinkishu #6
Posted 18 May 2013 - 04:31 AM
Either i'm doing something wrong or i cant move :/
i cant jump with W, but ASD seem to do nothing

found out why; if a gamepad is connected you dont allow keyboard movement ;)/> should fix that
GravityScore #7
Posted 18 May 2013 - 06:22 AM
Really fun to play! Not that I know what I'm meant to be doing fully :P/>
oeed #8
Posted 18 May 2013 - 06:27 AM
I actually think the current graphics, despite being single coloured boxes, are actually quite nice and simple.
Kingdaro #9
Posted 18 May 2013 - 11:02 AM
Lol hope you don't mind…. but I made a review for the game already :)/>.
This is great. I really appreciate it!


Either i'm doing something wrong or i cant move :/
i cant jump with W, but ASD seem to do nothing

found out why; if a gamepad is connected you dont allow keyboard movement ;)/> should fix that
There's a funny story behind that, actually. While at school, my friend Ryan thought it would be fun to screw up the player playing with the gamepad using the keyboard. So I just enabled either-or. I'll go ahead and fix that :lol:/>


I actually think the current graphics, despite being single coloured boxes, are actually quite nice and simple.
I got that kind of vibe too, but the kind of graphical style I have in mind should achieve the same effect. (Hopefully anyway.)


Very nice game :D/>
Really fun to play! Not that I know what I'm meant to be doing fully :P/>
Thanks guys. :)/>
Mrrraou #10
Posted 26 May 2013 - 08:21 AM
I get a Divide by zero error when I start the game :(/> What's the problem ?
Kingdaro #11
Posted 26 May 2013 - 12:29 PM
I get a Divide by zero error when I start the game :(/>/> What's the problem ?
Erm…

Lua doesn't error on divisions by zero. I'm not sure what kind of setup you're trying to run this on. O.o
Symmetryc #12
Posted 02 June 2013 - 07:54 PM
It says that "falling-box.exe has stopped working" when I run it. Is there a a fix?
Kingdaro #13
Posted 02 June 2013 - 08:17 PM
Hm. I'm not exactly sure; that's never happened before. :/
Symmetryc #14
Posted 02 June 2013 - 09:19 PM
I'm not sure if this helps but here:
Spongy141 #15
Posted 03 June 2013 - 01:47 AM
Could you tell us your progress on a next update? Personally I really want to see how this game goes, since I really enjoy playing it :)/>
Kingdaro #16
Posted 03 June 2013 - 04:12 AM
Progress is relatively slow, but I'm working on a more advanced map loader at the moment. Rather than set types for each pixel in an image, I've implemented a system that allows me to define the properties of what a pixel in a map image will have, such as being a solid block, a player spawn, a player checkpoint, an enemy spawn, a moving block, etc.

Of course, I'm stuck (kind of) on the part where I need to mesh blocks together as bigger blocks (much like monitors in CC) so that platforms can move as one without collision issues of any kind, and to speed up the game significantly. I have a pretty good idea of how to go about doing it, I'm just slacking off a bit :lol:/>

Aside from a better map loader, I want to add more RPG elements to the game, and I'm not exactly sure how to go about doing that.
GravityScore #17
Posted 03 June 2013 - 05:29 AM
Progress is relatively slow, but I'm working on a more advanced map loader at the moment. Rather than set types for each pixel in an image, I've implemented a system that allows me to define the properties of what a pixel in a map image will have, such as being a solid block, a player spawn, a player checkpoint, an enemy spawn, a moving block, etc.

Of course, I'm stuck (kind of) on the part where I need to mesh blocks together as bigger blocks (much like monitors in CC) so that platforms can move as one without collision issues of any kind, and to speed up the game significantly. I have a pretty good idea of how to go about doing it, I'm just slacking off a bit :lol:/>

Aside from a better map loader, I want to add more RPG elements to the game, and I'm not exactly sure how to go about doing that.

Not sure how you're implementing map loading - but my favourite way to do it is to use Tiled. You can use it to create your own block types to place on a top down grid map, or orthogonal, or isometric maps. There's a love class here to load the generated XML files here.

You could have 2 different block types for stationary and meshed bigger blocks, and just render them with the same image, but move the ones with a meshed block type.
Kingdaro #18
Posted 03 June 2013 - 05:36 AM
Tiled is too complicated and too tedious for my purposes. I've been there and I'm never going back. Also, the maps (as of the current release) are loaded as images, where each pixel is a block:



White is nothing, black pixels are solid blocks and cyan pixels are blocks that other blocks fall through, but players don't. Of course, I had this map also developed as a more advanced test:



With the current maps system, there are no block types set in stone; they are set by the map directory itself, in a file called blocks.txt. This would be a file tree of a map directory:

/maps
- /test
  - map.png
  - blocks.txt
  - info.txt

map.png is the actual map image, blocks.txt is where pixel colors are defined, and info.txt is just for general map information, like block sizes or background color. Here's the blocks.txt for this map:

#0 0 0:	solid:;

#0 255 255:	platform:;
	
#255 0 255:	moving: direction = left: color = 0 0 255;
#255 120 0: moving: direction = down: color = 255 0 0;
#50 50 50: ghost:;

#0 0 255: player_spawn:;
#255 0 0: enemy_spawn:;
#0 255 0: checkpoint:;

#100 100 100: nonsolid: color = 100 100 100;

Where each pixel color is defined with a hash symbol, then three RGB values. The block type is defined immediately after a colon, and any bock parameters (set as param = value) separated by more colons, ending in a semicolon. For example, the first line in the blocks.txt defines any pixel with the RGB value of 0 0 0 (black) as a solid block, collided with by every game object. The third line with type platform, that's an unused value for a platform that you can pass over by jumping through underneath.

Whoops, I rambled. :lol:/>/>
GravityScore #19
Posted 03 June 2013 - 10:03 AM
-snip-

Wow that's a much cooler way :P/>
I prefer that sort of idea. I guess it really depends on the situation.

You specify a direction, but no distance? How does a platform know how far to move? Is that a set value?
Kingdaro #20
Posted 03 June 2013 - 03:07 PM
Moving platforms would bounce off of any kind of block (not spawns), which is why I have those dark gray pixels there. They're defined as "ghosts", and are not visible and cannot collide with anything, so I just use them as placeholders for movement limits.
Jarle212 #21
Posted 03 June 2013 - 03:15 PM
Open source :3. good game, but the game only register one key at a time(for me atleast). I am not able to jump and move left/right at the same time
Spongy141 #22
Posted 03 June 2013 - 05:26 PM
Open source :3. good game, but the game only register one key at a time(for me atleast). I am not able to jump and move left/right at the same time
I think it must be just you, since I can move and jump just fine.
Kingdaro #23
Posted 03 June 2013 - 05:45 PM
I believe he's talking about an issue dealing with not being able to hold DW or AW at the same time. He either has a terribad keyboard, or a joystick is plugged in.
Jarle212 #24
Posted 04 June 2013 - 10:46 AM
I believe he's talking about an issue dealing with not being able to hold DW or AW at the same time. He either has a terribad keyboard, or a joystick is plugged in.

I got a logitech G15 series keyboard(never had any problems with it before) and no joystick plugged in :/

The problem only occures when I am holding down L and W which makes me not able to use the A button, but the D button still works. If someone understands what I am saying :L

To reproduce:
Hold L and W then press/hold A
Kingdaro #25
Posted 04 June 2013 - 03:07 PM
Ah, nope. I'm not having the issue. Logitech keyboards though, for me, have always had problems with holding certain key combos together at once. In that case, I'll see if I can make a key configuration option.
Kingdaro #26
Posted 04 June 2013 - 03:53 PM
Doubletoast for a nice variable loader:

Spoiler

varloader = {}

function varloader.load(path, defaults)
	local vars = {}
	if not love.filesystem.exists(path) then
		local content = ''
		local endl = love._os == 'Windows' and '\r\n' or '\n'
		for k,v in pairs(defaults) do
			content = content .. k .. '\t' .. v .. endl
		end
		love.filesystem.write(path, content)
		return defaults
	end
	for line in love.filesystem.lines(path) do
		local key, value = line:match('([%w_]+)%s+(.+)')
		if key and value then
			vars[key] = value
		end
	end
	return setmetatable(vars, {__index = defaults})
end

And configurable controls. The controls.txt is located in %APPDATA%\LOVE\falling-box for Windows users, ~/.local/share/love/falling-box for Linux, and /Users/user/Library/Application Support/LOVE/falling-box for Mac users.

Run the game to generate a default controls.txt, then edit it to your pleasing. The file format is just "control key" for each line. A list of available keys for LÖVE: http://www.love2d.org/wiki/KeyConstant

And with that, the download has been updated.
Jarle212 #27
Posted 04 June 2013 - 05:16 PM
The newest version is broken for windows. Tells me that it is not compatible with the windows-version(64-bits) I am running
Kingdaro #28
Posted 04 June 2013 - 06:24 PM
Odd, the 32-bit executable should work for all systems. Perhaps I packaged it wrong, hm.

EDIT: I grabbed the command for creating executables directly from the wiki this time and tested it myself. The updated download should work.
Jarle212 #29
Posted 05 June 2013 - 02:03 AM
thanks it works now :D/>
Kingdaro #30
Posted 06 June 2013 - 04:37 AM


Finally got around to finishing that "block meshing" algorithm. One hell of a loop jungle, it is. This not only makes larger maps lag less, but it should make physics "kinder", especially with moving platforms.

EDIT: Updated the download with progress. The level is just now a set level and the enemies don't respawn after you kill them. And you'll also get a nice menu with a set of fancy animations, just because. (The "Options" option does nothing.)
Spongy141 #31
Posted 06 June 2013 - 03:17 PM
Nice update, though I did find one bug, at least I think its a bug, well at the start of the map were you jump on those moving platforms, when I held a block, I stuck on the side of one of them… I'm guessing that wasn't meant to happen. Other than that great update, though I if I fell of or died I didn't have to start at the beginning again. :/
Kingdaro #32
Posted 06 June 2013 - 04:53 PM
Yeah, I noticed that too. I was just too lazy to fix it :lol:/>

Also, checkpoints are done (I literally could not continue testing without finishing them), so you shouldn't have to worry about having to restart the level.