Old processing zombie game by Kevan Davis. Can you help me get it working?

Hello Forum,
One day I remembered an old zombie game I played I high school computer class. I found the source code for it. Turns out it was written for Processing 1.0.
Ive coded with java and python before, but not in processing or for making video games.
There is a function called look() that takes four arguments and that is not recognized. I think its all old Processing thing, but I cant find any information about it.

Can any of you help me?

here the script.


// Zombie Infection Simulation // Kevan Davis, 16/8/03 // Modified by John Gilbertson 25/09/03 // just making zombies more dangerous, edited level creation code, increased max zombies, made zombies less likely to group etc... 
int freeze;
int num=4000;
int speed=1;
int panic=5;
int human;
int panichuman;
int zombie;
int dead;
int wall;
int empty;
int clock=0;
int hit;
int ishuman=2;
int ispanichuman=4;
int iszombie=1;
int isdead=5;
Being[] beings;

void setup() {
  PFont f=loadFont("Impact-48.vlw");
  frameRate(45);
  textFont(f,19);
  int x,y;
  size(1200,800);
  human=color(200,0,200);
  panichuman=color(255,120,255);
  zombie=color(0,255,0);
  wall=color(50,50,60);
  empty=color(0,0,0);
  dead=color(128,30,30);
  hit=color(128,128,0);
  clock=0;
  // noBackground();
  fill(wall);
  rect(0,0,width,height);
  fill(wall);
  stroke(empty);
  for (int i=0; i<100; i++) {
    rect((int)random(width)-(width/8), (int)random(height)-(height/8),(int)random(width/4), (int)random(height/4));
  }
  fill(empty);
  stroke(empty);
  for (int i=0; i<45; i++) {
    rect((int)random(width-1)+1, (int)random(height-1)+1, (int)random(40)+10,(int)random(40)+10);
    x=(int)random(width-1)+1; y=(int)random(height-1)+1;
  }
  /* fill(wall); stroke(wall); rect(190,0,20,200); rect(0,90,400,20);*/ 
  fill(wall);
  noStroke();
  rect(0,height-30,width,height);
  fill(empty);
  stroke(wall);
  rect(0,height-30,width-2,height-2);
  beings = new Being[8000];
}



void keyPressed() {
  if(key == ' ') {
    key='z';
  } 
  if(key == '+' && num < 8000) {
    num += 100;
    key='z';
  } if(key == '-' && num > 4000) {
    num -= 100;
    key='z';
  }
  if(key == 'z' || key == 'Z') {
    freeze=1;
    setup();
  }
}



class Being {
  int xpos, ypos, dir;
  int type, active;
  int belief, maxBelief;
  int zombielife;
  int rest;
  
  Being() {
    dir = (int)random(4)+1;
    type = ishuman;
    active = 0;
    belief=500;
    maxBelief=500;
    zombielife=1300;
    rest=40;
  } 
  
  void die() {
    type=5;
  }
  
  void position() {
    for (int ok=0; ok<100; ok++) {
      xpos = (int)random(width-1)+1;
      ypos = (int)random(height-30)+1;
      if (get(xpos,ypos)==color(0,0,0)) {
        ok = 100;
      }
    }
  }
  
  void infect(int x, int y) {
    if (x==xpos && y==ypos) {
      type = 1;
    }
  }
  
  void infect() {
    type = 1;
    set(xpos, ypos, zombie);
  }
  
  void uninfect() {
    type = ishuman;
    active = 0;
    zombielife=1000;
    belief=500;
  }
  
  void move() {
    if(type==5){
      set(xpos,ypos,dead);
    } else {
      int r = (int)random(3);
      if ((type==ishuman && active>0) || r==1) {
        set(xpos, ypos, color(0,0,0));
        if(belief<=0) {
          active=0;
          maxBelief-=100;
          belief=0;
          rest=0;
        }
        if (look(xpos,ypos,dir,1)==0) {                 */LOOK DONT WORK*/
        if (dir==1) {
          ypos--;
        } else if (dir==2) {
          xpos++;
        } else if (dir==3) {
          ypos++;
        } else if (dir==4) {
          xpos--;
        }
      /* if(belief>0) { belief--; }*/
        } else {
        dir = (int)random(4)+1;
      } 
      if (type == 1) {
        set(xpos, ypos, zombie);
      } else if (active > 0) {
        set(xpos, ypos, panichuman);
      } else { 
        set(xpos, ypos, human);
      } if (active>0) {
        active--;
      }
    }
    int target = look(xpos,ypos,dir,10)    /*LOOK DONT WORK*/
    if (type==1) {
      zombielife--;
      if (target==2 || target==4) {
        active = 10;
      } else if (target==3) {
        if((int)random(8)==1) {
          if (dir==1) {
            set(xpos,ypos-1,empty);
          } else if (dir==2) {
            set(xpos+1,ypos,empty);
          } else if (dir==3) {
            set(xpos,ypos+1,empty);
          } else if (dir==4) {
            set(xpos-1,ypos,empty);
          }
        }
        if(0==iszombie) {
          dir=dir+1;
          if(dir>4) dir=1;
          }
        } else if (active==0 && target!=1) {
          if((int)random(6)>4) {
            if((int)random(2)==0) dir = dir+1;
            else dir = dir-1;
            if(dir==5) dir=1;
            if(dir==0) dir=4;
          } else {
            dir=dir;
          }
        }
        int victim = 0;
        if (victim == 2 || victim==4) {
          int ix = xpos;
          int iy = ypos;
          if (dir==1) {
            iy--;
          }
          if (dir==2) {
            ix++;
          }
          if (dir==3){
            iy++;
          }
          if (dir==4) {
            ix--;
          }
         /* for(int i=0; i=0;i++) {
            belief--;
          }*/
          if(belief==0 && maxBelief!=0 && rest>=40) {
            belief=maxBelief;
            rest=0;
          }else if(belief==0 && rest<40) {
            rest++;
          }
        } else if(target!=1 && target!=4 && active==0) {
          rest++;
        } else if (target==1) {
          dir = dir + 2;
          if (dir>4) {
            dir = dir - 4;
          }
        }
        if ((int)random(2)==1) {
          dir = (int)random(4)+1;
        }
      }
    }
  }
}
1 Like

Please, edit your comment, remove the code, copy the code from whereever you got it again, paste it again, select it and press the little button right above the comment text field that looks like </> to format it into code - as the forum makes things fancier by using characters that aren’t really compatible with code.

I’m having a hard time understanding what’s going on as by simply copying it off your comment causes it to think that there’s a } symbol missing! ._.

nice! looks good now. thx

Well, it seems runnable now, but all I can get is a static barrage of gray and black rectangles that doesn’t change under any circumstances - not even key presses or anything.
To get to that, I made a dummy function int look(int a, int b,int c, int d){ return 0;} that simply fixes the error doing nothing useful. Then there’s a missing ; to put and a messy comment to remove to fix other 2 errors that don’t let it compile.

There is not even draw() in the code that you provided, leaving the code not being able to draw anything other on the screen. Putting void draw(){} to fix that gives just a tiny bit of progress, as z, spacebar and numpad + - keys now make the screen refresh with a new barrage of rectangles.

Considering the code was written in Processing 1.0, what about downloading Processing 1.0 and getting it to work there instead? It has to because it was made there, right?

I feel like you may not have all of the source code, hence the look and draw functions missing, hence the problems.

Thanks for taking a look!
I think what i remember happening is there are green “human” dots wandering around the black parts and then a red “zombie” dots bumps the human and turns them into red zombie.

I think the person who made this made a future version with a player able to shoot the zombies.

Well, I suggest you to find it!
As I can’t find any code responsible to render any Being or that references a green color in what you posted… It is most definitely incomplete!

@aaronszcz – were you ever able to find the rest of your code? It could be in multiple tabs in the PDE interface – or in multiple .pde or .java files in the original game folder.

The website is old, but it’s still up. My anti malware says the page is not secure…

–www.hardcorepawn.com/zombie3–

and the source code…

–www.hardcorepawn.com/zombie3/zombie5.pde–

I’m not sure how to see more in a pde, if there is more.

I suppose you could try seeing if you could browse the contents of the
–www.hardcorepawn.com/zombie3/-- folder to see if you can find any other files – however I honestly wouldn’t recommend downloading and running assets from a compromised folder unless you feel very confident about inspecting them. Perhaps contact the author instead?

2 Likes

Hello! If you’re actually trying to play the eventual Zombie 4 game, in which you’re a dot and humans are dots and zombies are dots and zombie dots turn human dots to zombie dots, then I may have some leads for you. I was just able to get it to work by:

  1. Finding a website which still nominally hosts Zombie 4
  2. Using examine source to find the URL to the Jar file
  3. Downloading the Jar file
  4. Extracting the main class file from the Jar file
  5. Creating an HTML page which had an tag that pointed to the class and Jar file
  6. using Java’s appletviewer to run that page.

And that actually worked! I’ll attach a screenshot

If you want the specific help with the source file that you found from 2003, I haven’t looked at that. But if all you want is to play the 2005 game, this procedure worked for me in 2020.

zombie4gameplay

2 Likes

Here’s what the menu looks like

zombie4menu

Well done!!!

Please upload sources to github

I guess look() was in another file / tab. It could be the viewport in that where a virtual 2D camera looks on a map that’s bigger than the screen

It looks like there is an archived copy here:

https://barguide.com/games/zombie4/

2 Likes

Gentlemen, I had to sign up just to express my thanks for this. I had all but given hope on playing this for years and it’s only by finding this place have I got the chance at this. I’m currently getting Java installed, thanks so much again everyone!
EDIT: No such luck. Would anyone mind pointing me in the direction of what exactly I need to play this? I’m afraid I don’t know anything about personal file hosting for personal use.

2 Likes

@AnotherCrazyCanadian – unfortunately modern web browsers no longer support Java applets. That bit of text advice to “install Java” referred to a browser Java plugin – but I don’t think that is an option anymore.

Does anyone else on the forum have a suggestion for how to run a Processing sketch that was exported as a web applet in 2006? Could the jar be imported into a contemporary Processing sketch and run locally through PDE, for example?

Although my browser warned my (false alarm??) the pde is still there


// Zombie Infection Simulation
// Kevan Davis, 16/8/03
// Modified by John Gilbertson 25/09/03
// just making zombies more dangerous, edited level creation code, increased max zombies, made zombies less likely to group etc...

int freeze;
int num=4000;
int speed=1;
int panic=5;
int human;
int panichuman;
int zombie;
int dead;
int wall;
int empty;
int clock=0;
int hit;
int ishuman=2;
int ispanichuman=4;
int iszombie=1;
int isdead=5;

Being[] beings;

void setup() 
{ 
  BFont f=loadFont("Univers65.vlw.gz");
  framerate(45);
  textFont(f,19);
  
  int x,y; 
  size(400,200); 
  human=color(200,0,200);
  panichuman=color(255,120,255);
  zombie=color(0,255,0);
  wall=color(50,50,60);
  empty=color(0,0,0);
  dead=color(128,30,30);
  hit=color(128,128,0);
  clock=0;
//  noBackground(); 

  fill(wall);
  rect(0,0,width,height); 
  fill(wall);
  stroke(empty);
  for (int i=0; i<100; i++)
  {
      rect((int)random(width)-(width/8), (int)random(height)-(height/8),(int)random(width/4), (int)random(height/4)); 
  }
 
  fill(empty);
  stroke(empty);
  for (int i=0; i<45; i++)
  {
    rect((int)random(width-1)+1, (int)random(height-1)+1, (int)random(40)+10,(int)random(40)+10); 

    x=(int)random(width-1)+1;
    y=(int)random(height-1)+1;
  }

/*  fill(wall);
  stroke(wall);
  rect(190,0,20,200);
  rect(0,90,400,20);*/

  fill(wall);
  noStroke();
  rect(0,height-30,width,height);
  fill(empty);
  stroke(wall);
  rect(0,height-30,width-2,height-2);
  beings = new Being[8000];        
  for(int i=0; i<num; i++)
  { beings[i] = new Being(); beings[i].position(); }

  beings[0].infect();
  beings[1].infect();
  beings[2].infect();
  beings[3].infect();
  freeze=0;
} 
 

void loop() 
{ 
  if (freeze==0)
  {
//    background(empty);
    fill(wall);
    noStroke();
    rect(0,height-30,width,height);
    fill(empty);
    stroke(wall);
    rect(0,height-30,width-2,height-2);  
    
    for(int i=0; i<num; i++) 
    { 
      beings[i].move(); 
    } 
/*    if (speed==2) { delay(20); }
    else if (speed==3) { delay(50); }
    else if (speed==4) { delay(100); }*/
    clock++;
    int numZombies=0;
    int numDead=0;
        
    for(int j=0;j<num;j++)
    {
      if(beings[j].type==iszombie)
      {
        numZombies++;
      }
      if(beings[j].type==isdead)
      {
        numDead++;
      }
    }
    fill(human);
    noStroke();
    String s="Humans:" + (num-(numDead+numZombies));
    text(s,2,height-10);
    
    fill(zombie);
    String s2="Zombies: " + numZombies;
    text(s2,width-120,height-10);
    
    fill(dead);
    String s3="Dead: " + numDead;
    text(s3,120,height-10);
  }
}

void mousePressed()
{
  int mx=mouseX;
  int my=mouseY;
  int radius=(int)random(10)+6;
  fill(empty);
  stroke(hit);
  ellipse(mx-radius,my-radius,radius*2,radius*2);
  for(int i=0;i<num;i++)
  {
    int dx=beings[i].xpos-mx;
    int dy=beings[i].ypos-my;
    int diff=(dx*dx)+(dy*dy);
    if(diff<(radius*radius))
    {
      beings[i].die();
    }
  }
}

int look(int x, int y,int d,int dist)
{
  for(int i=0; i<dist; i++)
  {
    if (d==1) { y--; }
    if (d==2) { x++; }
    if (d==3) { y++; }
    if (d==4) { x--; }

    if (x>width-1 || x<1 || y>height-30 || y<1)
    { return 3; }
    else if (get(x,y) == wall)
    { return 3; }
    else if (get(x,y) == panichuman)
    { return 4; }
    else if (get(x,y) == human)
    { return 2; }
    else if (get(x,y) == zombie)
    { return 1; }
    else if (get(x,y) == dead)
    { return 0; }
  }
  return 0;
}

void keyPressed() 
{ 
  if(key == ' ')
  {
    key='z';
  } 
  if(key == '+' && num < 8000) { num += 100; key='z'; }
  if(key == '-' && num > 4000) { num -= 100; key='z'; }
  if(key == 'z' || key == 'Z')
  {
    freeze=1;
    setup(); 
  }
}

class Being
{ 
  int xpos, ypos, dir;
  int type, active;
  int belief, maxBelief;
  int zombielife;
  int rest;

  Being()
  {
    dir = (int)random(4)+1;
    type = ishuman;
    active = 0;
    belief=500;
    maxBelief=500;
    zombielife=1300;
    rest=40;
  }

  void die()
  {
    type=5;
  }

  void position()
  {
    for (int ok=0; ok<100; ok++)
    {
      xpos = (int)random(width-1)+1; 
      ypos = (int)random(height-30)+1;
      if (get(xpos,ypos)==color(0,0,0)) { ok = 100; }
    }
  }

  void infect(int x, int y)
  {
    if (x==xpos && y==ypos)
    { 
      type = 1; 
    }
  }

  void infect()
  { type = 1; set(xpos, ypos, zombie); }

  void uninfect()
  { 
    type = ishuman; 
    active = 0;    
    zombielife=1000;
    belief=500;
  }

  void move()
  {
    if(type==5)
    {
      set(xpos,ypos,dead);
    }
    else
    {
      int r = (int)random(3);
      if ((type==ishuman && active>0) || r==1)
      {
        set(xpos, ypos, color(0,0,0));
        
        if(belief<=0)
        {
          active=0;
          maxBelief-=100;
          belief=0;
          rest=0;
        }
            
        if (look(xpos,ypos,dir,1)==0)
        {
          if (dir==1) { ypos--; }
          else if (dir==2) { xpos++; }
          else if (dir==3) { ypos++; }
          else if (dir==4) { xpos--; }
/*          if(belief>0)
          {
            belief--;
          }*/
        }
        else
        {
          dir = (int)random(4)+1; 
        }

        if (type == 1)
        { set(xpos, ypos, zombie); }
        else if (active > 0)
        { set(xpos, ypos, panichuman); }
        else
        { set(xpos, ypos, human); }
        if (active>0) {active--;}
      }

      int target = look(xpos,ypos,dir,10);

      if (type==1)
      {
        zombielife--;
        if (target==2 || target==4) { active = 10;}
        else if (target==3)
        {
          if((int)random(8)==1)
          {
            if (dir==1) { set(xpos,ypos-1,empty); }
            else if (dir==2) { set(xpos+1,ypos,empty); }
            else if (dir==3) { set(xpos,ypos+1,empty); }
            else if (dir==4) { set(xpos-1,ypos,empty); }

          }
          if(look(xpos,ypos,dir,2)==iszombie)
          {
            dir=dir+1;
            if(dir>4) dir=1;
          }
        
        }

        else if (active==0 && target!=1) 
        { 
          if((int)random(6)>4)
          {
            if((int)random(2)==0)
              dir = dir+1;
            else
              dir = dir-1;
            if(dir==5)
              dir=1;
            if(dir==0)
              dir=4;
          }
          else
          {
            dir=dir;
          }
       
        }
 
        int victim = look(xpos,ypos,dir,1);
        if (victim == 2 || victim==4)
        {
          int ix = xpos; int iy = ypos;
          if (dir==1) { iy--; }
          if (dir==2) { ix++; }
          if (dir==3) { iy++; }
          if (dir==4) { ix--; }
          for(int i=0; i<num; i++)
          { 
            beings[i].infect(ix,iy); 
          }
        }  
        if(zombielife<=0)
        {
          die();
        }
      }
      else if (type==2)
      {
        if (target==1)
        {
          maxBelief=500;
          belief=500;
          active=10;
          rest=0;
        }
        if(target==4)
        { 
          active=10;
          if(belief>0)
          {
            belief--;
          }
          else if(belief==0 && maxBelief!=0 && rest>=40)
          {
            belief=maxBelief;
            rest=0;
          }
          else if(belief==0 && rest<40)
          {
            rest++;
          }
        }
        else if(target!=1 && target!=4 && active==0)
        {
          rest++;
        }
        else if (target==1)
        {       
          dir = dir + 2; if (dir>4) { dir = dir - 4; } 
        }
        if ((int)random(2)==1) { dir = (int)random(4)+1; }
      }
    }
  }
}

1 Like

Got https://barguide.com/games/zombie4/zombie4.html working on Waterfox Classic browser on my 64-bit Win8.1 laptop:

I had to install the latest Java 8 patch 261: “jdk-8u261-windows-x64”

But I believe more recent Java major versions should work too, as long as it’s the latest patch for it.

Once it’s installed properly, you’ll need to find Java on the “Windows Control Panel”.

Go to its “Security” tab and click at “Edit Site List…” like the screenshot from the link below:

Whitelist the zombie game site by adding this domain: https://barguide.com

On Waterfox classic browser, go to “Add-ons Manager” and check if “Java Deployment Toolkit” is there.

Make sure “Ask to Activate” option is enabled and you’re ready to visit the zombie link and have its Java applet load the game after we authorize some extra security popups.

Another great site to whitelist for lotsa Java applets is: https://www.greenfoot.org

We can run even its super old demo games:
https://www.Greenfoot.org/scenarios?sort_by=updated&page=2117

2 Likes

Holy smokes, thanks for being super in depth, I was able to get it to work!
Seriously guys, thanks again, I’ve been waiting over a decade to play this again and I would not be able to without your guys help. If anyone comes across the Winter Zombies applet, please let me know!

2 Likes

What if the “Java Deployment Toolkit” isn’t there? That’s the only snag I’m finding.

You need Waterfox Classic now:
Classic.Waterfox.net

And grab Java 8:

That’s not latest patch though!

But you should be asked to upgrade to patch 311 when 1st trying to run a Java applet anyways.