Health/Magic meters discussed

A long time ago Dee mentioned that he was writing an article on how to create a health meter. I haven't seen nor heard anything about this article, so I'm not sure if it has been published and I missed the announcement, or if it has been shelved for the time being. Anyways this subject was recently brought up on the #coldstone channel, and here is my thinking on how this could be done:

Short version: Create a timer that loops quickly, and each iteration have it check the player's health/magic/whatever you are wanting to meter. As it decreases/increases either A) change the player icon which has a meter placed on it(which would necessitate a whole lot of pictures) or 🆒 place a stamp on the character(with a frame offset so it appears on the side of the character).

Long version:

  1. Ceate a timer using animations (a detailed explaination can be found on the (url="http://"http://stark.evula.net/plugin_faq.htm")How-to write a PoG plug-in(/url) page that I made under the (url="http://"http://stark.evula.net/plugin_faq.htm#tiptimer")timer tip(/url) section). I would recommend a 3 frame animation, with the 1st frame being a marker and the 3rd frame set to loop back to the first frame. Set each frame to be 1 (or 0 if it is possible). The 2nd frame would call the meter event.

  2. Create a number of meter pictures. If you want 4 variations(100%, 75%, 50%, 25%), more, less, different colors... it doesn't matter. Just create the pictures that you want and give them an offset so that if they are placed on the ActualX/Y coordinates of the player then they will appear on the side of the character(or above him) and not over top.

  3. Create an event that does the following(using health for illustrative purposes):

  • Removes the stamp "health_meter"
  • Checks the player's health
  • Places a stamp based on the player's health (through a conditional) named "health_meter"

NOTE: Remember that stamp names do not have to be unique. Since stamp's are placed and named "on the fly," you can have 15 "stamp control" event objects in your linked actions event list and everything will be fine. When the stamp control event is called the stamp is placed and given the name you assign to it. And since in the above event we first remove the stamp and then place 1 stamp based on a conditional, we should not run into any problems.

ADDITIONAL NOTE: The continual stamp removal/placement is necessary since otherwise the player would be able to move and the meter would be left behind. The trick would be to make the meter update fast enough so that when the player moves the stamp "moves" with him, unless there is a way to attach a stamp to the icon which I am unaware of...

ALTERNATELY: If you wish to use player icons... The first step is the same, but then:

  1. Create a load of player icons. You will need 1 complete set of icons for each meter reading(ie, a walk e full health, an attack e full health, a walk sw quarter health, an attack sw quarter health, etc).

  2. Create 2 globals: &&gb;_player_health_icon, &&gb;_player_health_status

  3. Create an event that does the following(using health for illustrative purposes):

  • Checks the player's health
  • Assigns a value to &&gb;_player_health_status based on his health condition(full, half, etc. Whatever your meter readings are going to indicate).
  • Check the value of &&gb;_player_health_status against &&gb;_player_health_icon. If they are the same value then end the event. If not, continue.
  • Set the player icon to the meter icon based on a conditional check of &&gb;_player_health_status
  • Set &&gb;_player_health_icon to be equal to &&gb;_player_health_status

My thinking on the above is that either method would probably be fairly memory/processor intensive. It would mean global checks are constantly being done, and pictures are constantly being modified(either the icon or a stamp). On an older system this would probably run pretty slowly.

Also, if you intended to have more than 1 meter(ie, a health and a magic meter) then the stamp method would be best. Using the player icon method would exponentially increase the amount of pictures you would need(ie. a walk w full health full mana, a walk w full health quarter mana, etc).

Again, I'm not sure what Dee was thinking or planning with his article. But this is what I've come up with. It is all based on theory, not application, but it certainly should work(sounds plausible, heh).

Any questions? Critiques? Ways to make it better?

(edit) Fixed a bad UBB call. Bad UBB! (/edit)
------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) now on (url="http://"http://www.evula.net")EVula.net(/url)

(This message has been edited by Stark Bledfast (edited 10-15-2002).)

Funny you should mention this Stark, (url="http://"http://ellrx.250free.com/counter.pdf")i wrote up a method too(/url)
or see the post (url="http://"http://www.AmbrosiaSW.com/cgi-bin/ubb/postdisplay.cgi?forum=Forum48&topic;=001503&whichpost;=ellrx10-07-200203:39PM")Remove Item from Inventory??(/url)

I was considering a segmented bar for my method as well(this was before my question regarding TAG values was answered) i later abandoned it because my example used 64 iterations, and with that many things to keep track of i was sure it'd be a problem. The section on Player Icons is nice

------------------
(url="http://"http://www.geocities.com/ellrx/index.html")eLL' softWare: updated 10.08.02(/url)

(This message has been edited by ellrx (edited 10-15-2002).)

I'm glad everyone here is so clever 😄 thanks!

Migraine.

------------------
Do yu get Migraines? - (url="http://"http://www.geocities.com/ibashmyselftosleep")www.geocities.com/ibashmyselftosleep(/url)
"Kids aren't influenced by computer games at all... Pac man's a computer game, how many kids do you know who listen to repetetive music and take mind-altering pills?"

Speaking of health meters, will a meter show on hostile NPCs all the time, or is there something you can do to get rid of them?

------------------
Someone give me a funny signature! PLEASE!

Quote

Originally posted by ellrx:
~snip~

Ellrx,

The one problem with using a continual spell casting method(which is what you are theorizing, if I understood your method correctly), is that the player will be constantly casting a dummy spell which creates the counters, etc.

You can set up the dummy spell to be either "ally" in effect, or "caster" in effect, neither of which work very well.

With the "ally" casting, and with Coldstone not having a working ally system, the spell searches for an ally but does not find one. So you get a slew of "No ally in range!" messages, but no meter bar.

The problem with doing "caster" effect spells is that if you have a spell casting animation(as PoG does), your character ends up in an infinite casting routing(in PoG it looks like he is doing jumping jacks). Event though mana is never used(since we set the spell to cost 0 magic points) the casting animation is still called continuously. Because of this the player is unable to move because he is constantly casting. Furthermore, if this were somehow alleviated, the "cast last spell" commands would be rendered useless, as the last cast spell would continually be changed to the meter bar spell.

Also, in your method you state to make sure that you place the stamp at the Player X/Y coordinates. This is incorrect. Stamp placement is done on pixel coordinants and not movement tiles. You need to multiply the Player coordinants by 32 each, and then set up the offset in the animation editor to handle the player icon offset.


That being said, I've done some testing on my own and build a plugin for PoG that does work to display a counter. However, it is choppy. The problem lies in the placement of the stamps (pixel coords) and the way the player moves (movement tiles). You can't find the pixel coordinants of the player, only his movement tile. And since the player can take several steps in any direction within a tile before moving to the next, the meter bar stays put(and thus getting out of alignment) and then "snaps" into place when the player gets to the adjacent tile.

Bottom line: It works, just not very well.

I'll post a movie file of this tomorrow, and if people are interested I'll upload the source code to the Coldstone directory for dissection. Hopefully a "better" method will be found that makes the bar track smoothly with the player.

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) now on (url="http://"http://www.evula.net")EVula.net(/url)

Alright, a friend of mine made a short movie of the magic meter with SnapZ Pro(pretty cool software, I need to upgrade my machine so I can use it). You can view the meter in action (url="http://"http://stark.evula.net/resources/magicmeter.mov")here(/url).

Again, notice the choppiness of the movement of the meter.

If anyone is interested in seeing the source code for the meter just ask and I'll upload it to the coldstone directory for dissection.

Quote

Posted by Unknown: **
Speaking of health meters, will a meter show on hostile NPCs all the time, or is there something you can do to get rid of them?**

Mr. Unknown,

To my knowledge the health meter on NPCs is hard coded into the engine. I don't believe there is a way to get rid of it, nor change it. I would love to be proved wrong though... 🙂

(edit) Gave a reply to Mr. Unknown so that I wouldn't have to triple post (/edit)
------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) now on (url="http://"http://www.evula.net")EVula.net(/url)

(This message has been edited by Stark Bledfast (edited 10-17-2002).)

After seeing the movie you posted, Stark, it looks like having the meter follow your player may not be the best option.

So, I was thinking...it might look better to keep the health meter in the Map Interface. That way you'd still get the cool factor of having a meter, but you wouldn't have to watch it bounce around your character all the time.

The best way I can think to do this is by making hollow spots in the Map Interface and placing the meters below them. Or would that not work?

------------------
(url="http://"http://jankostar.net/sanko")my Page of Garbage(/url)

Quote

Originally posted by sanko:
**So, I was thinking...it might look better to keep the health meter in the Map Interface. That way you'd still get the cool factor of having a meter, but you wouldn't have to watch it bounce around your character all the time.

The best way I can think to do this is by making hollow spots in the Map Interface and placing the meters below them. Or would that not work?**

I haven't tried this, but I don't see why it wouldn't work. Hmm, well, maybe.

Map interfaces have to support changing tag values, as they constantly update things like hps, etc. But I'm not sure if you can have a graphic update. If you can then this would work very well. If you can't, well, we've hit a road block.

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) now on (url="http://"http://www.evula.net")EVula.net(/url)

Hmm..if only you could draw a stamp at an actual screen position (relative to the monitor's resolution setting), instead of coordinates relative to the map.

------------------
(url="http://"http://jankostar.net/sanko")my Page of Garbage(/url)

Quote

Originally posted by sanko:
Hmm..if only you could draw a stamp at an actual screen position (relative to the monitor's resolution setting), instead of coordinates relative to the map.

I think I get what you're thinking, Sanko. Unfortunately the player isn't always centered on the screen. When the edge of the area is encountered the camera stops panning and the character moves to the edge.

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) now on (url="http://"http://www.evula.net")EVula.net(/url)

Quote

Originally posted by Stark Bledfast:
**Ellrx,

The one problem with using a continual spell casting method(which is what you are theorizing, if I understood your method correctly), is that the player will be constantly casting a dummy spell which creates the counters, etc. /snip/
**

revisions, revisions, revisions... My initial test for the game i'm creating is a shooter, that being said, i noticed no jumping jacks because i was modelling it partially after the Cosmic Memory structure. Because like cosmic memory there is no player only a cursor. This however did not work for me, because i wanted to take advantage of built in statistics/handlers/events so i did build a main character using a white pict image and locking him in place by blocking his access, and using path animated stamps with click events this worked but didn't take advantage of AI, and was unsatisfactory.

I rebuilt again this time using an NPC and casting a 0damage/0mp spell on him at the start, while in the next area over you have the player who now can shoot the other NPCs using another 0mp spell tada...the invisible NPC was being effected constsantly by the dumb spell cast by the invisible Player who can't move...etc. This method works...for a shooter with a static screen.

SInce then i've torn dwn that system and now use an event and tie it to the 'when cast' condition which has
a sprite animation that calls a maintenence event (checks appropriate variables) that changes the Bar/timer. based on the specified percentage of the bar...that said, i'll revise it.

------------------
(url="http://"http://www.geocities.com/ellrx/index.html")eLL' softWare: updated 10.15.02(/url)(url="http://"http://www.geocities.com/ellrx/download/index.html")CGE related PDFs(/url)

While revising my method, you state that the stamp must move in iterations of 32-minus the player x,y, this will cause it to pop around the player,but also in the movie it is placed in the <<player>> layer which makes it hard to see, when the player is in front of the animation.

Quote

**Also, in your method you state to make sure that you place the stamp at the Player X/Y coordinates. This is incorrect. Stamp placement is done on pixel coordinants and not movement tiles. You need to multiply the Player coordinants by 32 each, and then set up the offset in the animation editor to handle the player icon offset.
**

I see, in the graphics files used by CGE 8 frames of movement are used to get the player to move 32 pixels of space, this would mean that the player advances one frames and slides 4 in any given direction, since this is the player's true velocity wouldn't it be best to multiply the coordinates by 4 instead of 32, that should eliminate the popping.

Also that plus the offset made in the animation editor
should provide a smooth equidistant mp counter.

also...
Correct me if i'm wrong but the stamp control called within a main location of type 'map' allows you to use '.cam' format files without incident, correct?

------------------

(This message has been edited by ellrx (edited 10-17-2002).)

Quote

Originally posted by ellrx:
While revising my method, you state that the stamp must move in iterations of 32-minus the player x,y, this will cause it to pop around the player,but also in the movie it is placed in the <<player>> layer which makes it hard to see, when the player is in front of the animation.

Yes, you could place the stamp in the foreground and it would not be covered up by the player.

Quote

I see, in the graphics files used by CGE 8 frames of movement are used to get the player to move 32 pixels of space, this would mean that the player advances one frames and slides 4 in any given direction, since this is the player's true velocity wouldn't it be best to multiply the coordinates by 4 instead of 32, that should eliminate the popping.

It depends on how large your movement tiles are. In PoG, which I used as the test base, these are set up as 32X32 tiles. Thus the player's coordinates stored within PlayerX/Y are given in terms of movement tiles. So if the player is positioned at (2,2) the pixel coordinates are (64,64) (minus the offset due to character icon size and the fact that those coordinates will be the bottom right-hand corner of the tile). If you multiplied by 4 then you would get the coordinates (8,8) which are within the movement tile (1,1). You are correct in that the PoG player icon has animation movement within movement tiles, but you can't, to my knowledge, access where exactly he is.

For instance let's say the character is standing still at the coordinates (12,36). He then begins to walk west which will eventually bring him to (11,36). However, he will take 1-2 animation frames to get to those coordinates even though the animation "moves" west. How would you determine where the character is at since CGE only stores movement tile coordinates for the player? Since the player could have moved in any of the 8 directions and taken an animation "step" or two before it is determined that he has crossed onto the adjacent movement tile.

Quote

Correct me if i'm wrong but the stamp control called within a main location of type 'map' allows you to use '.cam' format files without incident, correct?

Haven't the foggiest. I've never use .cam formats. If this is a way around the above limitations I'll certainly give it a look-see.

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) now on (url="http://"http://www.evula.net")EVula.net(/url)

I have an idea, early during beta testing i made thee mistake of attachiing a pause game action to the up arrow, meaning you can append exra actions to default keys

(like for instance if you only wanted these actions available during certain times you could use a conditional at the head of your appended actions that would check a global and execute an end event action if necessary.)

but anyhow,( lets stick to the POG graphic tiles/settings found withing the default medieval game)
when you press up by default it slides the player 4 pixels and proresses 1 frame of animation.
Could you not set up a series of variables;
PlayerX * 4
PlayerX * 8
PlayerX * 12 ...PlayerX * 32 and vice versa for the Y coordinate of the stamp (this might be extremely slow and hard to execute the addition/depletion action associated with the bar)

Perhaps uing a 'launch event' action in a frame close to the first(maybe 3/8) of each directional movement(of the PCs animation file), and in that is the routine to modify the coordinates. If you used the 3 of eight frames if should probably skip the first three iterations of 4 at which point it might use 5*PlayerX as the velocity in order to cover the ground and still allow the 8th frame to loop back to the start.
You should probably create 4 separate events for each direction&its; derivative,that calculate the placement of the counter for that direction meaning where to place the counter after he/she/it switches direction. This is the only way i know of to determine what direction the chracter is proceeding in.

Maybe the best method would be to place the counter equal to CameraX, CameraY
and offsetting it in the animation file

that is if .cam files work...has any one seen DEE?

or likewise creating two variables NewX NewY which equal playerx4 and playery4 and in the single frame of each .cam file attaching a flag of type 'offset animation' and giving it '&&NewX;,&&NewY;' for coordinates ???

------------------