Shameless amateur asks about tile-based movement
Displaying 1-11 of 11 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Varius

Before I begin, forgive me if I don't use the proper terms for everything, as I'm still learning this stuff. Anyway.

After a few years of noncommittal lurking, I've finally decided to start work on my own game. My eventual goal is to recreate the look and feel of the SNES installments of Final Fantasy, especially FFIV and FFV, complete with 16x16 sprites and tile-based movement.

The .chr files were easy to make, and playerstep=16; has been a godsend as far as tile-based movement is concerned, but I run into a problem whenever my character bumps into a wandering NPC. Specifically, if I collide with that NPC halfway through its step, I end up standing on the border between 2 tiles. After that, my character remains off-center until I collide with a stationary obstruction, which lines him back up.

I tried searching the site for an answer, but couldn't find this specific problem addressed. Is there a quick fix that I'm overlooking? Barring that, does someone have a complicated fix they could teach me?

Posted on 2007-10-01 14:32:17

Arkhan

playerstep? ! Where is that at?!

sorry I cant help you, but im curious where you got that playerstep at to use for tile moving...

Posted on 2007-10-02 13:45:56

IkimashoZ

Now, I've never worked with maps before, so I'm afraid I can't offer any specific chunks of code, but let me offer some ideas that might help you out:

1) The program checks on each iteration of the game loop to see if the player is stopped at a position other than one he should be at. I assume that this would be any position that is a multiple of 16. So, if the character isn't moving and he's on, say, 12, write a function to nudge him back to 16 automatically.

2) Do you have a way to detect collision of player and npc? If so, you could reset the position of the player on a collision.

3) Find a way to recognize if an NPC hasn't completely moved out of a tile yet and don't let the player move to that tile.

I'm looking forward to seeing a demo. Gambatte!

Posted on 2007-10-02 18:40:33

Varius

Arkhan:

It's a r/w variable that was added in... umm, one of those builds, way back when. I discovered it by searching for "tile-based movement" and finding this thread.

The downside is that it's not true tile-based movement, meaning your character can get hung up on moving (or irregularly shaped) obstructions.

There's also a Tile Movement Engine by Omni in the downloads section, but it's proven difficult to tack onto my existing code. I'll chalk that up to the fact that I have no idea what I'm doing.

Posted on 2007-10-02 18:44:55 (last edited on 2007-10-02 18:45:56)

Arkhan

Quote:Originally posted by Varius

Arkhan:

I'll chalk that up to the fact that I have no idea what I'm doing.


Hey, join the club! :)

i just gave up on tile based movement altogether.

It suits the game anyways since its inspired by Lunar, Vay, Cosmic Fantasy................ all those CD based RPGs from back in the day!



I kind of like the lack of tile movement for some reason now that Ive got it going.

Posted on 2007-10-03 15:19:18

zonker6666

Quick and dirty fix ==

PlayerTX = ((PlayerPXX+xwin)/16)*16;
PlayerTY = ((PlayerPXY+ywin)/16)*16;

this would give you the Tile X and Y

and the screen X and Y would be (PlayerTX*16)-xwin
and (PlayerTY*16)-ywin


Hope that helps ---
;)

Posted on 2007-10-05 20:00:20

Omni

I also recommend you don't use my demo. I just now tried it under Vista -- got a new laptop, haven't run anything under Verge on it yet -- and it runs hideously; something's wrong with the timing.

I suspected that before, due to posts from other testers, but I couldn't solve the problem; it worked fine on my XP laptop. But now I know something's definitely wrong.

I haven't looked at it in a long time, and the implementation had other shortcomings (unable to use V3's zones natively). Maybe I would be able to fix it now, but I don't have the time. Sorry for the letdown, hope you get a solution running though. :)

Posted on 2007-11-11 14:05:27

Sargana

Greets (new).

I was wondering about this too, I want to make this function in my beginner's project but in the release I have it either doesn't exist, or I'm an idiot and can't figure out where/how to define playerstep at a value of 16.

I tried to look into the SVN to see if there was something I was just missing, but I cannot access it without a UN and password and the one I have here doesn't seem to do it.

I'd like to play with tile movement as well, since my ultimate goal is create a somewhat Shining Force style engine and I don't like the free movement in the basic system. Can anybody give me a hand on how to make this work?

Posted on 2007-11-14 08:05:29

mcgrue

The SVN's user/pass is anonymous/anonymous for read access.

As for the playerstep issue, the answer is "anywhere in the vc".

If you want your whole game to be playerstepped to 16, you can just put it once in your system.vc's autoexec function like so:


void AutoExec()
{
playerstep = 16;
}


There are some big caveats with using playerstep, though. If you want predictable behavior, you should only only only use the standard obstructions (ie, a solid brick and the two diagonal slashes). If you make any half-tile/quartertile/etc fancy obstructions, your characters will get set "off the grid" when they walk into them. This doesn't "break" verge any, but it does break your game's aesthetic.

This would be a good subject for me to make a tutorial on. Time, time, my kingdom for some time.

Posted on 2007-11-14 08:19:00

Sargana

Okay that's what I tried (literally exactly that) and nothing seemed to happen so I must need something.

It's a bit odd since I would've expected the compiler to explode without a definition for playerstep.

I don't mind about the obstructions since I'd like to craft a square tile-based game where there aren't going to be any "ninja" obstacles and everything will be square.

But that's kind of a one step at a time thing. I have to build things up into what one might actually consider a "growing game engine" since right now its just the tutorial version with crap tacked on. I wanted to at least get tile movement in early so I could make everything else with that in mind, but just building my menu UI will take a while. I'm still getting the hang of displaying things.

Edit: I looked at the SVN and it looks like soup to me. What do I need to do to update and get the necessary files?

Edit2: Nevermind, playerstep works now (odd it didn't earlier)

Posted on 2007-11-14 09:03:49 (last edited on 2007-11-14 09:12:32)

mcgrue

playerstep defaults to 1. Remember: as a system variable you aren't declaring it, you're just changing it.

At 16 it's not really noticeable. You have to look for it.

To experiment, turn it to 32 or 48 or somesuch, recompile, run, and tap one of the directional keys. :)

As for menu code, if you're a beginner, you might want to hijack the Sully Chronicles menu code and alter the insides for your own devious purposes. No need to reinvent the wheel, and you can always change the whole thing later. ;)

Posted on 2007-11-14 11:57:42


Displaying 1-11 of 11 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.