Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Darl181 on February 18, 2011, 11:15:11 pm

Title: Dimension
Post by: Darl181 on February 18, 2011, 11:15:11 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 disappearing at random in the old versions).  
So... thanks for that ;D
[↑ quoted from sandland thread]
So, I started by modifying an old version of Sandland to see what I could come up with.  It's worked pretty well.
See first screenshot. Screenie removed b/c of confusions.
You can probably tell how it's supposed to work.

After that, I went to code my own.
It reads starting at a random spot in RAM.  The 'other dimension' is that pointer plus 32768 (65536/2).
It doesn't work as much.  See second screenshot.

Can someone look at the source and see what's wrong?  It seems to not be detecting tiles that should be there, or standing on a tile that's not there...

Variables:
E: starting pointer
I,J: tile offset from E.
N,O: pixel offset from I,J
D: whether or not player is on top of a tile
FGKL, PQUV: used for detection of tiles
Z,Θ: X- and Y-velocities

Thanks in advance ;D

Controls for Dimension: left/right: move left/right
2nd: jump
Alpha: swap dimension
Clear: quit

btw I'm not dropping Tio for this, I'm kind of using this to learn more about smoothscrolling tilemappers before I apply it to Tio.
Title: Re: Dimension
Post by: leafy on February 19, 2011, 12:14:19 am
That's pretty cool. I was going to make a game called "flipside" based on this concept, but without using Random RAM.
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 12:23:38 am
Thanks ;D
I was playing the first one about every other class at school today, esp. because there are so many of the teachers sick for some reason and I had like three subs :P
Kind of addictive actually, once you come up with a sort of goal (in my case, try to get as far up as possible) ;D
Title: Re: Dimension
Post by: leafy on February 19, 2011, 12:25:41 am
No idea why, but it totally reminded me of
http://www.moddb.com/mods/flipside
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 12:44:54 am
Strange...I've heard of HL2 but I've never played it before...

I'm hoping to get this figured out soon, though.  Smoothscrolling, random ideas/explorations and I don't seem to get along very well :P

Okay, I'm taking the night to try and get this fixed.
Title: Re: Dimension
Post by: DJ Omnimaga on February 19, 2011, 03:30:09 am
Interesting, in future versions you could maybe add some sort of goal to the game where you must collect an item or something and it displays how close you are from it and the faster you get to it, the higher the score.
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 04:02:25 am
That would be really hard.
The 'level' this uses is the RAM.  Like, any spot.
What it does is
rand→E  //not a typo
and later it references {E} as a pointer.  IDK if there's a way to add in stuff without editing the 'level', which is a random spot in RAM.
Title: Re: Dimension
Post by: DJ Omnimaga on February 19, 2011, 04:14:37 am
Ah ok, you could maybe add the object the early-Illusiat/ROL way, where it wasn't part of the map data.
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 04:15:44 am
How is that done?  Does it have its own pointer of something?
Title: Re: Dimension
Post by: DJ Omnimaga on February 19, 2011, 04:25:49 am
In Illusiat the object Y and X location was stored in 2 variables. If your position was equal to both then it triggered the event code.
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 04:28:21 am
Hmm...so one would try to collect coins or something spread through the RAM...could call them "corruptions" or something lol
I think I'm getting a storyline idea...

Thanks ;D
Title: Re: Dimension
Post by: DJ Omnimaga on February 19, 2011, 04:32:37 am
One thing to keep in mind, though, is that using variables you would only have one coin. It might be best to store them in an array like in L1 and run a For loop through them to display them if they're in the screen.
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 04:36:42 am
True.  Maybe when you collect one, another pops up...the last one can be in the variable buffer so it's hard to get at as the blocks are going haywire. :evillaugh:  I'm kind of liking this idea... I'll try to implement it once I get the elementary tilemapping working :P
Title: Re: Dimension
Post by: DJ Omnimaga on February 19, 2011, 04:42:24 am
That could work too.

Also what would be cool is if we could be able to move on 2 different type of tile at a time and swap layers or something, because that way I am sure the game would be even more fast-paced, as someone could switch extremly fast between layers to fall faster and faster.
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 04:45:40 am
Pretty much the main part of this game is its 'swapping layers'...watch this and you'll see kind of what I'm shooting for.
It's the image from above.
(http://www.omnimaga.org/index.php?action=dlattach;topic=6661.0;attach=6228;image)
About the blocks:
Dark gray=current layer
light gray=other layer
black=both layers

Do you mean more than two layers?
Title: Re: Dimension
Post by: DJ Omnimaga on February 19, 2011, 04:53:51 am
I mean for example, you can go through black and light gray, then if you swap layers, you can go through light gray and dark gray, then swapping again lets you go through dark gray and black, and so on. But you could just have it so you can go through white all the time and black remain solid all the time. It would be easier too.
Title: Re: Dimension
Post by: ztrumpet on February 19, 2011, 11:39:19 am
This looks really nice.  I hope it develops into a full-fledged game. ;D
Title: Re: Dimension
Post by: squidgetx on February 19, 2011, 11:41:31 am
Lol, can't wait to see what this ends up turning into...
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 03:15:57 pm
Yeah, I'm not exactly sure quite yet.  I'm doing this so I know what I'm doing when I attempt smoothscrolling in Tio so I have a "big finish" instead of a big crash.*
And I still can't figure out how to make the physics work.... I might just borrow the system from Jetpack or something...

*and I look at this post after it's posted and notice the overuse of "I" :P

Also, apparently it wasn't clear to some people so read the edit http://ourl.ca/9258
hopefully this clears up any confusion.
Title: Re: Dimension
Post by: Darl181 on February 19, 2011, 10:51:44 pm
Ok, I've pretty much driven myself beyond frustration trying to get this to work.  I fix one error, and another sprouts in its place.  What's wrong with this code ???

This program is attached at the first post.
Code: (SDMNSN) [Select]
:.DMENSION
:DiagnosticOff
:[0000000000000000]→Pic1
:[FFFFFFFFFFFFFFFF]
:[FC84B4B484FC0000]→Pic2
:0→D→I→J
:4→N+1→O
:rand→E
:E/256→J
:E-(J*256)→I
:ClrDraw
:ClrDrawr
:For(Y,0,7
:Y*8→T
:For(X,0,11
:X*8→S
:Pt-Off(S,T,{E+D}^3/2*8+Pic1
:Pt-Off(S,T,{E+D+32768}^3/2*8+Pic1)r
:D+1→D
:End
:End
:0→D→W
:Repeat getKey(15)
:If getKey(48)
:E+32768→E
:Normal
:While getKey(48):DispGraphrr:End
:Full
:End
:If getKey(3)
:Z-2→Z
:End
:If getKey(2)
:Z+2→Z
:End
:Z-(Z>>6)+(Z<<‾6)→Z
:If getKey(54) and (D)
:6→θ
:End
:W+1→W
:!If W-2
:0→W
:Z-(Z>>0)+(Z<<0)→Z
:θ+1→θ
:End
:O+θ→O
:If O>>0
:J-1→J
:O-8→O
:End
:If O<<‾7
:J+1→J
:End
:N+Z→N
:If N>>0
:N-8→N
:I-1→I
:End
:If N<<‾7
:N+8→N
:I+1→I
:End
:
:.they're unoptimized, at least temporarily, for readability
:.top left
:29-O/8+J*256+(45-N/8+I)+E→P
:
:.top right
:29-O/8+J*256+(51-N/8+I)+E→Q
:
:.bottom left
:35-O/8+J*256+(45-N/8+I)+E→U
:
:.bottom right
:35-O/8+J*256+(51-N/8+I)+E→V
:
:.look at letter locations of PQUV and FGKL on keypad
:
:.if block pointed to is "on" or "off"
:P^3/2→F
:Q^3/2→G
:U^3*2→K
:V^3/2→L
:
:If F or (G)
:O-(θ<<‾2)→O
:‾θ→θ
:End
:If K or (L)
:If θ<<2 and (θ>>‾2)
:0→θ+1→D
:‾5→O
:Else
:‾θ//2→θ
:O+1→O
:End
:Else
:0→D
:End
:If G or (L)
:N-(Z>>2)→N
:‾Z//2→Z
:End
:If F or (K)
:N+(Z<<‾2)→N
:‾Z//2→Z
:End
:ClrDraw
:ClrDrawr
:For(B,0,8
:B*8+O→T
:For(A,0,12
:A*8+N→S
:Pt-Off(S,T,{J*256+I+(B*256+A)+E}^3/2*8+Pic1
:Pt-Off(S,T,{J*256+I+(B*256+A)+E+32768}^3/2*8+Pic1)r
:End
:End
:Pt-Change(45,29,Pic2
:Pt-Change(45,29,Pic2)r
:Normal
:DispGraphrr
:Full
:End

I'm going to keep trying to figure this out, but at this rate...
Title: Re: Dimension
Post by: DJ Omnimaga on February 23, 2011, 01:21:47 am
Sorry to hear about the bugs, maybe you can also ask in the Axe section if no one sees this?

Also are the files attached to the first post updated since my last reply?
Title: Re: Dimension
Post by: Builderboy on February 23, 2011, 01:23:58 am
Hmmm so what is this code supposed to do?  And what is the problem with it?  What are some of the variables and what do they mean?  Which sections of code do what?
Title: Re: Dimension
Post by: Darl181 on February 23, 2011, 01:30:37 am
About the bugs, I might have to.  I don't put too much weight on this, though...it's kind of a side project.  Though, the sooner it's finished the better I guess :P

And the files in the first post haven't been updated, mainly b/c I have no idea what's wrong with this...catch 22 I guess.

I'm thinking it's just the physics system not detecting if it's on the ground, but I'm not sure.  If/when I decide I can't figure this out, I'll ask about it in the axe thread.  I prefer to learn things by myself if possible, that was how I figured out tilemapping (TWHG).

@Builder look at the screenie you'll see what's wrong. :P
(http://www.omnimaga.org/index.php?action=dlattach;topic=6661.0;attach=6229;image)
Title: Re: Dimension
Post by: Darl181 on February 24, 2011, 02:43:57 pm
Ok, it's working slightly better now, I just have to figure out why it's going left on its own:P
Code: [Select]
:.DMENSION
:Full
:DiagnosticOff
:[0000000000000000]→Pic1
:[FFFFFFFFFFFFFFFF]
:[FC84B4B484FC0000]→Pic2
:0→D→I→J→Z→θ
:‾4→N+1→O
:rand→E
:E/12→J
:E-(J*12)→I
:ClrDraw
:ClrDrawr
:0→D→Q
:Repeat getKey(15)
:If getKey(48)
:E+32768→E
:Normal
:While getKey(48):DispGraphrr:End
:Full
:End
:
:If getKey(47)
:ClrHome
:Disp "Z",Z►Dec,i,"θ",θ►Dec
:While getKey(47):Pause 10:End:Repeat getKey(47):End
:End
:
:0→V
:If pxl-Test(46,35)+pxl-Test(51,35)
:0→θ+1→V
:O-(O^8)+1→O
:End
:Q+1→Q
:!If -6
:→Q
:!If V
:θ-1→θ
:End
:End
:!If θ-6:5→θ:End
:!If θ+6:‾5→θ:End
:If V
:-1→θ
:If getKey(54)
:-1→W→V+2→θ
:End
:End
:If θ<256
:For(A,0,θ
:ReturnIf getKey(15)
:If pxl-Test(46,29)+pxl-Test(51,29)
:O+(O^8)→O
:0→θ
:End
:End
:End
:
:If getKey(2)
:If pxl-Test(46,30)+pxl-Test(46,35)
:Else
:N+1→N
:End
:End
:If getKey(3)
:If pxl-Test(51,30)+pxl-Test(51,35)
:Else
:N-1→N
:End
:End
:O+θ→O
:
:If O>>0
:J-1→J
:O-8→O
:End
:If O<<‾7
:J+1→J
:O+8→O
:End
:If N>>0
:N-8→N
:I-1→I
:End
:If N<<‾7
:N+8→N
:I+1→I
:End
:ClrDraw
:ClrDrawr
:0→H
:For(B,0,8
:B*8+O→T
:For(A,0,12
:A*8+N→S
:Pt-Off(S,T,{J*12+I+E+H}^3/2*8+Pic1
:Pt-Off(S,T,{J*12+I+E+H+32768}^3/2*8+Pic1)r
:H+1→H
:End
:End
:Pt-Change(45,29,Pic2
:Pt-Change(45,29,Pic2)r
:Normal
:DispGraphrr
:Full
:End
(yay, I remembered to not put it in a spoiler this time w00t)

While falling down, it jumps to the left for some reason.
You might also notice that i switched to pixel testing, I kind of ran out of patience in that aspect...

btw yes, in the screenie there's only one layer showing.  It reads properly, that's just an empty part of the RAM.
Title: Re: Dimension
Post by: DJ Omnimaga on February 25, 2011, 10:08:06 pm
Hmm weird, something's definitively overwriting the horizontal directional variable there or is wrong with horizontal direction/acceleration code. X.x
Title: Re: Dimension
Post by: Darl181 on February 26, 2011, 12:52:09 am
Just noticed something in the code as I was going through it...
Code: [Select]
:If N>>0
:N-8→N
:I-1→I
:End
:If N<<-7
:N+8→N
:I+1→I
:End
This, I think, is the source of the problem, b/c I made the blocks into comments and it worked somewhat properly, just messing up the physics system horribly.  That doesn't explain why it happens so often though...
I'm working on it.

After I get this working enough, I can safely use the concepts in Tio (after I get the editor working :P)...so close...
Title: Re: Dimension
Post by: DJ Omnimaga on February 28, 2011, 03:36:54 pm
I see. Good luck! X.x
/me hopes a new version comes out soon :D
Title: Re: Dimension
Post by: Darl181 on March 01, 2011, 02:47:48 pm
If you want a buggy, potentially unsafe version then sure :P
I'm kind of flipping between this and Tio, and Tio is kind of the larger project, so...
What's kind of confusing about this is trying to come out with a width that won't make the program bug, b/c it reads from the RAM, which is, so to speak, infinite because it just loops.  256 didn't work, 12 bugged, so did 24.  This is actually kind of interesting, confusing, and frustrating at the same time  ???
Title: Re: Dimension
Post by: DJ Omnimaga on March 03, 2011, 04:56:58 am
Lol ok, I hope you get it fixed soon. Remember you can ask in the Axe forum for help if you need any.