V3: Entity Movement
Displaying 1-3 of 3 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Lugumees

The Goal : To be able to have moving entities (running a move code) react to obstructions the same way the player does (when using arrow keys to move). I.e. If you move straight and hit a diagonal obstruction, you start moving diagonally. If you move diagonally and hit a straight obstruction, you start moving straight.


The first challenge to this goal is that move codes don't really allow diagonal motion. As far as I can tell, the best you can do is set your move code to "pixel perfect" and step along the approximate slope you want (e.g. movecode="p 1r 1d b" for down-right diagonal, etc).

The second challenge is, as far as I've been able to ascertain from the docs and experimentation, you can make an entity respond to obstructions by setting:
entity.obstructable[id] = 1

But this does not help us accomplish The Goal because when you hit an obstruction, your movecode stalls out, since it can't go where you're telling it to go.


I can think of several long, painful, and hackish ways to manually move an entity along an arbitrary slope and have it react to obstruction pixels. Checking pixel obstructions, moving one pixel at a time, and hacking the rendering code... or something similar with timed movecode updates so an obstructed move can fail and move on to the next step... that sort of thing.

It seems like a lot of work to do something that is built into the Player's movement processing already.

Is there currently any way to access the Player obstruction handling for movecodes? Or can anyone think of a less hackish way to reach The Goal?

My original thought was to go and look at the Player and movecode code in the V3 engine, and maybe do a little copy-pasting or add a new letter to movecodes to turn on Player-style obstruction handling, but it took all of 30 seconds to find the words "closed source" in the docs, so that's not a likely option. Plus I'm sure Vecna and co have thought of similar things before and probably have a good reason that option doesn't exist (right?).


And for those of you who just have to know why I want to make this work, my combat system includes knockback on a map with obstructions. Like I said, I can hack up something ugly to make it work... just fishing for a better solution.

Posted on 2009-11-11 18:37:20

Overkill

Quote:Originally posted by Lugumees


My original thought was to go and look at the Player and movecode code in the V3 engine, and maybe do a little copy-pasting or add a new letter to movecodes to turn on Player-style obstruction handling, but it took all of 30 seconds to find the words "closed source" in the docs, so that's not a likely option. Plus I'm sure Vecna and co have thought of similar things before and probably have a good reason that option doesn't exist (right?).
Verge is released under a BSD license. This means non-restrictive open source. Can you tell me where you found spot in the docs that said it was closed source?

For diagonal movement, try "URx", "DRx", "ULx", "DLx" commands. This should be enough, hopefully. Otherwise, do you need entities that can move off of the player path? If not, you can you use EntityStalk.

Is this a realtime battle system that has multiple entities taking a turn at the same time? If not, you can use SetPlayer to switch control temporarily.

EDIT: Oh wow. That FAQ was full of out-of-date answers to questions! I apologize for that. In fact, the documentation was listing stuff from 2004 in there! Boy, that's old! Anyways, no, Verge is open-source. If you want the code, checkout the SVN repo (u/p anonymous/anonymous): http://www.verge-rpg.com/svn/verge3/

Posted on 2009-11-13 09:01:54 (last edited on 2009-11-13 09:15:46)

Lugumees

I'll be poking around in the code for fun one way or another then. ;) Thanks for the repo link.

It's a delay-based system, similar to the FF Tactics series of games, though limited to 2d.

As for setting different entities to the "player," doesn't that override any move code and disallow the use of movecodes until you aren't the "player" anymore? If that's the case, then I'd need to find a way to simulate key presses so I could feed the data in. Would altering the button/key array trigger the player movement code or not?

Posted on 2009-11-18 23:11:28


Displaying 1-3 of 3 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.