moving platforms

User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

moving platforms

Postby b_o » Sun Aug 24, 2014 3:35 pm

User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: moving platforms

Postby Andrettin » Sun Aug 24, 2014 5:31 pm

This idea sounds interesting. The raft in that game seems a bit too big to me (considering the size naval units usually have in Stratagus games, perhaps a 1x1 raft would be more appropriate), but it doesn't seem to be overly complicated to implement. The first step would probably be adding a way for a non-moving to be designated as passable for land units. Then the next step would be to allow it to move, and to make unit(s) on it change map positions accordingly.

What determines whether a tile is passable or not are the "MapField" flags which are assigned to it. Each MapField has a hexadecimal value though, and I'm not sure how many of these can be added. It seems to me that there are still many values which can be used. Examples of "MapField" are "MapFieldSeaUnit", which is assigned to the tile if there is a sea unit there, and "MapFieldWaterAllowed", which allows water units to move into the tile. In any case, after this "MapFieldRaft" is implemented, units would be able to step on the raft unit. When the raft moves, probably something along these lines would have to be done: 1. The "MapFieldRaft" flag is added to the tiles the raft is moving to, and the raft is moved to those tiles; 2. Move the units currently in the raft to the new raft tiles, as appropriate for their current position; 3. Remove the "MapFieldRaft" flag from the old tiles in which the raft was in.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: moving platforms

Postby b_o » Mon Aug 25, 2014 5:15 am

I would like to be able to get away from the usual size of naval units, and have larger ones. Not mere rafts, but large boats where only part of them would be boardable, a mid-section for example, so that the boat would have to face the shore sideways or a dock sideways to be boardable. I realize that is perhaps too complicated at the moment, but I was also thinking that even if those kinds of boats couldn't be made, if there were moving platforms, puzzle elements of games like Zelda could be implemented. I suppose a new animation code for platform movement could be added and used by all units of the same size, so that the unit movement is not animated, but then there is the issue of keeping the movement in the same formation during movement and rotation, which wouldn't seem to be a problem if the platform was only one tile. But it wouldn't account for the ability of the units in War Diary to attack while the platform is moving.
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: moving platforms

Postby Andrettin » Mon Aug 25, 2014 6:43 am

b_o wrote:I would like to be able to get away from the usual size of naval units, and have larger ones. Not mere rafts, but large boats where only part of them would be boardable, a mid-section for example, so that the boat would have to face the shore sideways or a dock sideways to be boardable. I realize that is perhaps too complicated at the moment, but I was also thinking that even if those kinds of boats couldn't be made, if there were moving platforms, puzzle elements of games like Zelda could be implemented.
Puzzle elements like that could be pretty nice. Having rafts would also allow island maps and the like to be played even without sea units, or allow attacks at a lower technological level (for instance, if workers could build a raft on the shore without a shipyard being necessary). If it is possible to get a 1x1 raft working, I think it is conceivable that ships functioning like you mentioned could be made possible code-wise. I personally prefer smaller boats, but I think it would be nice if the engine allowed what you want.
I suppose a new animation code for platform movement could be added and used by all units of the same size, so that the unit movement is not animated, but then there is the issue of keeping the movement in the same formation during movement and rotation, which wouldn't seem to be a problem if the platform was only one tile.
I don't think a new animation would be needed; the units wouldn't be "moving" in the traditional sense, I imagine they would be using their idle animation, while their position moves at the same rate as the raft. Maintaining the same formation would indeed be more complicated, but by how much it is difficult to tell before trying to get the raft to work in practice.
But it wouldn't account for the ability of the units in War Diary to attack while the platform is moving.
If the units were standing on the raft as if it were a tile, then they should be able to attack other units without issues. I imagine it would be best if rafts were only "movable" if a unit were on them (the raft's selection box could be 48x48 or something else slightly larger than 32x32, so that it is possible to select it without much difficulty when the unit is on top of it).

The ideas I'm saying here are nevertheless conjectural though, there might be some stumbling block which could make this feature harder to implement than I imagine.

Who is online

Users browsing this forum: No registered users and 1 guest