-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gish dies at the first level if he is not instructed to move #7
Comments
Gish dies when you hit the wall slowly. Here is a helpful patch that makes this game playable. diff --git a/game/objfunc.c b/game/objfunc.c
index 5192f63..6fb5adc 100644
--- a/game/objfunc.c
+++ b/game/objfunc.c
@@ -416,7 +416,7 @@ void objectcycle(void)
}
/* Gish death by deformation (TODO: rename count4 etc.) */
- if (count4>=2)
+ if (count4>=4)
object[count].hitpoints-=(count4-1)*50;
if (object[count].numoforientations==0) This makes the game actually fun: diff --git a/game/objfunc.c b/game/objfunc.c
index 5192f63..cc9a0d8 100644
--- a/game/objfunc.c
+++ b/game/objfunc.c
@@ -416,8 +416,8 @@ void objectcycle(void)
}
/* Gish death by deformation (TODO: rename count4 etc.) */
- if (count4>=2)
- object[count].hitpoints-=(count4-1)*50;
+ if (count4>=4)
+ object[count].hitpoints-=(count4-1)*5;
if (object[count].numoforientations==0)
copyvector(object[count].orientation[1],yaxis); |
A vague attempt at better deformation logic. diff --git a/game/objfunc.c b/game/objfunc.c
index 5192f63..f7bd29b 100644
--- a/game/objfunc.c
+++ b/game/objfunc.c
@@ -37,10 +37,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../math/vector.h"
#include "../physics/bond.h"
#include "../physics/particle.h"
-
void objectcycle(void)
{
- int count,count2,count3,count4;
+ int count,count2,count3;
+ float deformation;
int x,y;
float vec[3],vec2[3];
float veclength/*,bondlength*/;
@@ -117,7 +117,7 @@ void objectcycle(void)
for (count2=0;count2<object[count].numofparticles;count2++)
addvectors(object[count].velocity,object[count].velocity,particle[object[count].particle[count2]].velocity);
scalevector(object[count].velocity,object[count].velocity,1.0f/(float)object[count].numofparticles);
-
+
zerovector(object[count].position);
for (count2=0;count2<object[count].numofparticles;count2++)
addvectors(object[count].position,object[count].position,particle[object[count].particle[count2]].position);
@@ -402,23 +402,38 @@ void objectcycle(void)
}
}
- count4=0;
+ deformation=0;
+ /* Hooke's law: the force on a spring F = k * X where X is the
+ distance it's being stretched or compressed, and k is an arbitrary
+ constant depending on what Gish is made out of.
+
+ integrate force over distance to get energy (aka damage)
+
+ so damage = k * X * X / 2
+ */
+ // these constants determined by science
+#define NORMALVECLENGTH object[count].radius
+#define SEVERITY 0.36
+#define THRESHOLD 8
for (count2=0;count2<16;count2++)
for (count3=0;count3<16;count3++)
if (abs(count2-count3)>6)
{
subtractvectors(vec,particle[object[count].particle[count3]].position,particle[object[count].particle[count2]].position);
veclength=vectorlength(vec);
- if (veclength<0.15f)
- count4++;
+ deformation += (veclength-NORMALVECLENGTH) *
+ (veclength-NORMALVECLENGTH) *
+ SEVERITY / 2;
//if (veclength<0.15f)
// object[count].hitpoints-=(0.2f-veclength)*500.0f;
}
- /* Gish death by deformation (TODO: rename count4 etc.) */
- if (count4>=2)
- object[count].hitpoints-=(count4-1)*50;
-
+ /* Gish death by deformation */
+ if(deformation > THRESHOLD)
+ object[count].hitpoints-=(deformation-1);
+#undef THRESHOLD
+#undef MINLENGTH
+#undef SEVERITY
if (object[count].numoforientations==0)
copyvector(object[count].orientation[1],yaxis);
else It doesn't look like there can be any real solution here, until the bug where the Gish's boundary passes through itself is solved. When that happens, there's a crossover between two vectors, which makes a pinch point that should represent infinite energy (and infinite damage). There's also problems where clinging with one point will make a sharp corner, bringing the neighboring two points close together, and squeezing the Gish. Should be stopped from stretching that way by user input alone. |
Gish dies when he falls at the first level, just as he would die when smashed between blocks.
System: Ubuntu 15.04 64bit.
The text was updated successfully, but these errors were encountered: