Site hosted by Angelfire.com: Build your free website today!

A Fighting Game Language (As yet unnamed)

This page is about a language for fighting games. I am not in a rush to make this game, so a website was in order to explore this idea further. I think I can work more with the ideas if I put it on a website.

[Posted 30 September, 2004]
Some psuedo-BNF(backus-naur form) description of where my language is at..

assignment ::= identifier(ws)=(ws)text(nl)
toggle ::= toggle(ws)identifier(ws)=(ws)(toggleitem(ws),(ws))*toggleitem
toggleitem ::= (LPAREN)integer(RPAREN) | integer

actiontitle ::= identifier(LBRACKET)(actionpair,)*(actionpair)*(RBRACKET)
actionpair ::= (ACTIONPROPERTY)(COLON)nonbreakingtext
action ::= actiontitle(ws)block
block ::= (LBRACE)(statement)*(RBRACE)
statement ::= block | 

milestone ::= integer(COLON) | end(COLON) | all(COLON)
An example of this being applied:
Smash[length:22, energy:160, command:punchkey]
{
	0:
	2:
	20:
	frame = doku6
	4:
	frame = doku7
	attack
	{
		damage = 15
		hittype = 3
		blockable = 0
		combotype = 2
		sound = hit1
		misssound = 0
	}
}



[Original post]

Actions

Actions are the core concept of my language idea.

In addition actions consist of phases. For the programmers present, an action is much like a select-case statement from basic, or a switch statement from c.

So its got this basic form:

action action_name
phase_num:
phase_num:
attribute=value
attribute=value
phase_num:
phase_num:
attribute=value
attribute=value
action_name is just a simple identifier.
phase_num is an unsigned integer number.
attributes are properties of the game character that can be changed by the actions that it can do.
eg. x_position, y_position, current_frame, direction_faced
value is either some text or a number expressed as text, so really its a lot like an .ini file.

Phases

When a game character is doing an action, it goes through various phases.
This is basically milestones on a timeline.
So when it reaches a phase which has been identified in the code, then the attribute-value pairs are executed to get the desired effect.

Multiple phases can share the same attribute-value pairs to save space.
Furthermore, one optional phase is "all:" which takes effect every single phase.
Another possibility is a "default:" phase which takes effect when the current phase hasn't been identified elsewhere.

Generics

In order for the system to be useful, it needs to be possible to define a common set of actions which any character can use, which should be in some kind of include file.
Such things as walking and jumping fall into this area. This idea of generic actions I haven't given much thought to.

For instance, in a generic walking action; How can it know what frames to change to as the action progresses. So somehow the game character code needs to pass this information on.
The purpose of writing this up is to make the most of this idea.
The solution doesn't need to compromise.

Example Code

Follwing is an action defined in an existing old version of this language.
This old version of the language was used sparingly in the current version of my game TurboFight. Unfortunately the graphics engine for that game needs an overhaul, and that is a work-in-progress.
The proposed syntax is a lot more cleaned up than this.
action-start
name=bash
defaultmovex=14
phases=3
phase=0
frame=doku1.bmp
dir=toggle
phase=6
dir=toggle
phase=16
attack=1
damage=10
hittype=3
hitsound=hit1.wav
blockable=0
combotype=2
missound=0
phase=17
Applying the new suggested syntax the above may look like:
action bash
finish=17
all:
movex=14
0:
frame=doku1.bmp
dir=toggle
6:
dir=toggle
16:
attack=1
damage=10
hittype=3
hitsound=hit1.wav
blockable=0
combotype=2
misssound=0
So to walkthrough this code...
The action is called bash. It will last for a total of 17 phases. At each phase the character will move 14 places along the x axis in the direction he is facing.
For phase 0, the characters frame will be set to doku1.bmp, which we will assume has been loaded into the system. Also the characters direction will be toggled so that he is facing the opposite direction, in other words, he turns around.
At phase 6, the direction is toggled again, so he turns back to his original direction.
Finally, at phase 16 an attack is attemped to do 10 damage, and knock the victim back in hit-type 3. The sound hit1.wav is to be played for a hit that connects.
The move is not blockable, so only way to avoid it is to get out of the way, rather than being able to stand there and withstand the attack.
Combotype controls how this attack can fit into a combo.
Misssound is the sound to be played when the move doesn't connect, in this case no sound is to be played.

In summary, the character takes a few steps back, then heads charging at the opponent, with a chance of causing damage near the end of his charge.

Articles-Home
Home