How to make the game tile based.
Displaying 1-20 of 26 total.
12 next
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Wolf

Although all the events, zones and nonplayer entities are set on tile coordinates. (movescript is tilebased too), the player entity can stop walking anywhere between two tiles.

Suppose I want to make an area of the game so that the player's hotspot butt can only stop exactly on tiles? Like in FF4,FF5,FF6,Lufia2 etc.

I tried the following:
Hookkey(some key,"moveright");

void moveright()
{
Playermove("r1");
unpress(some key);
}
and similar stuff for left, up and down.
But Hookkey doesn't work with the 'up','down' etc, variables and even if it did, it doesn't really give me what I want.

Eehmm ..... help..please?

Posted on 2004-09-01 11:53:23 (last edited on 2004-09-01 11:53:52)

Zip

Ehehe... We want tile based movement as an option. Bug vecna. Lots. As a moar practical answer, I belive Gayo mentioned he had an ugly work aound of some description.

Zip

Posted on 2004-09-01 14:09:31

blues_zodiakos

I would really, really like an easy solution to this as well. I remember asking about it when pixel-based movement was first announced, and then I forgot about it. Doh.

Posted on 2004-09-01 14:17:49

blues_zodiakos

Hey, how about this:

Don't use SetPlayer. Instead, set the cameratracking variable to 2 and set it to track the entity that you want the player to control.

Then, have a hook of some sort control the input for that character. Might not be too difficult.

Posted on 2004-09-01 14:19:45

Wolf

Ok, I`m gonna try that, thanks.

I hope enough people will bug vecna about this :)
Anyway, how tough can it be to implement? (but what do I know?) Wasn't V1 tile based?

Posted on 2004-09-01 15:14:58

mcgrue

The better part of a decade of experience speaking here: "Bugging vecna" isn't strictly the best way to get new features ;)

v1 and v2 were both tile-based, yes.

Posted on 2004-09-01 15:29:21

Zip

Blue Z's suggestion will either hang verge when you move into obsructions, or walk straight through them, depending on the entity.obstruct and entity.obstructable for the entity. Son in adition to that, you'll need to add your own collision detection for map and entities. The Hotspot doc might help here, but I have full code for it somewhere too. Not too hard, use if (GetObs()) don't move. Bug me for more. I respond to bugging.

Zip

[Edit: ehehe, who forgot to close their <a> As a physic side note, I predict Omni's next post will be talking pants. However he will afterwards redeem himself, and prove me to be a fool]

Posted on 2004-09-01 15:44:04 (last edited on 2004-09-01 17:53:27)

Omni

You don't quite have to rewrite the obstruction system. If you're going to do tile-based movement, you'll just have to use entire tile obstructions anyway, which will do the job. ...Not like there's another way to do obstructions in a tile system besides full-tile obstructions.

There might be a way to do a simple HookRetrace script that would check up, down, left, and right, then set the destination pixel coordinates (16 up, 16 left, 16 right, 16 down, etc.), and would move the entity pixel accurately that number of pixels. After the destination position (one tile later) is reached, it checks to see if up/down/left/right are being pressed again.

Posted on 2004-09-01 16:08:57

Omni

Okay, I've just written a library that will do this...

Unfortunately, there are two problems.

1) EntityMove will not loop an Entity's animation when called consecutively--thus the animation is disjointed.
2) For some reason, the entity.obstruct flag in my Verge build always returns 0, so there's no way to tell if an entity is obstructable or not in the engine... SOLUTION: all entities are currently assumed to be obstructing. EDIT: The reason it is zero is because I don't think Maped3 is saving the value......so I assign it myself.

So, it works fine, collision and movement wise, but the animation is kinda screwed up. It loops through the entity's frames for a single tile and starts over.

Posted on 2004-09-01 16:58:49 (last edited on 2004-09-01 17:19:34)

Omni

And if you like, I've got a very simple demo for you.

Omni Tile Movement Demo

Posted on 2004-09-01 17:24:13 (last edited on 2004-09-01 17:28:47)

Zip

I didn't predict that he would so spectacularly redeem himself though. Maybe I should go back and do so...
Looks good, though I might point out you've basically done exactly what I said, bar the fact you didn't confuse GetObs() with GetTile like I did. :P
if (GetObs(tx, ty) > 0)	return 1;

Suggestions for fixes to current problems:
2) Yeah, it's just that you need to set runtime.
1) Rather than the current 'is movescript done' check, do a 'is movescript ABOUT to be done (with tile based you could do this by checking the entity.hot(x/y)[] % 16 value), and then get the current render string and add one to the number.

Zip

Posted on 2004-09-01 17:51:23

Omni

Rightio. I'll look at that in a little bit. Packing for college is on the todo list today, and my copy of Virtual Tennis for Sega Saturn just arrived.

I did have a...sort-of remedy for the animation skipping. Check to see if the button is held down (if it's just a quick press, obviously they only want to travel one tile anyway), and if it is, move the entity two tiles, allowing enough time for the full animation to be shown.

Granted, it would still glitch, but not as often, and the animation would be slightly cleaner.

EDIT: This, on second thought, is obviously not worth using--Darin's walking animation is approx. 6 tiles long to use anyway.



One question. Why do I need to get the current render layer and add a 1 to it?

Posted on 2004-09-01 19:27:35 (last edited on 2004-09-01 19:37:03)

Zip

Another good example of me meaning one thing and saying the other. Add one to the MOVEstring value, so:
int ent = your_entity_number;

string direction = left(entity.script[ent]);
int distance = val(GetToken(entity.script[ent], "udlr", 0));
EntityStop(ent); // Possibly... possibly not
// We want to override the current string
EntityMove(ent, direction + str(1+distance));

Make sense? (as always, I have not tested this)

And people let me write the faq...

Zip

Posted on 2004-09-01 19:38:54

Omni

Wait, even better idea.

What if we automatically set the movement for, say, when up is pressed, "U100"?

Then, as the entity is moving, we check each tile to make sure A) the player has not pressed another direction, B) the player has not pressed any directions, or C) the player has become obstructed.

If either of those three is true, we call EntityStop.

Now, this means the animation will glitch after 100 tiles of walking in the same direction...but that's negligible.

Whatcha think?



I'm assuming that entity.script in your code is the entity's current move script...which means we could check and add new distance to the movescript just as it's about to finish! Right! That's a good idea too. Maybe better. Depends on which one I can more easily make.

Posted on 2004-09-01 19:49:52

Alex

I've been kind of banking on proper tile-based movement happening at some point... so I hope it does, or my game's going to be pretty nasty in certain places, like the scripted entities continuing to arse things up, like I mentioned in another thread, and difficult navigation through tightly packed obstructions. Although I also want to use pixel movement on the overworld map, so optional tile movement (for all entities rather than just the player) would be a most wonderful and welcome addition to V3.

Posted on 2004-09-01 19:59:01

Omni

All right, I've tried Zip's idea by extending the entity's internal move script...

Unfortunately, when I alter the .script variable...nothing happens. Did I miss something? I assign a simple "U1" to it and the entity goes nowhere.

I'm gonna try the other idea now, but why can't I get .script to work? Is it for another purpose?

EDIT: I just realized. Script isn't the entity's movecode. It's the name of the VC function it calls when activated.

EDIT2: Also, altering the entity's direction JUST AS the entity has about reached it's next tile results in the entiy being off by a few pixels that gradually screw up obstructions.

Posted on 2004-09-01 20:21:39 (last edited on 2004-09-01 20:26:22)

Zip

Your idea is better. Try it. (Need to schedual the stop right to be bang on with pixels though)

Zip

[Edit: What might help with with either versions is using pixel acurate movement "PM16" and adjusting based on the coord % 16]

Posted on 2004-09-01 20:52:08 (last edited on 2004-09-01 21:10:39)

Omni

Yeah, I have noticed a glitch or two with using UDLR-tile movement.

But according to the docs, Pixel movement in movestrings is still glitchy anyway, and I've made a small workaround for the tile problem that makes the pixels stay accurate.

Posted on 2004-09-01 21:24:04

Omni

Right, well, I've altered the library to use longer loopcodes that allow for more animation.

But for some reason completely unknown to me, sometimes the MoveCode will stop after going just a few tiles. I don't know why, but the entity will just cease to move, and entity.movecode goes back to zero.

So, I've made a few workarounds that let everything run smoothly, but the fact that movecodes are ending and restarting means that even though animation works almost flawlessly, there _will_ be occasional glitches.

The final problem is that currently you cannot interact with zones or entities. Since EntityMove doesn't take into account zones.

I'll add Zone and Entity detection soon. It really is a much simpler version of a pixel-system...it requires you to reprogram nearly everything. Good thing it's simpler.

And, also, by reprogramming everything in pixel coordinates instead of tiles like Zip said, I might eliminate a skipping glitch or two in EntityMove. Unfortunately...all the detection runs on tile coordinates, and I'm not sure I feel like redoing it all now.

Zone Adjacent activation is probably out, though, because the engine can't tell me in VC whether a zone is adjacently activated or not. It can't even tell me the chance...

Posted on 2004-09-01 21:34:37 (last edited on 2004-09-01 21:51:35)

Omni

Tile Movement Demo 1.9.

Better animation, entity and zone support. Zone chances and script names must be entered manually, example:

tilemove_zonename[5] = "MyZoneFunction";
tilemove_zonechance[5] = 255;

See Readme.txt. Some minor but non-gameplay-destructive glitches.

You can still get the older version from the link way above...I might remodify that one if I ever want to try a different approach to animation. Doubt I'll work on this for a while unless I see something that really needs fixing.

Posted on 2004-09-01 22:40:00 (last edited on 2004-09-01 22:41:58)


Displaying 1-20 of 26 total.
12 next
 
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.