Guest User

BulletMLX DTD

a guest
Apr 22nd, 2015
1,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 13.23 KB | None | 0 0
  1. <!--
  2.  
  3. BulletMLX Document Type Definition.  Originally based on the work
  4. Kenta Cho.  The original work can be found at:
  5.  
  6.    http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/
  7.  
  8. This file expands the original with some new elements and attributes
  9. necessary for our game.  All BulletML files are valid BulletMLX
  10. files.  The source file
  11.  
  12.    src/bullet.lua
  13.  
  14. contains our implementation of BulletMLX while the file
  15.  
  16.    docs/Patterns.txt
  17.  
  18. explains how to write bullet patterns using the language, from the
  19. perspective of designers more than developers.
  20.  
  21. -->
  22.  
  23. <!-- <vertical>
  24.  
  25. We use this tag as a child of <accel> to indicate that a bullet should
  26. accelerate in a vertical direction.  The value of the tag is a degree
  27. in the range of zero to three-hundred fifty-nine.  The optional
  28. attribute ‘type’ determines the semantics of that value.  See the
  29. documentation for <direction> for the meaning of the ‘type’ values.
  30.  
  31. -->
  32. <!ELEMENT vertical (#PCDATA)>
  33. <!ATTLIST vertical type (absolute|relative|sequence) "absolute">
  34.  
  35. <!-- <fireRef>
  36.  
  37. This tag references a labeled <fire> tag.  The game currently does not
  38. use this tag.
  39.  
  40. -->
  41. <!ELEMENT fireRef (param*)>
  42. <!ATTLIST fireRef label CDATA #REQUIRED>
  43.  
  44. <!-- <changeDirection>
  45.  
  46. An <action> uses this tag to modify the current <direction> of the
  47. bullets the pattern is firing.  The <term> indicates how many ticks it
  48. takes before the full change of direction takes place.  See the
  49. <direction> documentation for details on that tag.
  50.  
  51. -->
  52. <!ELEMENT changeDirection (direction, term)>
  53.  
  54. <!-- <bulletml>
  55.  
  56. This is the root tag of bullet pattern definitions.  It must contain
  57. multiple <bullet> and <action> tags.  The ‘xmlns’ attribute is
  58. acceptable but there is no defined namespace for BulletMLX files.  The
  59. ‘type’ attribute may contain three possible values; they indicate the
  60. overall direction of the pattern.  That attribute exists more for
  61. self-documentation than anything else.
  62.  
  63. -->
  64. <!ELEMENT bulletml (bullet | action)*>
  65. <!ATTLIST bulletml xmlns CDATA #IMPLIED>
  66. <!ATTLIST bulletml type (none|vertical|horizontal) "none">
  67.  
  68. <!-- <debug>
  69.  
  70. This tag should contain a string of Lua code defining one function.
  71. That function must accept one argument, which will be a Pattern object
  72. representing the current bullet pattern (see “src/bullet.lua” for its
  73. definition).  This makes it easier for designers to add debugging
  74. tools into complex bullet patterns.
  75.  
  76. -->
  77. <!ELEMENT debug (#PCDATA)>
  78.  
  79. <!-- <param>
  80.  
  81. A <param> represents a parameter used within a <bulletRef/> or an
  82. <actionRef/>.  Parameters make it possible to define a bullet or
  83. action with blanks to fill it later during the references.  For
  84. example, we have this bullet definition:
  85.  
  86.    <bullet label="basic">
  87.        <speed>$1</speed>
  88.        <size>$2*$rand+4</size>
  89.        <color red="0" blue="180" green="240"/>
  90.    </bullet>
  91.  
  92. The values ‘$1’ and ‘$2’ are special BulletMLX text that represent
  93. parameter values.  The values we give to <param> later will replace
  94. those variables.  Here is how we can reference the bullet and fill in
  95. the parameters:
  96.  
  97.    <bulletRef label="basic">
  98.        <param>3</param>
  99.        <param>10</param>
  100.    </bulletRef>
  101.  
  102. So now 3 would replace ‘$1’ and 10 would replace ‘$2’.  Other
  103. <bulletRef/> nodes could reference the same bullet but provide
  104. different parameter values to create different bullets built from the
  105. same mold.
  106.  
  107. -->
  108. <!ELEMENT param (#PCDATA)>
  109.  
  110. <!-- <actionRef>
  111.  
  112. This tag references an existing <action>, which must have a ‘label’
  113. attribute.  It tells the game to execute that action as if we had put
  114. the entire contents of the <action> tag we reference in that spot.  It
  115. also allows for <param> tags just like <bulletRef/>.
  116.  
  117. -->
  118. <!ELEMENT actionRef (param*)>
  119. <!ATTLIST actionRef label CDATA #REQUIRED>
  120.  
  121. <!-- <repeat>
  122.  
  123. Repeat an action a given number of times.
  124.  
  125. -->
  126. <!ELEMENT repeat (times, (action | actionRef))>
  127.  
  128. <!-- <accel>
  129.  
  130. Accelerates a bullet in a certain number of frames, indicate by the
  131. <term> node.  One of two optional nodes must appear: <horizontal/> or
  132. <vertical/>.  These indicate the direction of acceleration.
  133.  
  134. -->
  135. <!ELEMENT accel (horizontal?, vertical?, term)>
  136.  
  137. <!-- <times>
  138.  
  139. The number of times to perform an action, particularly as used by the
  140. <repeat> element.  The content of this tag should either be a BulletML
  141. math expression, e.g. a non-negative integer, or it should be the
  142. string ‘infinite’.  Using the string ‘infinite’ in conjunction with
  143. <repeat> will ensure that the engine never stops executing the
  144. associated action.
  145.  
  146. -->
  147. <!ELEMENT times (#PCDATA)>
  148.  
  149. <!-- <term>
  150.  
  151. A BulletML math expression representing a number of frames.  Other
  152. tags use this as a child node to describe how much time should pass
  153. during a certain event, e.g. changing the speed of a bullet.  Pattern
  154. files should assume the engine runs at sixty frames per second and
  155. write values for <term> accordingly.
  156.  
  157. -->
  158. <!ELEMENT term (#PCDATA)>
  159.  
  160. <!-- <wait>
  161.  
  162. A BulletML math expression indicating how many frames the engine
  163. should wait.  For example, ‘<wait>60</wait>’ will pause the action in
  164. a pattern for one second.
  165.  
  166. -->
  167. <!ELEMENT wait (#PCDATA)>
  168.  
  169. <!--  <fireSimulatenously>
  170.  
  171. This element lets us group together multiple <fire> nodes into a
  172. single entity so that a pattern can shoot more than one bullet at the
  173. same time.
  174.  
  175. -->
  176. <!ELEMENT fireSimulatenously (fire+)>
  177.  
  178. <!-- <action>
  179.  
  180. An <action> tag is the primary way that a pattern describes actual
  181. bullet behavior.  While the <bullet> tags define *what* builds a
  182. pattern, the <action> tag defines *how* the pattern works.  The
  183. <action> tag accepts a large number of optional tags to help control
  184. what the pattern does.
  185.  
  186. An <action> tag may have a ‘label’ attribute giving it a name.  Later
  187. the pattern may refer back to this action by using that name.
  188.  
  189. The optional ‘difficulty’ property lets designers ensure the game only
  190. executes the action on a certain difficulty level.  This makes it
  191. possible to create patterns like boss attacks with very different
  192. behavior based on difficulty.  By default the property has the value
  193. of ‘Any’, which means to execute that action under any difficulty.
  194.  
  195. -->
  196. <!ELEMENT action (
  197.          changeDirection? |
  198.          accel?           |
  199.          vanish?          |
  200.          appear?          |
  201.          changeSpeed?     |
  202.          changeDamage?    |
  203.          repeat?          |
  204.          wait?            |
  205.          (fire | fireRef  | fireSimultaneously) |
  206.          playSound?       |
  207.          (action | actionRef)?
  208.          )*>
  209. <!ATTLIST action label CDATA #IMPLIED>
  210. <!ATTLIST action difficulty (Love|Easy|Normal|Hard|Hate|Any) "Any">
  211.  
  212. <!-- <playSound>
  213.  
  214. This tag accepts the path to a sound effect and creates an instruction
  215. for the game to play that sound at that point in the pattern.
  216.  
  217. -->
  218. <!ELEMENT playSound (#PCDATA)>
  219.  
  220. <!-- <vanish> <appear>
  221.  
  222. These two tags cause all bullets in the current action to vanish or
  223. reappear on screen, respectively.  These tags cannot have children.
  224.  
  225. -->
  226. <!ELEMENT vanish (EMPTY)>
  227. <!ELEMENT appear (EMPTY)>
  228.  
  229. <!-- <speed>
  230.  
  231. The number of pixels the bullet will move in one tick.
  232.  
  233. -->
  234. <!ELEMENT speed (#PCDATA)>
  235. <!ATTLIST speed type (absolute|relative|sequence) "absolute">
  236.  
  237. <!-- <size>
  238.  
  239. This takes an integer which determines the size of the bullet.  It
  240. is only valid if the <shape> of the bullet is ‘circle’.  Otherwise the
  241. value has no meaning.
  242.  
  243. -->
  244. <!ELEMENT size (#PCDATA)>
  245.  
  246. <!-- <shape>
  247.  
  248. This defines the shape of the bullet.  The default is ‘circle’, which
  249. the game engine enforces.  See the document
  250.  
  251.    docs/Patterns.txt
  252.  
  253. for a list of the valid shapes.
  254.  
  255. -->
  256. <!ELEMENT shape (#PCDATA)>
  257.  
  258. <!-- <scale>
  259.  
  260. Contains a numeric value indicating how to scale the bullet image
  261. horizontally and vertically.  The format allows positive and negative
  262. numbers.  This tag only makes sense in the context of a bullet that
  263. also has
  264.  
  265.    <shape>image</shape>
  266.  
  267. as part of its definition.  Because we draw all other shapes with
  268. primitive drawing routines where scaling is not a factor.
  269.  
  270. -->
  271. <!ELEMENT scale (#PCDATA)>
  272.  
  273. <!-- <image>
  274.  
  275. A filepath to the image to use for this bullet.  The filepath must be
  276. relative to the top level of the project directory.
  277.  
  278. -->
  279. <!ELEMENT image (#PCDATA)>
  280.  
  281. <!-- <shader>
  282.  
  283. Can contain GLSL 1.2 code that the game will use as the shader for the
  284. bullet.  This is only used if the <shape> is ‘image’.  The code should
  285. be wrapped in <![CDATA[[ … ]]> tags for the sake of ease.  See the
  286. wiki page
  287.  
  288.    https://love2d.org/wiki/love.graphics.newShader
  289.  
  290. for more information of the shader language the engine uses.
  291.  
  292. -->
  293. <!ELEMENT shader (#PCDATA)>
  294.  
  295. <!-- <color>
  296.  
  297. Contains three child nodes which each contain integer values in the
  298. range of zero to two-hundred fifty-five.  These define the color of
  299. the bullet.
  300.  
  301. -->
  302. <!ELEMENT color (#PCDATA)>
  303. <!ATTLIST color red   CDATA #REQUIRED>
  304. <!ATTLIST color blue  CDATA #REQUIRED>
  305. <!ATTLIST color green CDATA #REQUIRED>
  306.  
  307. <!-- <horizontal>
  308.  
  309. Specifies acceleration in a horizontal line, where the contents are a
  310. BulletML math expression indicating the direction.  The number is a
  311. degree.  Values for the ‘type’ attribute have the same semantic
  312. meaning as the same-named parts of <direction/>.
  313.  
  314. -->
  315. <!ELEMENT horizontal (#PCDATA)>
  316. <!ATTLIST horizontal type (absolute|relative|sequence) "absolute">
  317.  
  318. <!-- <damage>
  319.  
  320. This element contains an integer which describes the amount of damage
  321. a bullet causes on impact.  For example, if the value is five then the
  322. bullet would take away five health from an enemy, or from the player’s
  323. ship if an enemy fires the bullet.
  324.  
  325. The value may also be a BulletMLX expression with math operators and
  326. variables, e.g. “4 * ($rank - 1) + $1 + $2”.
  327.  
  328. By default a bullet has a damage value of one.
  329.  
  330. -->
  331. <!ELEMENT damage (#PCDATA)>
  332.  
  333. <!-- <persistent>
  334.  
  335. If true, this bullet will persist after hitting a target.
  336. Note that it is up to the game engine to decide which targets persistent
  337. bullets will actually persist after hitting. For example, the game
  338. developer may decide that the persistent tag will make player bullets
  339. travel through multiple enemies, but stop if it hits terrain.
  340.  
  341. By default, bullets do not persist.
  342.  
  343. -->
  344. <!ELEMENT persistent (#PCDATA)>
  345.  
  346. <!-- <bullet>
  347.  
  348. Represents a type of bullet.  The element has a large number of
  349. potential children which describe the various properties of bullets.
  350. If a bullet has a value for the ‘label’ attribute then other parts of
  351. a pattern can use a <bulletRef/> node to refer to that bullet, which
  352. is useful for re-use.
  353.  
  354. -->
  355. <!ELEMENT bullet (damage?, direction?, speed?, size?, shape?, color?, image?, scale?, shader?, (action | actionRef)*)>
  356. <!ATTLIST bullet label CDATA #IMPLIED>
  357.  
  358. <!-- <direction>
  359.  
  360. Indicates direction as a BulletML math expression which must be in the
  361. range of zero to three-hundred sixty, i.e. a degree.  The ‘type’
  362. attribute affects the interpretation of that value.  See the
  363. documentation in
  364.  
  365.    docs/Patterns.txt
  366.  
  367. for a description of the semantic meanings of direction types.
  368.  
  369. -->
  370. <!ELEMENT direction (#PCDATA)>
  371. <!ATTLIST direction type (aim|absolute|relative|sequence) "aim">
  372.  
  373. <!-- <changeSpeed>
  374.  
  375. Changes the speed of a bullet to the value in <speed> after <term>
  376. number of frames.
  377.  
  378. -->
  379. <!ELEMENT changeSpeed (speed, term)>
  380.  
  381. <!--  <changeDamage>
  382.  
  383. Changes the damage which a bullet does to the value of the <damage>
  384. child after <term> number of frames.  If an action uses multiple
  385. bullets then this will change the damage of all of them.
  386.  
  387. -->
  388. <!ELEMENT changeDamage (damage, term)>
  389.  
  390. <!-- <offset> <x> <y>
  391.  
  392. This element lets us define the offset for a given <fire> action.  The
  393. child <x> and <y> tags, which are both optional (defaulting to zero),
  394. contain integers which tell the engine to shoot all bullets in the
  395. <fire> node as if their origin uses the given offsets.  For example,
  396. an offset of ‘<x>10</x>’ would cause the bullets to appear ten pixels
  397. to the right of the pattern’s origin.
  398.  
  399. These offsets are always *relative* to the origin of the pattern, and
  400. the pattern origin is never inside an actual pattern XML document.
  401. Therefore it remains impossible to create bullets in absolute screen
  402. positions within a pattern definition.
  403.  
  404. -->
  405. <!ELEMENT offset (x?, y?)>
  406. <!ATTLIST offset label CDATA #IMPLIED>
  407. <!ELEMENT x (#PCDATA)>
  408. <!ELEMENT y (#PCDATA)>
  409.  
  410. <!-- <offsetRef/>
  411.  
  412. This refers to an <offset> with a given label.
  413.  
  414. -->
  415. <!ELEMENT offsetRef (param*)>
  416. <!ATTLIST offsetRef label CDATA #REQUIRED>
  417.  
  418. <!-- <fire>
  419.  
  420. Tells the engine to fire a bullet, which can either be a new <bullet>
  421. or a <bulletRef/> that references an existing bullet.  A <fire> node
  422. can have a label for use with <fireRef/> later, but our particular
  423. implementation of BulletMLX currently ignores <fireRef/>.
  424.  
  425. -->
  426. <!ELEMENT fire ((bullet | bulletRef), direction?, speed?, (offset | offsetRef)?)>
  427. <!ATTLIST fire label CDATA #IMPLIED>
  428.  
  429. <!-- <bulletRef>
  430.  
  431. Refers to a pre-existing <bullet> definition and uses it as if that
  432. <bullet> definition were in place of the <bulletRef/>.  This behaves
  433. the same way as <actionRef/>, so looking at its documentation may also
  434. be helpful.
  435.  
  436. -->
  437. <!ELEMENT bulletRef (param*)>
  438. <!ATTLIST bulletRef label CDATA #REQUIRED>
Advertisement
Add Comment
Please, Sign In to add comment