This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Your Projects subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Project Ideas/Start New Projects => Your Projects
Author Message
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 19 Aug 2008 05:57:04 pm    Post subject:

some times a happy picture helps visualize a tile map ;o


Each tile is 8 tiles, aka 0-7 8-15 16-23 24-31


7-0 +1 = 8 pixels.


Last edited by Guest on 19 Aug 2008 05:58:18 pm; edited 1 time in total
Back to top
Liazon
title goes here


Bandwidth Hog


Joined: 01 Nov 2005
Posts: 2007

Posted: 19 Aug 2008 06:13:12 pm    Post subject:

TylerMcL wrote:
What I'm in the progress of doing is just designing the tilemap to notice if the corner bytes are 0000 0000 or not. This is going to signify if the player's movement will deviate from the center or not, and ultimately determine if the screen should be shifted or not. This will hopefully get rid of the giant hastle of having to keep track of a x and y coordinate. I hate the x and y method on a tilemap because if you design events based on these coordinates, it makes it almost impossible to make any changes later, and also even a larger pain to code.


um... can you elaborate? I'm not sure what you're trying to say about events and the mapper.
Back to top
asdf


Advanced Newbie


Joined: 17 Aug 2008
Posts: 73

Posted: 19 Aug 2008 08:52:14 pm    Post subject:

Same here. Usually it's simple enough to give each map a width and height, which you can use to calculate (with x/y coordinates) when the player has reached the edge of the map.

"if you design events based on these coordinates, it makes it almost impossible to make any changes later"
What changes would you be making? I'm not sure what you are trying to do.


Last edited by Guest on 19 Aug 2008 08:52:42 pm; edited 1 time in total
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 19 Aug 2008 08:59:33 pm    Post subject:

Actually you can use the tile map to set off events.. like as you scroll, check the elements at the edge of the screen to see what is supposed to happen.
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 19 Aug 2008 10:59:31 pm    Post subject:

alright, I'm really sorry about any confusion... Let me try to clear some things up for you guys :D

Alright, so like in BASIC, you normally have to keep track of your x and y coordinate -- right? This older method can then be used to "trigger" certain events based on their x or y coordinate. (Yes, there are other methods -- i know)
Instead of this beginner's method (yet effective), I am going to use the map itself to trigger events. A certain number (eg. 0000 0001)

What the engine is going to do is distinguish what kind of tile-map "pieces" the player sprite is on top of. The closest thing to keeping track of an x and y coordinate is going to be the offset only when the player is no longer centered on the screen.

So here's what I meant with the whole "not being able to make any changes" statement:

I have not yet designed any bit of how the tile-map is going to fit together. I'm not sure where I want to put trees, or rocks, or roads, or people, or anything. But what I am going to do is create an engine that does not require several different tile-maps. It's just going to be one large tile-map. It is going to remain in the program, then be decompressed in a reserved area of RAM, and then set into the Display memory.

That bit didn't really answer the question whatsoever, so let me try that again :D

I don't want to keep changing the engine for the tile-mapper. I just want to be able to change the tile-map itself. Forget about changing it;s dimensions in the code, just add a loop that checks the corners of the tile-map for a 0000 0000 byte that will signify the edges of the tile-map. It just seems easier for me to be able to edit more often, without the confusion and head-ache.

I hope this terrible explanation helps somewhat Very Happy

Tell you what -- I'm kinda tied up at the time, but I'll attempt to draw a picture of what I mean later tonight, or first thing tomorrow morning :D

Pictures always help -- right? Razz
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 20 Aug 2008 12:01:00 am    Post subject:

You, as the programmer should know the end of the map. I don't think having a specific tile to signify the border of a map works anyway.

All you can do is have a barricade to keep yourself from walking off the edge.


Not sure what you mean, but you need an x and y coordinate for atleast one corner where everything is relative 2.
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 20 Aug 2008 12:43:56 am    Post subject:

...? Of course I can have a specific byte (tile) indicate the border of a tile-map. Data is whatever you make of it. And I freakin say that 0000 0000 is going to signify the border to my tilemap Very Happy -- why not, right? :P

And I don't have to have an x or a y coordinate for 95% of the time. All you have to do is detect a keypress, and move the sprite and tilemap accordingly. Just simply keep track with a flag for if the sprite is centered or not. If it is not centered, then I'll use sometype of coordinate system to calculate the offset.

This all makes sense, right? ...I hope so...


EDIT:

Let me try a different perspective of explaining.

Including everything above, consider the following:

Once it has been determined that the sprite is no longer centered, set the remaining amount of steps that the player has left before he supposively would "walk" off the screen. Once this number counts down to zero (and you're right next to the wall), don't allow any movement in that direction Very Happy Simple as that! Very Happy


Last edited by Guest on 20 Aug 2008 12:52:22 am; edited 1 time in total
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 20 Aug 2008 12:07:09 pm    Post subject:

Erm, in Blobby i didn't use an x and y coordinate either ;o

I used what tile was on the edge of the screen and the pixel offset. I think thats what you're doing.


Still I have no idea about your map border but if you can make it work, kudos. ;o
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 22 Aug 2008 11:09:44 pm    Post subject:

hey everyone! Sorry again i haven't been able to post any progress. :/ I've been really busy with work lately, and I'm waiting to go back to school on the second.

After the first week of school, this project is really going to start making some progress. Smile I want to have the sequel done by the beginning of next year Smile that's my plan!

Thanks again for not hunting me down and killing me for not making much of any progress on the game Smile I've been planning oiut alot of it during my hours at work though. I have some pretty good ideas, along with how I'm going to go about with them Smile

Appreciate all your patience! (no -- I am NOT thinking of discontinuing the game -- just been making some money for a car Smile
Back to top
asdf


Advanced Newbie


Joined: 17 Aug 2008
Posts: 73

Posted: 23 Aug 2008 09:31:58 am    Post subject:

I don't think you should really set a deadline for yourself at this point, especially since that is pretty hasty. I don't doubt that you can finish it, but setting deadlines usually only serve to frustrate you or burn you out. :)

A quote from Maarten who wrote The Verdante Forest RPG:
Quote:
...I sought for information provided by other TI-RPG makers and stumbled upon a piece by Alex Roper. He said that making a good RPG took around 2 years to complete. of course I didn't agree and thought I could do it in 6 months. After 6 months a big part of the game was released as a BETA at ticalc. I got extremely much positive comments through emails, IMs, PMs. And decided that I was gonna be one who was gonna break the cycle and release my RPG within one year. I coded through the whole summer, dismissing all my friends temporarily and skipping all the fun. After that summer I was completely broken down and sweared I would never lay eyes on any piece of ASM code ever again. Not keeping in mind all the work I had previously done. I kept the game in the freezer for 6 months when I realized that all the work I had done for it should not be in vain. I took up the project and started finalizing it....


With that said, i'm sorry but i still don't really understand what you are talking about with your tilemap idea Razz
If you are putting a border around your tilemap to signify the edge, a 32x32 tilemap will have 132 extra bytes, because it essentially turns into a 34x34 tilemap.

Quote:
Once it has been determined that the sprite is no longer centered, set the remaining amount of steps that the player has left before he supposively would "walk" off the screen. Once this number counts down to zero (and you're right next to the wall), don't allow any movement in that direction laugh.gif Simple as that! laugh.gif

This is usually done by adding information at the top of the tilemap data that says how tall and wide the tilemap is. Say your tilemap can display 12 columns and 8 rows on the screen at once (8x8 sprites) and your character has the following range of motion on the screen (meaning the screen doesn't shift when they move around in the areas marked by an X):
0123456789AB
000000000000
000000000000
000XXXXXX000
000XXXXXX000
000XXXXXX000
000XXXXXX000
000000000000
000000000000

If you want to check if you have reached the left edge of the tilemap:
Has the player reached the third column on the tilemap (not the screen, the actual tilemap)?
If not, scroll the map appropriately and return (do not update player's coordinates).
If yes, check if the player has reached the 0th column.
If not, shift the player's sprite left but leave the map in the same position.
If the are at column 0, they are at the edge of the screen and can't move any further.

If you want to check if you've reached the far right edge of the tilemap:
Has the player reached the (mapWidth-3)th column on the tilemap?
If not, scroll the map appropriately and return without updating the players position.
If yes, check if the player has reached the (mapWidth)th column.
If not, shift the player's sprite right but don't adjust the map's position.
If the are at column mapWidth, they are at the edge of the screen and can't move any further.

..and the same applies for up/down as well.

Here's an example for an aligned tilemap where the character remains in the center:

Code:
_checkLeft:
ld (hl),1;hl is pointing to the variable which holds the direction the player is facing. Apparently a value of 1 means the player is facing left
ld hl,mapX
ld a,(hl)
or a;if mapX = 0, the map is at it's edge and can't scroll any further
ret z
call checkTile    ;check if the tile we want to walk on is walkable/an action tile. It looks like it also preserves hl
ret nc ;carry is set if tile is ok to walk on
_scrollLeft:
dec (hl)
;update map/screen

_checkRight:
   ld (hl),2
   ld hl,mapX
   ld e,(hl)
   ld a,(mapWidth)
   sub 12
   cp e
   ret z
   call checkTile
   ret nc ;carry is set if tile is ok to walk on
_scrollRight:
   inc (hl)
;update map/screen

This isn't exactly what I explained above, and isn't very complex. For example, once your player has reached the edge of the tilemap, these routines won't let them touch the edge, just see it, and it uses the map's coordinates instead of the player's, but the idea is there. For smoothscrolling, it gets a little more complicated but i think you can figure it out :)

I hope I haven't confused you!


Last edited by Guest on 23 Aug 2008 09:33:12 am; edited 1 time in total
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 23 Aug 2008 11:15:15 am    Post subject:

Very Happy Wow, that were some amazing statements from Maarten! Smile That really helps alot Razz I take back my statement about the timeline then -- great pieces of work/art don't have limits, do they? I'm sure Mozart didn't give himself a due date :P

and asdf, thank you for the piece of code! It helps alot. Smile And I feel dumb for some of my previous statements... Let me get things out, the right way :blush:

Since it would look terrible if I simply had the character stop at the very side of the screen for no apparent reason, I'm going to go about with this, the most easily understood by me Smile What I'm going to do, so that I avoid having the routine constantly return and check the tilemap for the location directly ahead of the player, I'm going to have it check only the very top corners of the tilemap.

This is a terrible explanation, so let me try drawing a terrible picture Smile


Last edited by Guest on 23 Aug 2008 11:18:05 am; edited 1 time in total
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 23 Aug 2008 01:02:36 pm    Post subject:

I don't think you even need edge restrictions.

Last edited by Guest on 23 Aug 2008 01:03:10 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 23 Aug 2008 02:56:16 pm    Post subject:

The boulder idea is a good one for other than programming reasons. If there's an arbitrary border the player can't walk past, the player will still want to try. Boulders (or trees, or a wall, or anything appropriate to the location) are an easily visible sign of "map ends here".
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 23 Aug 2008 10:38:14 pm    Post subject:

yeah, that's what I was how I was kinda planning to end the map. Unlike in this terrible picture that I made on MS Paint Razz I don't want the map to scroll after a certain point... yes -- obviously :)

The purpose of the corner "flags" were just to tell the engine not to scroll anymore. That was a dumb idea though, for obvious reasons. I don't really like having the edges all trees though, it looks kinda funny to me :/
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 23 Aug 2008 10:56:01 pm    Post subject:

For the stop scrolling thing, you won't need to do anymore work then drawing your character like usual...

When you move left, lets say you would normally decrement the x cor of your character and the maps to scroll the whole map right?

But when the map hits a certain xcoordinate, stop scrolling the map but continue decrementing the objects xcor...

Dunno what you know about it, but the characters location on the LCD is completely relative to the lcd like:
*pic*


Last edited by Guest on 23 Aug 2008 10:57:17 pm; edited 1 time in total
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 24 Aug 2008 12:36:18 am    Post subject:

Um, I'm not sure if you were able to read the previous posts or not :/ I decided that I'm going to save myself the giant hastle, and not use x or y coordinates. Just the offset from the center once an "edge" tile is detected a certain amount of spaces ahead Smile Silly kids Razz -- wait.... I am one :P

Silly rabbits (wow, I'm slap-happy to be going back to school soon Very Happy)

But cjgone, I do understand what you'd meant. Once the "stopper" is detected, just advance the sprite, but don't initiate the tile-mapper routine that shifts the map. Smile


Last edited by Guest on 24 Aug 2008 12:39:51 am; edited 1 time in total
Back to top
Liazon
title goes here


Bandwidth Hog


Joined: 01 Nov 2005
Posts: 2007

Posted: 24 Aug 2008 08:55:36 am    Post subject:

aren't you going to need x,y coordinates (or a tilemap offset) to do hitdetection?
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 24 Aug 2008 12:36:11 pm    Post subject:

Er, x and y is defintely the easiest method.

Only other good way is to do something like

Code:
Left_x:
.db 0  ; tile number
Left_x_offset:
.db 0;0-7
Right_x:
.db 11
Right_x_offset
.db 7; 0-7
;etc


Last edited by Guest on 24 Aug 2008 12:36:35 pm; edited 1 time in total
Back to top
asdf


Advanced Newbie


Joined: 17 Aug 2008
Posts: 73

Posted: 24 Aug 2008 06:13:32 pm    Post subject:

Also, your idea about the four corners won't work if your tilemap is too large. Check the attached picture (if it worked). If none of those bytes are on screen, you'll be wasting a lot of space searching for it! I think using map dimensions are certainly easier, but don't think that there is a right or wrong way! Maybe you'll find some implementation that works better for you, i've just found that for a general tilemap this is the easiest route to go Smile
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 24 Aug 2008 07:47:50 pm    Post subject:

yeah, like I thought, the corner idea wouldn't really be effective, or worth the time. So like I figured I'd end up doing, I'm just going to have "border" tiles. That should do the job :)

As for hit detection, and events, I'm going to implement it into the sprite placing routine. I'm just going to have it check the tiles that the sprite is going to be under, then act on that. I'm going to use the scan-under method to place the sprite, I'm going to have the routine first check to see if it's even a tile that the user can go on. And if it can, to see how much room it has left on that tile to move before you hit, say, a wall of a store. (Since the roof is there, I want to implement some type of pixel-test in addition to the tile-testing routine. :)

Also, the reason why I'm not designating the tilemap dimensions, is because once all my Soldier games are finished, I'd like to release some type of easy smooth-scrolling routine that would be interchangeable with tilemaps; meaning the user would not have to change anything except for the tiles and the tilemap Smile


Last edited by Guest on 24 Aug 2008 07:49:55 pm; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2, 3, 4, 5, 6  Next
» View previous topic :: View next topic  
Page 3 of 6 » All times are UTC - 5 Hours

 

Advertisement