Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Pages: [1] 2  All

Author Topic: First Person Game  (Read 16294 times)

0 Members and 1 Guest are viewing this topic.

Magnolia

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 30
    • View Profile
First Person Game
« on: August 02, 2005, 03:59:37 AM »

Hello everyone,

I am starting a game and have never used this software before so I guess I am going to have some naive questions for awhile. ::)

1.  I am making a "First Person Game".  How do I get rid of the default actor and when I do, will the actor be removed from the default/scene scripts?  For example, the "left click" always refers to the actor's movement.

2.  Since I downloaded the newest version of the software, do I still need the patch?

3.  What is your recommendation for graphics resolution for a 2D First Person Game?

I guess that is it for now...

Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: First Person Game
« Reply #1 on: August 02, 2005, 08:41:37 AM »

Hi,

it's entirely up to you. The quick and dirty way is to hide actor (in scene_init.script) using actor.Active = false;
Then if you define regions for exits and interaction and attach scripts to them, you have basically very quickly what you need.

but I would recommend putting it away from scripts entirely (don't load it in game.script and tweak game.script and game_daemon.script
so it won't referrence the actor anymore)

Regarding resolution -  800x600 or 1024x768 are nice. It depends on how large your game should be.

Hope that helps
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: First Person Game
« Reply #2 on: August 02, 2005, 09:33:16 AM »

You can also check this archive: http://dead-code.org/download/first_person.rar
It contains modifies files for a first person actor, defined as a transparent image (so that the actor isn't visible) and overriding the GoTo/TurnTo methods to do nothing.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Magnolia

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 30
    • View Profile
Re: First Person Game
« Reply #3 on: August 03, 2005, 03:32:11 AM »

OK, thanks.  8)
Logged

Magnolia

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 30
    • View Profile
Re: First Person Game
« Reply #4 on: August 04, 2005, 04:53:44 PM »

Can you explain to me the flow of the scripts.  There are scene, game, object etc. scripts.  For example, if I have a keypad and you click on the correct numbers, it will open a door.  When a number is clicked on, for example the number 8, it will turn on a object that I will have placed on the number 8, on the keypad, but is initially invisible.  This is will allow the player to know what number they clicked.  So, on the object scriipt, I would set some variable that this number was clicked and what sequence number it was.  After four numbers have been clicked, which script would I check/code to see if the correct numbers were clicked and in the right sequence? 
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: First Person Game
« Reply #5 on: August 04, 2005, 09:40:48 PM »

I use the following analogy to describe the scripts/events system in WME: the game comprises of lots of game objects: scene, entities, actors, GUI windows and others. Each of these objects can have one or more scripts attached to it, which works as its "brain". The brain provides receptors - the event handlers - to react on events coming from the outside. For example, when the player clicks an entity, its script(s) will receive a "LeftClick" event etc. You can also define your own events (so called high-level events), like the "LookAt" or "TalkTo" events used by the default project template.

As for the keypad example, there are several ways of accomplishing that, but probably the most suitable way would be to create a GUI window with a set of buttons. The window also has a script attached, and whenever the player presses one of the buttons, their parent window will receive an event with the same name as the button name. So what you need to do is to create a .window file with ten buttons named "0" to "9". Then attach a script to that window, which will handle the keypresses like that:

Code: [Select]
on "0"
{
  AddKey("0");
}
on "1"
{
  AddKey("1");
}
...

And the AddKey() function would keep track of what keys have been pressed so far:

Code: [Select]
var Pressed = "";
function AddKey(KeyName)
{
  Pressed = Pressed + KeyName;
  if(Pressed=="12345")
  {
    // player entered the right code, do something
  }
}
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Magnolia

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 30
    • View Profile
Re: First Person Game
« Reply #6 on: August 05, 2005, 03:46:39 AM »

I must be doing something wrong.  When I click on the area to pull up the .window, it doesn't do anything. 

I created an entity region on a door and defined a script that reads as such:

Quote
#include "scripts\base.inc"

////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  Game.LoadWindow("scenes/windows/keypad.window");
  }

Here is the window definition:

Quote
WINDOW
{
  X = 200
  Y = 200
  WIDTH = 300
  HEIGHT = 304
  NAME = "keypad"

  IMAGE = "scenes\images\keypad.png"
 
  STATIC
  {
    VISIBLE = TRUE
  }


  BUTTON
  {
    IMAGE = "interface\gui\1.png"
    NAME = "key1"
    X = 40
    Y = 100
    WIDTH = 54
    HEIGHT = 51
  }

  BUTTON
  {
    IMAGE = "interface\gui\2.png"
    NAME = "key2"
    X = 45
    Y = 105
    WIDTH = 52
    HEIGHT = 50
   }
  }

I just tried two buttons with no script attached to see if the window would appear.

I get an "Error Parsing WINDOW file.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: First Person Game
« Reply #7 on: August 05, 2005, 01:25:50 PM »

I get an "Error Parsing WINDOW file.
Hmm, the file seems to be syntactically correct. Isn't there some other error in the log file, such as missing file warning?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Magnolia

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 30
    • View Profile
Re: First Person Game
« Reply #8 on: August 05, 2005, 02:43:47 PM »

Arrgh.  I was pointing to the wrong folder for the images.  Now it works.  These .window files, they can be in any folder right?  For instance, this scene that will pull up the keypad, that window file does not have to be in that particular scene folder?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: First Person Game
« Reply #9 on: August 05, 2005, 04:25:21 PM »

Arrgh.  I was pointing to the wrong folder for the images.  Now it works.  These .window files, they can be in any folder right?  For instance, this scene that will pull up the keypad, that window file does not have to be in that particular scene folder?
Right. Basically you can have any file anywhere, as long as it's somewhere inside the project folder. It's entirely up to you how you organize your project.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Magnolia

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 30
    • View Profile
Re: First Person Game
« Reply #10 on: August 06, 2005, 05:53:25 AM »

The two sets of code for the "keypad", would I put it all in the same script that comes from the .window?  I can't get it to work.  I also tried to get a sound effect to work from the buttons and that doesn't work also.  I am also trying to turn the button image to visible.

This is what I have been playing with:

Quote
#include "scripts\base.inc"

////////////////////////////////////////////////////////////////////////////////
var Pressed = "";

on "key1"
{
  this.GetControl("key1");
  AddKey("key1");
  self.Visible = true; 
  self.PlaySound("sound\keypad1.ogg");
}
on "key2"
{
  AddKey("key2");
}
on "key3"
{
  AddKey("key3");
}
on "key4"
{
  AddKey("key4");
}
on "key5"
{
  AddKey("key5");
}
on "key6"
{
  AddKey("key6");
}
on "key7"
{
  AddKey("key7");
}
on "key8"
{
  AddKey("key8");
}
on "key9"
{
  AddKey("key9");
}

function AddKey(KeyName)
{
 Pressed = Pressed + KeyName;
 if (Pressed=="key1,key2,key3,key4,key5,key6,key7,key8,key9")
 {
   Game.Msg("This is my test method");
 }
}
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: First Person Game
« Reply #11 on: August 06, 2005, 02:59:07 PM »

One important thing I forgot to mention, you will have to add:

PARENT_NOTIFY = TRUE

to the definition of each of the buttons. This property ensures an event is triggered in the parent window when the button is pressed. Other than that your code should work if you attach the script to your window. The resulting string will NOT be equal to "key1,key2,key3,key4,key5,key6,key7,key8,key9", but more like "key1key2key3key4key5key6key7key8key9", though. Also there's no need to make the button visible. It's already visible otherwise the player wouldn't be able to press it.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Magnolia

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 30
    • View Profile
Re: First Person Game
« Reply #12 on: August 06, 2005, 03:25:51 PM »

Quote
Also there's no need to make the button visible. It's already visible otherwise the player wouldn't be able to press it.

The reason I want to make the button invisible is so that when they press it, a different image will appear.  For example:




The 1  2  3 is part of the keypad, or background to the window.  The blue "1" object is placed over the "1" on the background, but it is invisible.  When the one is clicked, the invisible object, or the blue 1 will now appear so it looks like that key has been lit.

****************************************************************************

I had the Parent_Notify for each button and I removed the commas between the button names.  It still is not working.  Here is my definition for the buttons:

Quote
WINDOW
{
  X = 200
  Y = 200
  WIDTH = 300
  HEIGHT = 304
  NAME = "keypad"
 
  IMAGE = "scenes\FrontAnimals\keypad1.png"
 
  STATIC
  {
    VISIBLE = TRUE
    SCRIPT = "scenes\FrontAnimals\scr\keypadbuttons.script"
  }


  BUTTON
  {
    IMAGE = "objects\1a.png"
    NAME = "key1"
    X = 42
    Y = 57
    WIDTH = 54
    HEIGHT = 51
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }

  BUTTON
  {
    IMAGE = "objects\2a.png"
    NAME = "key2"
    X = 113
    Y = 58
    WIDTH = 52
    HEIGHT = 50
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }

BUTTON
  {
    IMAGE = "objects\3a.png"
    NAME = "key3"
    X = 187
    Y = 58
    WIDTH = 52
    HEIGHT = 50
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }

BUTTON
  {
    IMAGE = "objects\4a.png"
    NAME = "key4"
    X = 42
    Y = 128
    WIDTH = 52
    HEIGHT = 50
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }

BUTTON
  {
    IMAGE = "objects\5a.png"
    NAME = "key5"
    X = 115
    Y = 128
    WIDTH = 52
    HEIGHT = 50
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }

BUTTON
  {
    IMAGE = "objects\6a.png"
    NAME = "key6"
    X = 186
    Y = 128
    WIDTH = 52
    HEIGHT = 50
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }

BUTTON
  {
    IMAGE = "objects\7a.png"
    NAME = "key7"
    X = 42
    Y = 200
    WIDTH = 52
    HEIGHT = 50
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }

BUTTON
  {
    IMAGE = "objects\8a.png"
    NAME = "key8"
    X = 115
    Y = 200
    WIDTH = 52
    HEIGHT = 50
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }

BUTTON
  {
    IMAGE = "objects\9a.png"
    NAME = "key9"
    X = 187
    Y = 200
    WIDTH = 52
    HEIGHT = 50
    VISIBLE = FALSE
    PARENT_NOTIFY = TRUE
  }
}

I appreciate your help, Mnemonic!!!  It doesn't make sense to me why this is not working.  I like how the window pops up over the scene/room, so I'd really like to understand this so I can use it for puzzles.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: First Person Game
« Reply #13 on: August 06, 2005, 03:44:13 PM »

Ah, the problem is the SCRIPT = "scenes\FrontAnimals\scr\keypadbuttons.script" is misplaced. You should move it outside the STATIC section. The way it's written now, you're defining a static control inside the window and you're attaching a script to that control. You need to attach the script to the window itself.

Code: [Select]
WINDOW
{
  X = 200
  Y = 200
  WIDTH = 300
  HEIGHT = 304
  NAME = "keypad"
 
  IMAGE = "scenes\FrontAnimals\keypad1.png"
  SCRIPT = "scenes\FrontAnimals\scr\keypadbuttons.script"

 
  STATIC
  {
    VISIBLE = TRUE
    ; properties of the static control come here...
  }
  ...
}

As for the button appearance, you can change it by using button's SetImage() method. Something like this:

var Button = this.GetControl("key1");
Button.SetImage("path\highlighted_1.png");
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Magnolia

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 30
    • View Profile
Re: First Person Game
« Reply #14 on: August 07, 2005, 06:41:31 PM »

I moved the script up like you suggested and it still seems not to be recognizing the script.  The window with the keypad image comes up, but when you click on the numbers, nothing.  :'(
Logged
Pages: [1] 2  All
 

Page created in 0.105 seconds with 20 queries.