Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: squidgetx on February 01, 2011, 07:33:15 pm

Title: SandLand
Post by: squidgetx on February 01, 2011, 07:33:15 pm
This is a project that was inspired by Builderboy's Cellular Automata physics tutorial (hence the name). Ironically it currently does not have any kind of particle physics or cellular automata in it at all. For now I'm just working on the main character physics, and I've managed to produce something I thought was worthy enough to post and officially unveil this previously secret project ;)

More details on gameplay will be unveiled later, as I think that if I succeed, I want it to be a surprise (because it will look really, really cool). For now you can just know that it will be some sort of platformer with as much physics as I can cram into it.

Currently all the character physics are done, including horizontal acceleration and deceleration due to friction, collision/momentum with walls, jumping (use 2nd) with real gravity and such.

Next up is the scrolling tilemapper... I'm planning to use the tilemapper only for drawing, and not for collision detection. Hooray for inefficiency :D
Title: Re: SandLand
Post by: Ashbad on February 01, 2011, 07:34:32 pm
hmm, this sounds really cool :D  I wish you good luck on it!
Title: Re: SandLand
Post by: squidgetx on February 01, 2011, 07:40:13 pm
I added vertical impulses. See first post for new stuff, as I'm sure most people haven't even read the topic yet.
Title: Re: SandLand
Post by: Builderboy on February 01, 2011, 07:41:46 pm
Yayy I can't wait to see your particle physics in action :)
Title: Re: SandLand
Post by: ztrumpet on February 01, 2011, 07:49:19 pm
Sounds cool.  Good luck. :)
Title: Re: SandLand
Post by: Binder News on February 01, 2011, 08:53:16 pm
Niiiice. I really should get back to the physics on The 4th Dimension. Or maybe just turn the engines into a new mario-style game...
Title: Re: SandLand
Post by: squidgetx on February 02, 2011, 09:31:39 am
Scrolling+acceleration=pain x.x.

Maybe I'll go with no scrolling, simply something similar to Zelda or Trio/Niko where you have 'rooms'....
Title: Re: SandLand
Post by: Happybobjr on February 02, 2011, 09:35:44 am
Request: rotation of the sprite.  if you are going left, rotate left. If right, rotate right.  (This will just turn the eyes oO )
Title: Re: SandLand
Post by: kalan_vod on February 02, 2011, 02:56:01 pm
Very worthy of a unveil indeed!
Title: Re: SandLand
Post by: yunhua98 on February 02, 2011, 05:21:20 pm
wow!  that looks amazing!  and yea, maybe just rooms would be nice lol.
Title: Re: SandLand
Post by: squidgetx on February 02, 2011, 08:10:44 pm
I will try for a couple days to get a tilemapper working. It will be inefficient though, and if it's too slow I'll have to scrap it in order to make room for the other stuff.

Basically (gathering my thoughts here) I'm going to need to keep track of the X offset and Y offsets. When you move, I'll have to check if you get too close to the side of the screen in which case I change the offset value instead of the real X and Y screen values. The tilemap will be drawn using the offset value divided by 8 and then shifted by the offsets modulus 8.

Does anyone have any better ideas?
Title: Re: SandLand
Post by: Builderboy on February 02, 2011, 08:21:05 pm
Instead of having the tilemap independent of the character, what about making them locked?  In your tile mapping routine you could have a basid *off screen* tile, and it might make things a lot simpler.
Title: Re: SandLand
Post by: squidgetx on February 02, 2011, 08:26:39 pm
So having the character be locked in the center? That's an idea I was considering before....hmmmm

edit; @happybobjr, yeah I'll add that later :)
Title: Re: SandLand
Post by: Binder News on February 02, 2011, 10:12:30 pm
I will try for a couple days to get a tilemapper working. It will be inefficient though, and if it's too slow I'll have to scrap it in order to make room for the other stuff.

Basically (gathering my thoughts here) I'm going to need to keep track of the X offset and Y offsets. When you move, I'll have to check if you get too close to the side of the screen in which case I change the offset value instead of the real X and Y screen values. The tilemap will be drawn using the offset value divided by 8 and then shifted by the offsets modulus 8.

Does anyone have any better ideas?
Sounds like what I'm using for The 4th Dimension. You can have the source, if you PM me.
Title: Re: SandLand
Post by: shmibs on February 02, 2011, 10:31:23 pm
i'm doing the 'locked' method for blaster master, although i'm still not convinced i've finished optimising the tilemapper, so it may not be the best reference.

if you're doing particle physics, though, i think rooms would be the best bet. maybe your character sprite could be slightly smaller to make it not feel so cramped? good luck with whatever this is, squidget!
Title: Re: SandLand
Post by: Builderboy on February 03, 2011, 12:59:24 am
True, with particle physics, it might be best to contain it to a single room, all those particles add up O.O Plus scrolling and you have yourself a framerate nightmare
Title: Re: SandLand
Post by: squidgetx on February 03, 2011, 07:15:09 am
Well I got the scrolling working anyway. Some of the collision detection is a little glitchy; and there is absolutely no checking when you are moving upwards. Other than that it looks okay though. It's a little slow, but I know several places that could be heavily optimized (I'm running through a few loops about 8 times as much as necessary XD), and I'm still at 6mhz.
Title: Re: SandLand
Post by: DJ Omnimaga on February 03, 2011, 09:44:59 am
Looks nice Squidgetx. I like the physics so far. :) Is the glitch you are talking about the blocks that magically appear at the bottom, though? ???
Title: Re: SandLand
Post by: squidgetx on February 03, 2011, 05:41:25 pm
Update!

After much optimizing, I think it now runs FASTER than the original without scrolling :o. Also, I have fixed the bad collision detection: sometimes you could fall through the floor and such. Additionally, if you get too close to the edge, you will now semi-realistically slip down ;) If you fall really far down, the tiles will still randomly change because you have fallen past the limits of L1 :/

Oh and yeah, I added the character animation. It actually helps me debug the program too :D
Title: Re: SandLand
Post by: yunhua98 on February 03, 2011, 05:47:19 pm
Nice! I can't wait to see how this turns out. ;)
Title: Re: SandLand
Post by: squidgetx on February 03, 2011, 07:54:05 pm
Thanks.

comicIDIOT over at Cemetech has given me some great ideas, so once I get Spoiler for Hidden done, I will begin to work on destructable blocks, blocks with more friction or bounce than others, and collectibles :o (I don't think it'll be able to manage enemies though)

edit: 911! haha
Title: Re: SandLand
Post by: Madskillz on February 03, 2011, 08:32:25 pm
That is great squidgetx...the character animation adds a lot. I also cant wait for all the different blocks.
Title: Re: SandLand
Post by: ztrumpet on February 03, 2011, 10:19:09 pm
That looks wonderful!  Excellent job! ;D

One thing though:  Make sure that the character can't go up and into the block above him - it looks kinda weird. :)
Title: Re: SandLand
Post by: DJ Omnimaga on February 04, 2011, 03:02:45 am
Darn this looks impressive! This is a bit how I wanted Supersonic Ball to be at first, except that I just didn't have the skills to do a tilemapper, then I just moved on.
Title: Re: SandLand
Post by: squidgetx on February 04, 2011, 07:12:15 am
One thing though:  Make sure that the character can't go up and into the block above him - it looks kinda weird. :)
Are you just warning me, or did you actually see that ??? (Because I *think*have collision detection working in all 4 directions)/

Anyway, I've run into a problem. The problem is that, well, the particle physics that I had planned is going to be practically impossible. Why? Because, well, you can't do pixel testing off screen. And even if you could, I won't make the tilemapper draw offscreen either. So now I think I'm going to have to scrap my original idea, making the name SandLand have nothing to do with the game lol. However, I would take this awesome tilemapper and run with it, adding loads of awesome stuff like special blocks, collectibles, maybe even enemies. I think it's OK though, because my old idea wasn't going to make a game, I don't think. I mean, it's like, "Ok, there's water/sand/acid. So what?" I don't know, maybe I'm just rambling right now :P

tl;dr: There will probably be no particle physics or cellular automata in this. Sorry. I'm going to make everything else moar awesomes to compensate.

If I had seen this post earlier, things might have been different:
True, with particle physics, it might be best to contain it to a single room, all those particles add up
But I think I like where this project is going too much to try and steer it back to where I originally wanted it to go ;)
Title: Re: SandLand
Post by: DJ Omnimaga on February 04, 2011, 09:43:36 am
As for particles, what kind did you plan to include? I guess you could use tilemap-based collision detection, but I don't know if it's possible and if it would be fast enough.
Title: Re: SandLand
Post by: ztrumpet on February 04, 2011, 05:00:57 pm
One thing though:  Make sure that the character can't go up and into the block above him - it looks kinda weird. :)
Are you just warning me, or did you actually see that ??? (Because I *think*have collision detection working in all 4 directions)/
I see it happening when there's only 8 pixels of space (top to bottom) between blocks and you try and squeeze through there.  I fear this is also happening with left/right as well. :(

Sounds good.  It sure looks great! ;D
Title: Re: SandLand
Post by: leafy on February 05, 2011, 04:58:08 pm
Just wondering, does your scrolling redraw the map every frame, and does it draw the entire map or only the screen dimensions?
Title: Re: SandLand
Post by: squidgetx on February 05, 2011, 05:44:18 pm
It redraws the whole thing every frame. (I find horiz/vertical annoying to work with when you have a character in the middle of the screen as well as changing velocities :P)

I kinda see what you mean ztrumpet. I'll get to work on fixing that :)
Title: Re: SandLand
Post by: leafy on February 05, 2011, 05:57:38 pm
Those speeds are very impressive. Just wondering, how large is your map? Also good luck on your project :D
Title: Re: SandLand
Post by: DJ Omnimaga on February 06, 2011, 01:39:59 am
It redraws the whole thing every frame. (I find horiz/vertical annoying to work with when you have a character in the middle of the screen as well as changing velocities :P)

I kinda see what you mean ztrumpet. I'll get to work on fixing that :)
Yeah true. This is why I didn't want to use them in Supersonic Ball. X.x

It seems pretty fast by the way, despite drawing the whole thing every frame. :D
Title: Re: SandLand
Post by: squidgetx on February 06, 2011, 10:36:25 am
My maps are 32x32 tiles, though I could change them to any dimensions if I wanted to (but I think I like 32x32)

Yeah, the tilemapper is much fastet than I thought it would be...and it could even still be optimized further...>:D
Title: Re: SandLand
Post by: leafy on February 06, 2011, 11:21:46 pm
I never really liked bouncy ball <sic> games much because they're so counterintuitive to a person who's played classic platformers all his life :D Also I was thinking instead of making the player slide off if they get too close to an edge, make it like sonic, where it shows a graphic of him balancing on the edge for a while, then falling off. Or was it SSB? I forget.
Title: Re: SandLand
Post by: shmibs on February 07, 2011, 03:32:31 am
i, too, am rather impressed by those ridiculous speeds(and i may have to get you to help with optimising things eventually, if you wouldn't mind). however, i ran into something a bit disconcerting. granted, the player did start inside a tile upon running the program, but the last time it was run he started in the air, fell down, and then got stuck in/proceeded to sink through the ground.
Title: Re: SandLand
Post by: ztrumpet on February 07, 2011, 03:49:19 pm
That's... strange.  Good luck fixing it. :)

Could you make it so that so tiles are made of sand and you have to sink through them like that? :D
Title: Re: SandLand
Post by: Binder News on February 07, 2011, 04:18:19 pm
Is the tile mapper on Full mode, or Normal?
Title: Re: SandLand
Post by: squidgetx on February 07, 2011, 05:41:33 pm
shmibs: thanks! and I would love to help you optimize for blastermaster :).
ztrumpet: Currently the collision is pixel based, but theoretically maybe I could make a special case for the sand tiles...perhaps
Binder: The program is on Normal mode. here's what it looks like on Full XD. It's so fast I can barely control it

Currently I am having issues with slopes, and I'm thinking I'll just resort to having slopey-ness be part of a block's list of attributes (instead of pixel testing) in addition to friction, bounciness, and breakability. (which I haven't really added yet either). So while I brainstorm about this, you guys can have fun with this new build that has different tiles in it :o (and hopefully fixes shmibs' bug)

Note that I haven't yet added level support and that the game, every time you run it, reads whatever happens to be in L1 :P
Title: Re: SandLand
Post by: Binder News on February 07, 2011, 05:57:29 pm
Holy COW! I have a pretty fast tile mapper, but it goes the speed on Full that yours does on Normal! I really would like to know how you got it to go that fast.
Title: Re: SandLand
Post by: Builderboy on February 07, 2011, 06:35:41 pm
Wow I was thinking to myself "Thats now *that* fast of a screenshot" until I realized I was on Chrome, and it was playing at like third speed XD Amazing job on the mapper and good luck on implementing slopes!  They really are tricky D:
Title: Re: SandLand
Post by: shmibs on February 07, 2011, 07:53:34 pm
at this point, squidget, i think simply being able to glance at your source would be enough for my purposes (and maybe even run enemies in 6mhz)
EDIT:
there is one thing, though. how could one go about making a loop to accomplish Repeat A=B+C:End (Edit: to clarify Repeat (A=B)+C) without requiring the use of a "="?
Title: Re: SandLand
Post by: ztrumpet on February 07, 2011, 08:03:19 pm
Looking great, squidgetx! ;D

While B+C-A: End would probably work. :)
Title: Re: SandLand
Post by: squidgetx on February 08, 2011, 07:18:56 am
Haha, thanks guys. I'll comment up the source and get it to you later shmibs :)
Title: Re: SandLand
Post by: leafy on February 08, 2011, 03:11:19 pm
<leafy wants to see source too> :D <puppy eyes>
Title: Re: SandLand
Post by: squidgetx on February 08, 2011, 08:03:02 pm
Here is sourcey. It is slightly more optimized than before, too, thanks to calc84maniac.

It probably could be optimized more too, but I think then it would get too unreadable, plus I need the flexibility of the current setup.
Anyway, this offers a pretty good physics lesson as well as a tilemapping one. Have fun guys :)
Title: Re: SandLand
Post by: shmibs on February 08, 2011, 09:25:35 pm
=DDD
thanks, squidget.
Title: Re: SandLand
Post by: squidgetx on February 09, 2011, 07:12:58 am
Note; there's a bug. Change the line Q<<0-(Q>>0)->W to Q<<0*2-1->W. Otherwise you'll sink through the ground ;)

Title: Re: SandLand
Post by: squidgetx on February 09, 2011, 08:05:43 pm
rawr, double post update!
Anyway, I've fixed up many collision/jumping bugs as well as added the ability to slowly move in the air if you have no initial x velocity (basically you use this to get out of holes).

And I finally made a chrome friendly screenie, heh heh :)

Also I have a bunch of ideas for different blocks: think conveyor belts? super bouncy or floaty ones? some with massive friction, others with none? And I have an idea on how to implement moving platforms as well....(pixel testing collision makes for lots of flexibility in the engine :D)
Title: Re: SandLand
Post by: ztrumpet on February 09, 2011, 08:09:48 pm
Looks great!

When you're "stuck" in the hole there, you're still going into the tiles though. :-\
Title: Re: SandLand
Post by: squidgetx on February 09, 2011, 08:14:05 pm
Do you mean when the char kinda sinks down by 1 pixel? Yeah, that is leftover from my old way of doing slopes: collision doesn't check the last pixel. I am going to try again to get pixel-based slopes working which is why that hasn't been fixed yet :)
Title: Re: SandLand
Post by: ztrumpet on February 09, 2011, 08:34:01 pm
No, I mean left and right.  One row of pixels can by in the row of the sprite's next to it.
Title: Re: SandLand
Post by: squidgetx on February 09, 2011, 08:44:40 pm
Ah, I see what you are talking about now. Unfortunately I have no idea what causes it :( ...Maybe I forgot a pxl-test somewhere.
Title: Re: SandLand
Post by: Xanwell on February 09, 2011, 09:38:33 pm
I like the small bouncing effect when you land after a jump. Seems like stuff like that goes a long way towards making the physics more believable.
Title: Re: SandLand
Post by: z80man on February 09, 2011, 10:57:34 pm
I was wondering, how come when you are moving some tiles seem to quickly appear then disappear. Is this just some leftover data in the ram when the tile mapper starts drawing?
Title: Re: SandLand
Post by: ztrumpet on February 10, 2011, 05:01:34 pm
I think it's because he's reading from too close to the start of L1, and he's changing the Variables in Axe (which reside just before the start of L1). :)
Title: Re: SandLand
Post by: squidgetx on February 10, 2011, 07:15:00 pm
^This is true. I will eventually add some sort of external level support which will prevent this from happening. Actually, I'll probably do it soon since L1 messes up every time I compile, so testing stuff gets annoying.

Also I realized moving platforms will be much harder than I thought previously. Unless you pretend they're made of ice :P (Relative motion is annoying). So don't hold your breath on that...
Title: Re: SandLand
Post by: Ashbad on February 10, 2011, 08:03:39 pm
maybe make them move only by 8 pixel increments?  that wouldn't be so bad actually.  Or even better, code them in as "objects" that based on simple velocities will keep moving, and are drawn before pixel testing of course :)

EDIT: in fact using an approach similar to TaNF's enemies, it would be a cinch, just have their updates and such in the main loop.
Title: Re: SandLand
Post by: squidgetx on February 10, 2011, 08:07:01 pm
The problem is that, sure I can make them move. That's easy. The hard part is that if you're standing on them, and they are moving, you will not move with it automatically. So you would actually slide off of it....Basically in addition to
1) drawing and moving the platform
I have to
2) detect if you are standing on a platform
3) retrieve velocity of said platform
4) increase X position of player by that amount

It's not impossible, but just annoying, and probably unavoidably buggy. :-\
Title: Re: SandLand
Post by: ztrumpet on February 10, 2011, 09:01:21 pm
Oh, that could be a problem.  I hope you find a solution though, 'cause they'd be epic! ;D
Title: Re: SandLand
Post by: leafy on February 10, 2011, 10:35:12 pm
Also you should add an x-velocity limit (unless you don't want to) I've noticed that if there's a flat piece of ram randomness, you can accelerate horizontally to inifinity (or 256)
Title: Re: SandLand
Post by: z80man on February 10, 2011, 11:59:13 pm
If an object accelerates past 256 does it just then stop?
Title: Re: SandLand
Post by: squidgetx on February 13, 2011, 02:48:54 pm
Idk, I haven't tried. It might start moving backwards
I'll add a terminal velocity...eventually :P. But as of now, this project is going to be on hold (or at least very low priority) until I finish Ash:Phoenix.
Title: Re: SandLand
Post by: DJ Omnimaga on February 14, 2011, 12:43:04 am
Nice, but why does the screenshots shows random tiles and some garbage? ??? Do you have any level/level demo done? I also hope you eventually finish this. Certain projects seems to get forgotten by their author after they move to another. X.x
Title: Re: SandLand
Post by: squidgetx on February 16, 2011, 03:54:02 pm
It shows random garbage because I stored level data at L1, so the overflow and residue in L1 shows up as garbage.

But, update! With even more speed than before, lots of new tiles, better level mechanics, and 1 external level for your enjoyment! I guess you could call this a demo, then :P Have fun!

Use arrow keys to move, 2nd to jump, and clear to quit...
Title: Re: SandLand
Post by: JustCause on February 16, 2011, 05:02:28 pm
Wheeeeee!

Will download the moment I get the chance. The physics look great and it seems to run really smooth. This is shaping up to be awesome.
Title: Re: SandLand
Post by: DJ Omnimaga on February 16, 2011, 05:06:21 pm
Looks great! I hope you didn't have too much troubles with slope physics. X.x
Title: Re: SandLand
Post by: ztrumpet on February 16, 2011, 05:09:14 pm
This looks great!  Nice job! ;D
Title: Re: SandLand
Post by: Builderboy on February 16, 2011, 06:39:05 pm
I tried it and it was really awesome!  I did notice however that you can't control the character while in the air?  This does make real life sense but it also makes it a bit difficult to move around :(
Title: Re: SandLand
Post by: squidgetx on February 18, 2011, 06:05:48 pm
you can't control the character while in the air?  This does make real life sense but it also makes it a bit difficult to move around :(

Yeah, I'm not sure what I want to do with that. I know for sure that I do not want you to be able to accelerate while in midair...
Also the funny thing with slope physics is that I still haven't added them. The slope physics that you see is the byproduct of the gravity/collision physics. It actually looks pretty nice, nice enough that I probably won't bother adding slope physics until later...
Title: Re: SandLand
Post by: Darl181 on February 18, 2011, 06:41:18 pm
Speaking of this "random garbage" popping up, it gave me a game idea.  A platformer, with essentially no purpose (except to have fun/kill time) that reads from the RAM, in which you can switch 'dimensions' (inspired by the random blocks appearing and dissappearing at random in the old versions). 
So... thanks for that ;D
Title: Re: SandLand
Post by: DJ Omnimaga on February 21, 2011, 03:06:28 pm
Yeah that was an idea I had once. I just wasn't too sure if it would look decent enough.
Title: Re: SandLand
Post by: squidgetx on February 22, 2011, 07:12:21 am
Weee, update!

-Fixed graphics a little
-Added tiles that move you around
-Optimized moar
-Added a terminal horizontal velocity
-Allowed moving in the air, but 1/8 the acceleration of on the ground

The level goes in archive, as always
Title: Re: SandLand
Post by: aeTIos on February 22, 2011, 09:37:33 am
OMG nice job!
Title: Re: SandLand
Post by: JustCause on February 22, 2011, 09:54:01 am
Wow. Just wow. This is awesome.
Title: Re: SandLand
Post by: aeTIos on February 23, 2011, 07:07:31 am
How on earth do you do this nice smoothscrolling ?
Title: Re: SandLand
Post by: shmibs on February 23, 2011, 09:08:16 am
i love the way the graphics are turning out in this project. nicely done, yo!
Title: Re: SandLand
Post by: Madskillz on February 23, 2011, 02:30:51 pm
Looks great squid
Title: Re: SandLand
Post by: squidgetx on February 23, 2011, 03:45:26 pm
Haha, thanks guys :)

Next, moving platforms and grayscale collectibles/water (the only way to do stuff like that since collision is pixel based :x)
Title: Re: SandLand
Post by: z80man on February 23, 2011, 03:54:04 pm
Nice, and i bet you could still keep it smooth scrolling.
Title: Re: SandLand
Post by: ztrumpet on February 23, 2011, 04:15:24 pm
This is looking great!  Every time I see it, it gets better and better.  Nice job! ;D
Title: Re: SandLand
Post by: DJ Omnimaga on February 25, 2011, 10:18:15 pm
This is nice, I really love the scrolling speed! I think it's a bit hard to move while in the air, though, but again it might be due to the level design and the fact you bounce back when hitting platforms.
Title: Re: SandLand
Post by: leafy on February 25, 2011, 10:24:50 pm
This is turning out amazing. I love the tiles, they remind me of the obligatory "underground/temple" levels in platformers :P
Can't wait to see more!
Title: Re: SandLand
Post by: shmibs on February 25, 2011, 11:28:34 pm
i just now realised that some of the tiles break when hit with sufficient momentum!
dude!
Title: Re: SandLand
Post by: squidgetx on February 26, 2011, 11:12:17 am
i just now realised that some of the tiles break when hit with sufficient momentum!
dude!
awwwwwwwwwwwwwwwwwww yeaaaaaaahhhhhh 8)

True, it is a bit difficult to move in the air. But then again, in real life it is kind of difficult to move in mid-air. I'll be sure not to make the initial levels too difficult.
Title: Re: SandLand
Post by: aeTIos on February 26, 2011, 03:16:01 pm
Haha, thanks guys :)

Next, moving platforms and grayscale collectibles/water (the only way to do stuff like that since collision is pixel based :x)
What I do, is first checking for a collectible, and then the collision detection.
Title: Re: SandLand
Post by: DJ Omnimaga on February 28, 2011, 06:19:10 pm
i just now realised that some of the tiles break when hit with sufficient momentum!
dude!
Really? I didn,t notice that at all O.O

i just now realised that some of the tiles break when hit with sufficient momentum!
dude!
awwwwwwwwwwwwwwwwwww yeaaaaaaahhhhhh 8)

True, it is a bit difficult to move in the air. But then again, in real life it is kind of difficult to move in mid-air. I'll be sure not to make the initial levels too difficult.
Yeah I know, kinda like in the first SMB. Just make the levels not too hard. X.x