Pushabe blocks (Sokoban)

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Pushabe blocks (Sokoban)

Post by Cherno »

(Yes, there already is a thread about Sokoban Doom, but it's 9 years old and my requirements go a little bit further)

I would like to know if a Sokoban-like mechanic is possible in UMDF maps. It should behave like in Hired Guns (1993). Requirements are as follows:
  • The map consists of blocks like in Minecraft, only bigger (2*2*2 meters or 6*6*6 feet).
  • The map is three-dimensional, with blocks above blocks, not flat like in Sokoban
  • There are special pushable blocks. these can be pulled or pushed one block-length.
  • The pushable blocks can obviously not be pushed into wall blocks, nor can they be pulled back if an obstacle is behind the player.
  • If they are pushed over a hole in the ground or an edge ("cliff"), they will fall until hitting ground or another pushable block below them
So, the general architecture shouldn't be a problem with 3d sectors and polyobjects for the pushable blocks which have their four side sectorlines useable to call some script. What I don't know how to do is the actual pushing and pulling; I imagine there would have to be a 3-dimensional array that keeps track of all block/cell spaces in the map and if there is an obstacle at any given coordinate, and allow or disallow pushing and pulling based on that. Any input and ideas are welcome.
Last edited by Cherno on Thu Feb 01, 2018 9:32 am, edited 1 time in total.
User avatar
juizzysquirt
Posts: 126
Joined: Sun Jan 04, 2009 3:29 pm
Location: Knee-Deep in L.A. Meltdown

Re: Pushabe blocks (Sokoban)

Post by juizzysquirt »

Instead of polyobjects, how about generic things with correct physical dimensions, md3 models and +PUSHABLE flags? Don't know if they can be moved when stacked, and pulling them involves zscripting but it should be possible.

I actually had something similar already working as a proof of concept when I tried to replicate crate puzzle from early Resident Evil games in Doom. I could push them over ledges and over each other to create a bridge to get across the water obstacle. :P
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Pushabe blocks (Sokoban)

Post by Cherno »

Yeah, I thought about 3d models. It depends if they can be made to move into the right direction (likely by comparing the player's current rotation) and if they can be stood upon.
User avatar
juizzysquirt
Posts: 126
Joined: Sun Jan 04, 2009 3:29 pm
Location: Knee-Deep in L.A. Meltdown

Re: Pushabe blocks (Sokoban)

Post by juizzysquirt »

It's simple, define your custom block actor with correct height and width , set your actor flags, attach and adjust the scaling of model. You can push them around just like you would expect, getting player to pull them is going to be more involved. Unless you spesifically want the blocks to move and "snap" along grids?
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Pushabe blocks (Sokoban)

Post by Cherno »

Well yeah, since the map is based on an a 3-dimensional grid the pushable blocks should move set distances as well and "snap" to the coordinate spaces.
User avatar
juizzysquirt
Posts: 126
Joined: Sun Jan 04, 2009 3:29 pm
Location: Knee-Deep in L.A. Meltdown

Re: Pushabe blocks (Sokoban)

Post by juizzysquirt »

Then you might want to ditch +PUSHABLE, and let ACS handle the actual movement of blocks. I wouldn't use multidimensional arrays or such to keep track of the positions, it's easier to let the engine handle the physics involved whenever possible.
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Pushabe blocks (Sokoban)

Post by Cherno »

But how would moving a polyobject via ACS involve physics?
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Pushabe blocks (Sokoban)

Post by Cherno »

I dabbled a bit with ACS and got a basic push and pull block mechanic working. However, I realized that upwards and downwards movement is not possible with polyobjects, right? That would mean I'd have to go the 3d model route plus zScript, anyway.
User avatar
juizzysquirt
Posts: 126
Joined: Sun Jan 04, 2009 3:29 pm
Location: Knee-Deep in L.A. Meltdown

Re: Pushabe blocks (Sokoban)

Post by juizzysquirt »

Cherno wrote:But how would moving a polyobject via ACS involve physics?
Just saying you don't really need arrays or check if they can move since "actor blocks" can collide with each other and the actual map geometry already. IIRC there are many ways to alter thing's position in ACS, you could apply directional force(s) which attempts to move actor and let them interact with map boundaries, or instantly move position in x/y/z-axis regardless if there's something actually blocking it.

edit: Ah, I thought you meant actors instead polyobject, my bad. I've just returned home from night shift so basically I'm half-asleep already. :trippy:
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: Pushabe blocks (Sokoban)

Post by Cherno »

Well, I pretty much achieved all the goals with a 3d model that has the CANPASS attribute so it can land on other blocks. The only thing that is not possible is moving it a specific distance since I have to apply velocity but this is not a big problem if some care is being taken when designing the puzzles.
Post Reply

Return to “Mapping”