dougmencken / HeadOverHeels

The free and open source remake of the game “Head over Heels”
GNU General Public License v3.0
31 stars 9 forks source link

The “enumeration of directed activities” model can’t describe complex movements with enough flexibility #64

Open hendrikbez opened 7 months ago

hendrikbez commented 7 months ago

Screenshot_2 When I am on the wall, and start moving the items, it goes down before it reach the conveyer belt

dougmencken commented 7 months ago

the room is blacktooth19.xml by the way

dougmencken commented 7 months ago

by the way, can you @hendrikbez pass blacktooth18.xml without cheats? it looks like the diver robot there doesn't carry the thing above it (which is roughly related to #66 )

blacktooth18

dougmencken commented 7 months ago

the following patch fixes the diver robot ... and the game mechanics at all

--- a/source/activities/Moving.cpp
+++ b/source/activities/Moving.cpp
@@ -154,12 +154,17 @@ bool Moving::move( behaviors::Behavior* behavior, Activity* activity, bool itFal
         // if the item can move freely
         if ( item->whichItemClass() == "free item" || item->whichItemClass() == "avatar item" )
         {
-                if ( /* not moving up or down, to not change the activity of items on elevator */
-                        ( *activity != activities::Activity::GoingUp && *activity != activities::Activity::GoingDown )
-                                || /* there’s a collision */ ! moved )
+                bool onElevator = ( *activity == activities::Activity::GoingUp || *activity == activities::Activity::GoingDown );
+                if ( /* don’t affect activity of items on elevator */ ! onElevator )
                 {
-                        // move adjacent items
-                        PropagateActivity::toAdjacentItems( *item, toItemsNearby );
+                        if ( /* there’s a collision */ ! moved ) {
+                                // move adjacent items
+                                PropagateActivity::toAdjacentItems( *item, toItemsNearby );
+                        }
+                        else {
+                                // maybe there’s something above
+                                PropagateActivity::toItemsAbove( *item, toItemsNearby );
+                        }
                 }
         }

image

but... not including the problem mentioned in the original post 😥

hendrikbez commented 7 months ago

Thank You

Hendrik

dougmencken commented 5 months ago

it really is quite unphysical, and I'm unsure how to solve it....

pushing an item onto a conveyor

maybe make a conveyor drag things only when it takes at least a quarter (a third??) of the conveyor's width?..

dougmencken commented 5 months ago

... and if you wish to play within a room from the previous message, here's the patch

add-some-stuff-to-the-heels-initial-room.patch.zip

--- a/gamedata/map/blacktooth23heels.xml
+++ b/gamedata/map/blacktooth23heels.xml
@@ -62,6 +62,40 @@
         </wall>
     </walls>
     <items>
+        <item x="5" y="3" z="0">
+            <kind>brick1</kind>
+            <class>griditem</class>
+        </item>
+        <item x="5" y="4" z="0">
+            <kind>brick1</kind>
+            <class>griditem</class>
+        </item>
+        <item x="6" y="3" z="0">
+            <kind>brick1</kind>
+            <class>griditem</class>
+        </item>
+        <item x="6" y="4" z="0">
+            <kind>brick1</kind>
+            <class>griditem</class>
+        </item>
+        <item x="7" y="3" z="0">
+            <kind>brick1</kind>
+            <class>griditem</class>
+        </item>
+        <item x="7" y="4" z="0">
+            <kind>brick1</kind>
+            <class>griditem</class>
+        </item>
+        <item x="7" y="3" z="1">
+            <kind>stool</kind>
+            <behavior>behavior of thing able to move by pushing</behavior>
+            <class>freeitem</class>
+        </item>
+        <item x="7" y="4" z="1">
+            <kind>stool</kind>
+            <behavior>behavior of thing able to move by pushing</behavior>
+            <class>freeitem</class>
+        </item>
         <item x="8" y="0" z="0">
             <kind>vulcano</kind>
             <orientation>none</orientation>
dougmencken commented 5 months ago

maybe make a conveyor drag things only when it takes at least a quarter (a third??) of the conveyor's width?..

I really thought about the complete redesign of all these activities and movements. So that it’s not “activity of moving southwest” but a velocity vector, which can be summed (or even premultiplied and summed) with another such vector, giving a complex motion.