Creating bullet patterns with XML in GM:S

A place for people with an interest in developing new shmups.
Post Reply
Robohobobro
Posts: 2
Joined: Tue Jul 28, 2015 8:32 am

Creating bullet patterns with XML in GM:S

Post by Robohobobro »

Hello!

I'm currently working on a cute'em'up that I've been building from sort-of scratch (in the sense that I didn't use any ready-made engine) in Game Maker: Studio (devblog here, if anyone's interested). It's my very first game and this has been quite the learning experience, especially since I have no background in coding before this. I've managed to get quite a bit done, but creating bullet patterns has proven to be a bit of a hurdle for me.

I tried dicking about in GM myself and managed to create a little spinning pattern using a DIY "emitter" object, but nothing more complex than that. I searched these forums a bit and managed to find a few threads concerning patterns, but they were a bit old, and the GM examples were outdated. However, someone mentioned using XML for the patterns and using BulletML. I looked into it and it seems mighty useful. Problem is, I have no idea how to use XML in GM. I understand you need an XML parser for it, but googling and searching around in the GM forums yielded results that were either old or didn't explain actually HOW to use a parser.

So, my question is, how does one actually use an XML parser in GM:S? And are there any particular parsers you might recommend using?

(Bonus question: Or is there a different, better way of creating bullet patterns in GM:S?)

Thank you for your help!
JSimmons
Posts: 5
Joined: Wed Oct 14, 2015 2:49 pm

Re: Creating bullet patterns with XML in GM:S

Post by JSimmons »

Not that there's anything wrong with using a fully featured engine, but using GMS (Gamemaker Studio) is definitely not making anything from scratch. You have a workflow and framework, built with years of iterative work, already set out for you.

If you're looking for something to do yourself and learn from, you could create your own bullet language. Here's a quick example. They're all strings because if I remember correctly, GM swaps between variable types dynamically for ease of use.


{
Frame = "0",
Type = "Fire",
Scale = "1.1",
Speed = "5",
Angle = "10"
}
...
And so on. Figuring out how to parse it is one half, the other is deciding on a structure. Of course, you could add more fields and special effects as you need to. The next step (Or maybe the first step) would be to create a visual tool to design these bullet patterns that exports to your custom format. Hell, you could ship it with your game as a level editor.

I can point you in the right direction if you have some specific questions.
User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

Re: Creating bullet patterns with XML in GM:S

Post by BPzeBanshee »

As long as the examples you found make use of GML (which has more or less retained syntax for a significant amount of time as JSimmons implies) they should all still work. GMOSSE doesn't run in Studio yet but the bullet scripts certainly do, just to name one example. Scripts ARE going to be key for you to making decent patterns, since they'll serve as macros to help you not duplicate code all over the place, and BulletML is essentially a very advanced, intricate script system.

My concern with you trying to use BulletML though is that from what I understand it's meant for advanced patterns that make use of large arrays of bullets, which right now may be over your head. Certainly later on when you get the hang of doing basic patterns it will prove worthwhile for things like bosses but it's more important that you know how to manipulate a bullet object in GM and know your parent/child relationships first. Think of it as building blocks - once you get this far you may even find that BulletML is unnecessary.

The other issue is as you say, parsing the XML. It's doable but I wonder whether it's worth the gains from it. Certainly there are parser extensions available on the GMC forums for you to try and make use of it and there was a few projects here in Development that attempted (rather successfully if memory serves) to make use of it.
They're all strings because if I remember correctly, GM swaps between variable types dynamically for ease of use.
GM's "var" element can be either a string or a "real" value (you don't need to declare it as int,string,etc) but you still need to convert them to the implied type if you intend to use them in actual functions, so you couldn't do instance_create using strings directly nor could you do draw_text with reals in the string value reliably but you could process those elements into something more usable, which BulletML and some projects shown here in the past that make use of BulletML in GM are purposed for.
Post Reply