Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  buildings like in ultima 7  (Read 7040 times)
0 Members and 1 Guest are viewing this topic.
Offline DavidBoBavid

Senior Newbie





« Reply #30 - Posted 2006-07-12 17:40:55 »

Hmm..interesting.

do you have any sprites that are larger than one tile, though? i'm wondering how you handle the player bring infront of the back wall of a room (for example) when the room walls are drawn the layer above the player.. if the player sprite is say one tile wide and 2 tiles tall.. i'm trying to do something (graphically) like chrono trigger, instead of doing it like final fantasy 3 (not that i'm implying one is bad or anything).

the way i started thinking about it, is that the current layer would be composed of tiles, and each tile would have the base grownd texture, and whatever other additional things that the player could still walk on (like a sprig of grass, or a flower), and then the tile would have a list of object, orderd by increasing x-coordinate. so that stuff will appear infront of the players feet, for example.  so then my player movement consists of small shifts on a given tile, or moving him between tiles. all the collision checking is based on what is on the tiles around him only. if he goes up a level, then it will be the same situation.

i think i understand how your method is working though (and it giving something more ff3-style), and i was thinking of doing something similar to that until i started worrying about things partially overlapping each other (ct-style).  if i'm thinking of how yours is supposed to work completely wrong, please correct me. Smiley
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #31 - Posted 2006-07-12 18:00:28 »

Well the key is the invisible walls. Essentially, everything you see you can't actually interact with. The real physical walls are not drawn and are only used for moving logic. That way I can in fact make humungous gigantic pictures with only one single block that you can't walk through. Imagine this:

Say we have the sprite for a big house. It might look like this, with ^'s being the roof (foreground), @@ being the middle (midground), and ++ being the part you can walk on top of "in front of" (background).
1  
2  
3  
4  
^^^^^
@@@
@@@
+++++

That actual sprite,  although drawn with different characters, is two sprites placed in the top left corner, one in the foreground drawn above the player and one in the background, like this:
1  
2  
3  
4  
+0000
+0000
00000
00000

Where the + is the single block where the sprite is saved in the 3D array, but can be seen across the whole thing. The +0000 is just the roof saved in some layer higher than the player so it is drawn on top of him, then the rest is drawn in a layer under the player.

Now with just that, I would have a large image taking up several blocks you could just walk all over. What now becomes neccesary is to include spaces in the midground so, logically speaking, part of the house obstructs walking. an O is an empty space, and a + is where a wall is placed in the moddle layer. Note these walls are invisible.
1  
2  
3  
4  
OOOOO
+++++
+++++
OOOOO

The character can walk anywhere where there are O's, so if you want on the top you would be unobstructed but a roof would still be drawn on top of you, while the bottom O's can be walked upon even though you are walking on top of a sprite. Try walking through the entire house, however, and you will be stopped by invisible blocks.

In this way, although the collision is in fact entirely grid based like FF3, it appears as if you are interacting with a 3D house – a house which is one sprite (in fact I allow for the stretching/shrinking of any sprite to any size). Chrono Trigger probably did something on this level, so even though you may believe that FF3 and CT drawing methods are so different, they in fact probably use the same walking engine – CT just has a few layers slapped on to create the pretty (but fake) 3D effect.

See my work:
OTC Software
Offline DavidBoBavid

Senior Newbie





« Reply #32 - Posted 2006-07-12 18:29:49 »

ohhh.. very interesting! i understand what you're doing now. (after spelling it out for me..lol). your example makes alot of sense.

so if i understand this correctly, when i'm inside of a building, then the front wall would be the layer on top of the player, and the rest would be behind him. i think that would still give the effect i want.  but what about buildings with walls or rooms inside?

something like:
1  
2  
3  
4  
5  
_________
|         |
|___      |
|         |
|___   __ |


that's how the layout would look from a straight top-down view, but the walls would be drawn so they look like they're on an angle. so in my little house there's a wall on the inside making 2 rooms.  when i'm in the front room, i'd be drawn infront of it, but if i go into the back room, that wall would need to be drawn on top of me. if i put that middle wall on the top layer, it'll still be drawn on top of me, even if i'm infront of it. :-S


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #33 - Posted 2006-09-14 19:04:19 »

Ah, that's an issue that I never had to worry about because for multiple rooms I simply created multiple level files (half second level loading made that okay).

I'd imagine if you wanted it to work that way then you could have the player's position "vertically" (in the array) to be dynamic rather than always in the center. Therefore they could move up or down within the array of objects, changing what appears over and under them. The only problem with this is that your collidable pieces (rather than ones that are just drawn and you can't touch) might move out of sync you may end up colliding with your simple drawn objects. Perhaps a good solution for this would be to maybe reserve 3 to 5 layers for collidable objects, then ones outside of that would be the background pictures. This way you could actually have multiple floors worth of collision, and you could have multiple floors of drawn parts.

Either way it really comes down to your array management. I think probably the best solution for you (if you are continuing to do it my way) would be to create two totally separate 2D arrays – one for invisible touchable objects, and one for their drawn representations. Scroll them both simultaneously (make sure to have graphics refresh after both have drawn, not in between) and have the same interaction/drawing level for (say you are interacting with layer 3, draw layers 0-2 under the player and 4-5 on top) both, creating your pseudo-3D look and allowing for walls that are drawn over the player in multi-room houses.

See my work:
OTC Software
Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!