YesNoOk
avatar

Character - Stage interaction  (Read 81416 times)

Started by VIB, April 11, 2004, 01:17:59 pm
Share this topic:

VIB

Character - Stage interaction
#1  April 11, 2004, 01:17:59 pm
  • **
  • Hi, I am the "Personal Text"
    • www.geocities.com/vibhp/mugen/
I found a way to simulate character interaction with the stage by identifying specific stages, since it is not officially supported by Mugen. I have not extensivelly tested this method enough. It may have some errors. There are still some important points to be discussed, so any feedback would be appreciated.

I also made an example to illustrate how it can be done, and to give an idea of what can be done. The example is very simple and is not close to the limits of the method. In this example I made KFM react to my ssf2 spain stage, he will air jump infinitly in the net as he was climbing it, and will simulate the sound of the net falling down in the beggining of the round. The character and the stage has a lot of comments so it should be easy to understand.
Download it here:
http://www.brunazo.eng.br/vandre/stagechar.zip

Basic concept

The basic idea is to allow the character to identify in which stage he is in. So that you can program your character according the stage. This has nothing to do with making a stage that can use objects or triggers. All the progamming is done by the character and this method is all focused on char programming, not stage, all the stage needs to do is identify itself so that the character can do what he wants to.

You will use an animated z-offset parameter on the stage to make it unique. Then the character will identify in what stage he is in using a ScreenPos Y trigger. The z-offset is the line where the characters stand at, this is one of the only variables set by the stage that the character can actually see via triggers, and is the only one of them that is animatable. Because of this property, you can set the z-offset to ANY specific value for the character to see it, then change it back to normal.

How is it done

All the stage needs to do is setting the z-offset with a dummy object, for example:
[StageInfo]
zoffset = 0
zoffsetlink = 1

[BG z]
type  = dummy
start = 0, 220      ; <-------- initial Z-Offset = 220
id = 1

In this example, the initial Z-Offset is 220, this is where the char line will normally be, we will then add a value to it so that we can identify the stage. This is done via controllers:

[BGCtrl stageID 1]
type = PosSet
time = 1
y = 9781
ctrlID = 1

; Back to normal
[BGCtrl stageID 2]
type = PosSet
time = 2
y = 0
ctrlID = 1

Notice I have set the dummy position to 9781, since it's start position is 220, then 9781 + 220 = 10001. This means that z-offset in this moment is 10001, this will the ID number of the stage. ID numbers needs to be unique, for this stage the ID is 10001, you should always use different ID numbers.

Now the character will detect the stage ID number, for that, use a -2 state with a ScreenPos Y trigger. For example:
[State -2, var51 counts the fight time]
type = VarAdd
trigger1 = 1
v = 51
value = 1

[State -2, stageID detect]
type = VarSet
triggerall = Var(51) = [1,2]
triggerall = var(30) = 0
trigger1 = ScreenPos Y = 10001 ; Vega Stage
;trigger2 = ScreenPos Y =   ; add your stage here
v = 30
value = floor( ScreenPos Y )

Here I used 2 controllers, the first one will set a variable (51) to count the ticks in the fight. The second one, will use that variable to know when is the right time to check the Z-Offset, this is after is 1 or 2 game ticks. Mugen will reset all variables on the 1st tick of the 1st fight, so you need to check in the both of them to make sure you don't miss the z-offset change. Then this second controller will set var(30) to the value of the StageID, which is it's offset detected using ScreenPos Y.

That is it. Now you have a variable set with the stage ID number, so you can do all the programming you want to, knowing in what stage you are fighting at. Just use this variable to check if you can do a stage specific event and it will all work properlly =)

You can download the above example, where I did KFM climb up the net in the back of Vega's spain stage from ssf2.
http://www.brunazo.eng.br/vandre/stagechar.zip
if you want you can download the stage BGMusic at my site:
http://VIBhp.cjb.net

What can be done
There are many possibilities to do using this method, that would not be possible otherwise. Including:
- Place destroyable objects in the scenario, like those cans that can be destroyed when a player is thrown on it in ssf2 Ken stage. This would be done by using a helper that would destroy itself when a player is near it being thrown.
- Make objects that hurts the players in the stage. Such as bombs being thrown, trap spikes placed around the stage etc. This would be done using a helper on a attack state with a hitdef with an affectteam = both parameter.
- Use correct footstep sounds and dust effect according to the floor of the stage. Like in SNK games where the sound of your footsteps are diferent if you are on a wooden or concrete floor.
- Water effects on the floor. Some stages have water on the floor and the water splashes when players jump, lands or walk. Just place helpers bellow each players feet to simulate the effect. Such as in Soggetsu's stage from SS5.
- Give your character special abilities when he is on his home stage. Program your charact to be able to perferm some moves only in specific stages. Like Vega and his net in old versions of sf, or like pit fatalities on mortal kombat where your character would do a different fatality move depending on the stage.
- much more

Limits. What cannot be done
- All stage specific sprites and sound needs to be placed on the character's data files. The stage creator has no control over that.
- You cannot modify existing elements of the stage, sometimes you can fake it by placing an image over it, but most of the time you wont be able to do that.
- It is not possible to place objects behind other objects in the stage. If you want for example, that your character throws the opponent out of a bridge stage where he should be placed behind the bridge sprite, you will not be able to do that.

Unique IDs
The StageID number needs to be unique for every stage. The z-offset can go up to a little more than 2 billion, and far bellow lots of billions for negative values. So there is more than enough space for the whole earth population to make enough stages.

ID List
For now, IDs has been decided to be divided in games with 10,000 IDs each.

Game ID 10000: Super Street Fighter II
- 10001, Spain Stage by VIB, download at http://vibhp.cjb.net
...

If you make a stage with an ID number, please post it here so do list can be updated.



This is not a perfect solution for Unique IDs. If you have any suggestion, please discuss it here. Any other comments, or questions you might have, feel free to post them here.

And be sure to download the example, it has many comments and is easy to understand, here goes the url again another time =)
http://www.brunazo.eng.br/vandre/stagechar.zip

edit: April 11, added a floor() trigger in the stage detection controller to avoid debug error msgs, thx to Sakura.
April 16, added some info on Unique IDs
http://www.geocities.com/vibhp/mugen/

GREAT people talk about IDEAS.
Average people talk about Things.
small people talk about other people.
Last Edit: April 16, 2004, 06:16:04 am by VIB

Sakura

Re:Character - Stage interaction
#2  April 11, 2004, 02:14:29 pm
Pretty interesting idea. Some feedback:
The value = ScreenPos Y will produce an "expression trunicated to integer" warning, unless you use floor/ceil for the screenpos y.

Code:
[State -2, var51 counts the fight time] 
type = VarAdd
trigger1 = 1
v = 51
value = 1
Leaving that to run in ther background infinitely will add one unnecesary process, and it's not really needed after it exceeds 2. Limiting it by trigger1=var(51)<3 should be enough.

Btw. I have noticed that during the tests the sctrl failed to register the screenpos y once.
Re:Character - Stage interaction
#3  April 11, 2004, 05:31:12 pm
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
Even though this IS a good idea, but it still won't let you do everything a stage interaction should have.

"You must defeat my flaming
dragon punch to stand a chance."
Re:Character - Stage interaction
#4  April 11, 2004, 06:12:56 pm
  • ******
  • In after lock
    • mugenguild.com/~messatsu/index.html
That is kind of obvious, CCMario, and is already mentioned.  

A centralized topic in one forum would be the best.  Otherwise someone needs to go back and forth to make the list is always updated.  Not the biggest problem, but something to keep in mind.  This is probably the better solution as I don't see too many would use it.  

If too many use it, it would be best to start coming up with standards on a per game basis.  2025-2045 are for backgrounds in SFZ2, for example.


Many people risk their lives everyday by having Mugen.
Re:Character - Stage interaction
#5  April 11, 2004, 06:30:38 pm
  • ******

Mercykiller

Re:Character - Stage interaction
#6  April 11, 2004, 09:19:45 pm
Re:Character - Stage interaction
#7  April 12, 2004, 01:13:07 am
  • ***
Unless I'm wrong, KFM did not really climb up but he is able to make infinite jumps as long as he's at the same level as the net.

Sakura

Re:Character - Stage interaction
#8  April 12, 2004, 01:22:10 am
Yeah. Otherwise he'd need a new set of sprites. Which was not needed, since he was just an example for the stage interaction.

Mercykiller

Re:Character - Stage interaction
#9  April 12, 2004, 01:48:59 am
lol I was aware he wouldn't actually climb the fence...but for some odd reason, the stage interactions the readme entailed wouldn't work with the mugen install I commonly use...but they did work with a clean install of mugen...

VIB

Re:Character - Stage interaction
#10  April 12, 2004, 09:44:43 am
  • **
  • Hi, I am the "Personal Text"
    • www.geocities.com/vibhp/mugen/
Leaving that to run in ther background infinitely will add one unnecesary process, and it's not really needed after it exceeds 2. Limiting it by trigger1=var(51)<3 should be enough.
In the example, this var is used again to know when it is the right time to reproduce the falling net sound. Since all stage events are time-based, you would need this in most of the time. If you are specifically not using it, then you can stop it, but I think it is better to leave it this way as a starting point for everyone.

A centralized topic in one forum would be the best.  Otherwise someone needs to go back and forth to make the list is always updated.  Not the biggest problem, but something to keep in mind.  This is probably the better solution as I don't see too many would use it.  

If too many use it, it would be best to start coming up with standards on a per game basis.  2025-2045 are for backgrounds in SFZ2, for example.
hmm, this is where I wanted the discussion to come to. My first idea was to do it based on the creator. For example, the creator chooses a number, say 432, and then we would use from 432000 to 432999 for his stages, I doubt no one would use more then 1000 IDs, but if you do just get another one.

But base it on games could be a great idea too, this way you would not need to know the ID number of every stage of the same type to react to it. The problem with it is that most of the time, there are small position and velocities differences with stages of the same type made by different people. So for example, if you want to add an interactable crow on a cammy stage from ssf2, you would not be able to position it correctly on the bridge in both my version of it and in Winane's version, because we used different sprite positioning and delta values for the bridge.

I am still not sure which one would be better..

the stage interactions the readme entailed wouldn't work with the mugen install I commonly use...but they did work with a clean install of mugen...
there is something wrong then, it should work on every version of mugen, you only need the character and the stage together. Did you overrided the common.cns or something? Maybe you just picked the wrong KFM =P

thanks for the feedback
http://www.geocities.com/vibhp/mugen/

GREAT people talk about IDEAS.
Average people talk about Things.
small people talk about other people.
Re:Character - Stage interaction
#11  April 12, 2004, 04:41:43 pm
  • ******
  • In after lock
    • mugenguild.com/~messatsu/index.html
Quote
I am still not sure which one would be better..
Assign each game a group of a thousand and every creator posts for space in that group.  Original backgrounds have their own group of ten thousand. :|


Many people risk their lives everyday by having Mugen.
Re:Character - Stage interaction
#12  April 14, 2004, 05:27:34 am
  • *
  • Catch me if you can!
    • mugenko.mgbr.net
Hum... i made something like that (actually, very different and with many limitations) in my KFM. I´d like to know if it´s possible to make a stage like that ship in SOR2, where some punks throw grenades against the players.
There only exists three kind of people: the ones who knows how to count and the other ones that can´t count.
Re:Character - Stage interaction
#13  April 14, 2004, 05:49:53 am
  • *****
  • Nothing ever ends
    • Portugal
    • www.justnopoint.com/loona
Probably - you'd just have to make sure the punks would only be partially drawn (from the waist up, for example), and always place in the correct position.

VIB

Re:Character - Stage interaction
#14  April 14, 2004, 04:31:44 pm
  • **
  • Hi, I am the "Personal Text"
    • www.geocities.com/vibhp/mugen/
Assign each game a group of a thousand and every creator posts for space in that group.  Original backgrounds have their own group of ten thousand. :|
But this wouldn't it take out the advantage of dividing by games? Because this way every stage would have different IDs either way, so you would need to search for every ID for that stage type when you make your character. It's the same when having unique IDs for each single stage.

sure you can do the punks, you would need their sprites from the waist up like loona said to simulate that they are behind the boat, tou can't to do this with chars because you can't edit your oponnent sprites for him to appear from the waist up, but since that is sprite is in your character that should be no problem. Then you just throw helpers with hitdefs using affectteam = both for the grenades..

oh, and btw I just noticed I forgot to mention ChonWang in the first post, he is the one who started with this idea of interacting chars and stages, I just added the method of detecting the stage. =)
http://www.geocities.com/vibhp/mugen/

GREAT people talk about IDEAS.
Average people talk about Things.
small people talk about other people.
Re:Character - Stage interaction
#15  April 14, 2004, 04:43:44 pm
  • ******
  • In after lock
    • mugenguild.com/~messatsu/index.html
Game wise would be easier to reference.  I am making character X from game Y and want him to be compatible with all stages from game Y.

Your choice, really.  Either way gets the job done.


Many people risk their lives everyday by having Mugen.

Mercykiller

Re:Character - Stage interaction
#16  April 14, 2004, 11:51:24 pm
the stage interactions the readme entailed wouldn't work with the mugen install I commonly use...but they did work with a clean install of mugen...
there is something wrong then, it should work on every version of mugen, you only need the character and the stage together. Did you overrided the common.cns or something? Maybe you just picked the wrong KFM =P

Right KFM, and the common1.cns file was untouched from the original installation. So something else was definately up.:\

VIB

Re:Character - Stage interaction
#17  April 16, 2004, 05:54:30 am
  • **
  • Hi, I am the "Personal Text"
    • www.geocities.com/vibhp/mugen/
Game wise would be easier to reference.  I am making character X from game Y and want him to be compatible with all stages from game Y.
hmm, good point, that way you would be able to use game only triggers at least..

So I think it would be perfect to make it per game, with 10,000 IDs each game. Now we need to choose each ID, I think 10,000 to 19,999 could be ssf2 and 10,001 is my Vega stage =)

I'll update the 1st post... ok, start posting your stage IDs here so I can update the list =) should do fine for now..

anyone else wanna give an opinion on this?

KFM, I have no idea what could have happenned =/ can't you give any more specific information? anything too diferent from your normal mugen to a clean one?
http://www.geocities.com/vibhp/mugen/

GREAT people talk about IDEAS.
Average people talk about Things.
small people talk about other people.
Last Edit: April 16, 2004, 05:57:07 am by VIB
Re:Character - Stage interaction
#18  April 16, 2004, 01:10:37 pm
  • *****
  • Nothing ever ends
    • Portugal
    • www.justnopoint.com/loona
An idea that came to mind for the association of games with stages was to convert their names/acronyms to number through l33t - for example, for the Streets of Rage 2 stage I'm working on, I'm considering the number 5012236 (S=5, o=0, R=12, 2=2, level 3.6 = 36).
Then again, that probably wouldn't work too well for conversions of more traditional 1-on-1 fighting games (it'd be harder to associate them with numbers, even if the name of the game could be converted), but considering the amount of fighting games out there, perhaps it would be possible to define a certain number range for 1-on-1 games, and the rest could correspond to other kinds of games... or maybe the non-1-on-1 games could take the negative values...

A different kind of idea would be for people who release stages that contemplate this idea to also provide some code, sounds and possibly sprites that creators and players could add to their characters in order to enhance the experience of playing in that stage - I'm considering doing this for my current stage WIP - basically providing the sound(s) of the beast in the middle of the stage, and possibly a code for it to be used once the WAV file(s) is/are included in a character's SND file - and I'm already considering something similar for another stage from the same game.

VIB

Re:Character - Stage interaction
#19  April 22, 2004, 07:00:47 am
  • **
  • Hi, I am the "Personal Text"
    • www.geocities.com/vibhp/mugen/
I am not sure if it would be a good idea to use IDs that way, at least not necessarelly, because it could still cause some conflicting IDs. I mean, you can do that if your stage if you want, but it shouldn't be a rule for everyone to use, to avoid coincidences.

Providing additional files for characters to program, along with your stage ID is surelly a great idea. Everyone should try that when possible. I will do this myself too.
http://www.geocities.com/vibhp/mugen/

GREAT people talk about IDEAS.
Average people talk about Things.
small people talk about other people.
Re:Character - Stage interaction
#20  April 24, 2004, 08:41:20 am
  • *****
  • Tends to lose track of things a lot. :/
    • www.mugenguild.com/~winane/
Pretty cool idea, VIB.  I suspect it might occasionally cause some problems with some characters, due to the characters not being where they expect to be for one tick, or due to one of the characters freezing the stage as soon as the round starts, but probably not often.  And in a full game, I expect there'd be no problems.
Also, it'd be quite a lot easier in Linux than in DOS, because in Linux you wouldn't need to worry about running out of palette space, or modifying any palettes at all.

It might be good to also make the characters check whether their opponents and partners are compatible with the stage (just by using Name and AuthorName triggers, and knowledge of which characters have been made to be compatible), and choosing a standard one of them to be the one to provide the stage interaction when multiple ones would be a problem.  E.g. if all four characters in a team battle are compatible with the stage, make only the character for which (TeamSide = 1) and (ID<Partner,ID) are true handle the interactivity.  But if only one of the characters is compatible, then that character handles the interactivity regardless of which player it is.
When the interactivity is something like footstep sounds, or ripples and splashes at the character's feet, this wouldn't be necessary.  But if it's something like a fence crashing down, or a randomized animation, or whatnot, it would be helpful.

If anyone volunteers to modify any of their characters to be compatible, I'll go ahead and make patches for my Charlotte, Gen-An, Cammy, and/or Shrine stages (if I can find the time).  But I'd rather wait for confirmation that at least one character will use this before I bother.

An idea that came to mind for the association of games with stages was to convert their names/acronyms to number through l33t
Heh, good to see I'm not the only one who uses 1337-5p34k to choose arbitrary numbers in Mugen code. :)
Still quite busy.

(Yes, I intend to deal with that stuff eventually, but kinda can't just yet, sorry. :/ )
Last Edit: April 24, 2004, 10:39:57 am by Winane