Author Topic: Making a Roguelike in Gamemaker  (Read 42001 times)

guest509

  • Guest
Making a Roguelike in Gamemaker
« on: April 15, 2013, 03:30:12 AM »
I have used Gamemaker for a few years to make games, I really like it. Quick to use and powerful. At it's core though Gamemaker is a real time movement and collision engine, with a bunch of built in bells and whistles. Since Roguelikes are turn based there can be some difficulties with passing turns, but other than that things are pretty easy.

My turn based system is a bit wonky, but Geminosity (who made Nya Quest this year) put together a turn system using stack and ques and other built in data structures. I dunno how to do that but the ability is there.

I use a ton of inheritance with Gamemaker, it seems to work better. I've never had to use scripts (I think 'C' programmers would call them 'functions').

Here is a run down of the objects you need to make a straight roguelike, one similar to Rogue or my own KlingonRL

-Controller: This object is placed in the room and used to call all over objects. This will alleviate the issue of accidentally calling variables that don't exist. Also, put all global variables in this object so they are always available.

-Overworld_Builder: If you have an overworld, this will build it.

-Level_Builder: This object will carve the architecture and populate the dungeon. I actually call this object in each room and then save the room state. So if there are 27 levels, I use 27 rooms. If you don't want persistent levels for some reason you can just reset the same room over and over and have this object build you a new level each time you hit the stairs.

-Player: Stats and movement and what not are all handled in this object. When the player's move fails because the space he is moving to is occupied, call the Bumper object and place it at the collision site.

-Bumper: This is a temporary object that you place on any space where there was a collision.

-Walls: Simple object with no real behavior. The Player object's movement will fail if they try to more into a wall object.

-Baddie_Parent
: All movement and behavior of the bad guys is handled here. Each new enemy type is a child of this base type. When you make a new enemy simply alter the stats and abilities in the 'create' event, set an appropriate sprite and bam you have a new enemy type. 

-Door
: Reacts to the Bumper object by opening. You can also have it react to a 'close' command (press 'c') if the player is adjacent. Basically this object has 2 states, solid or not solid, and changes sprite from '+' to '-' depending on its state.

-Trap_Parent: Activates when it collides with the Player object. Different types will be descended from this base type.

-Stairs: Simple object. If the Bumper touches it, then descend.

So that's about all you need, the basics. I was able to code up a fairly robust system like this in just a couple of days. My enemy behavior was a bit weak though, only 2 real states. State 1, where it sees the player or state 0 where it doesn't. If it has weapons it chases the player if it sees the player, if it doesn't have weapons it runs away. Otherwise just wander about, changing directions every so often.

Is anyone out there even using Gamemaker besides Gem and I? Gamemaker 8.1 lite can easily be used to make a roguelike using the above outline, and that one is free here:

http://www.yoyogames.com/gamemaker/windows

guest509

  • Guest
Re: Making a Roguelike in Gamemaker
« Reply #1 on: April 15, 2013, 03:57:13 AM »
Ah crap. I just found the built in A* motion planning functions. I'd written up my own crappy pathfinding/chase algorithms for KlingonRL, but there are built in ones that use A*. I feel dumb.

NON

  • Rogueliker
  • ***
  • Posts: 349
  • Karma: +0/-0
    • View Profile
    • Infra Arcana
    • Email
Re: Making a Roguelike in Gamemaker
« Reply #2 on: April 15, 2013, 04:56:54 AM »
Doesn't placing a ton of wall objects slow the game? I haven't used Game Maker since ~2009, but I recall there was some issue like if you place an object, there will be a lot of added operations even if the object doesn't do anything itself (it will be checked for bumping events for example, things like that). My experience was that you could make a far more complex and more optimized game by representing the map as arrays of integers or something like that.
Happy is the tomb where no wizard hath lain and happy the town at night whose wizards are all ashes.

guest509

  • Guest
Re: Making a Roguelike in Gamemaker
« Reply #3 on: April 15, 2013, 06:22:20 AM »
Oh maybe, I've never encountered it. I've had an @ moving around on a 200x200 tile screen, each tile 16x16 and had no problems in Gamemaker 8.0, and the new Studio version is several times faster. If there starts to be performance issues you can shut off things that are off screen. Spelunky does that, the bad guys freeze off screen. There are hacks of Spelunky where the entire level is displayed on one screen, with all the bad guys and assorted objects checking their events. A modern computer has no problem with it, and that was made in the old Gamemaker, before the recent super charged rewrite Gamemaker:Studio.

I've recently messed around with an RTS engine with hundreds of fully animated objects running around using pathfinding algorithms on a complex map. No issues at all.

I might be mistaken, but it looks like only objects changing position check for collision anyway. Also I have no collision events in the wall objects, the collisions are checked only in the Unit, Enemy and Bumper objects. If there ends up being performance issues then I'll stop checking collisions and just start checking positions.

You can optimize the heck out of things if you want, but I've never needed to. The slowest thing I've seen are the room transitions, but you actually want those to take a moment to switch up so you don't disorientate the user.

guest509

  • Guest
Re: Making a Roguelike in Gamemaker
« Reply #4 on: April 15, 2013, 06:28:19 AM »
Also I want to point out I'm only a midling Gamemaker user. Some of the more advanced data structures (anything beyond a 2d array) and file i/o are currently out of my skill zone.

ExtremoPenguin

  • Newcomer
  • Posts: 19
  • Karma: +0/-0
    • View Profile
    • Entropy Interactive
Re: Making a Roguelike in Gamemaker
« Reply #5 on: April 17, 2013, 01:26:37 AM »
Speaking of GameMaker, I bought it a while ago when it was on sale on Steam. I played around with a little, but was a bit lost. Do you know of any good tutorials for GM / how did you learn GM?

guest509

  • Guest
Re: Making a Roguelike in Gamemaker
« Reply #6 on: April 17, 2013, 05:42:01 AM »
There are a ton of great tutorials. Go through these one by one and you'll be ready for anything. I only got through the first 5 to be honest.

http://sandbox.yoyogames.com/make/tutorials


Then you need to learn GML, which you can learn from the Help system in Gamemaker: Studio once you know the basics of how the program works. It helps if you have a coding background.

getter77

  • Protector of the Temple
  • Global Moderator
  • Rogueliker
  • *****
  • Posts: 4957
  • Karma: +4/-1
    • View Profile
Re: Making a Roguelike in Gamemaker
« Reply #7 on: April 17, 2013, 11:49:33 AM »
Triangle Wizard is made in one of the older GameMaker versions with a lot of tweaking done to it, as was the old Spelunky, so odds are high the actual current one is indeed up for such tasks.
Brian Emre Jeffears
Aspiring Designer/Programmer/Composer
In Training

Darren Grey

  • Rogueliker
  • ***
  • Posts: 2027
  • Karma: +0/-0
  • It is pitch black. You are likely to eat someone.
    • View Profile
    • Games of Grey
Re: Making a Roguelike in Gamemaker
« Reply #8 on: April 17, 2013, 01:00:58 PM »
Though it may be up to the task I have to say it sounds a lot more painful to work with than the T-Engine or rot.js.  So much roguelike-relevant stuff comes out of the box with them.  They're don't have as good tutorials and things as GameMaker, but once you get past the initial hurdle many other things are much easier.

Still, it's a perfectly viable platform for game-making.  It's funny how many people building their own engines scoff at GameMaker, even though many of them haven't managed to make a game since they get so bogged down in the architecture stuff...

K.I.L.E.R

  • Newcomer
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Making a Roguelike in Gamemaker
« Reply #9 on: April 17, 2013, 02:10:39 PM »
    Though it may be up to the task I have to say it sounds a lot more painful to work with than the T-Engine or rot.js.  So much roguelike-relevant stuff comes out of the box with them.  They're don't have as good tutorials and things as GameMaker, but once you get past the initial hurdle many other things are much easier.

    Still, it's a perfectly viable platform for game-making.  It's funny how many people building their own engines scoff at GameMaker, even though many of them haven't managed to make a game since they get so bogged down in the architecture stuff...

    You must be speaking about me. I will pick up on this point and go with it.

    GameMaker:Studio lets you construct prototypes very quickly, and a roguelike can be constructed in as little as two controller objects and a player.
    • World Controller - World generation -> Random generation
    • AI Controller - AI entity generation -> Randomly move in an area (x,y,w,h), ram into player, and clean up hp <= 0
    • Player - Your controls, UI, all your draw functionality can be placed in here

    Outside of this you just create a font and use drawtext with colours and whatnot across all areas.

    Made a very quick roguelike in 15 minutes with some simple swarm behaviour and a HUD.

    EDIT: Can not remove the [/list] tag, keeps coming back with 'Save'.
    « Last Edit: April 17, 2013, 02:12:51 PM by K.I.L.E.R »

    guest509

    • Guest
    Re: Making a Roguelike in Gamemaker
    « Reply #10 on: April 17, 2013, 05:35:18 PM »
    You see that's the thing Darren, T-Engine just seem very hard to get into. It needs a good tutorial or something that come right with the Engine.

    With Gamemaker basically anything I ever wanted to code has already been done and posted online for me to see.

    Not saying GM is any better for making a Roguelike than T-Engine, but there's definitely less learning curve.

    K.I.L.E.R

    • Newcomer
    • Posts: 12
    • Karma: +0/-0
      • View Profile
    Re: Making a Roguelike in Gamemaker
    « Reply #11 on: April 17, 2013, 05:40:42 PM »
    My issue with T-Engine after the initial "WTF do I do?" phase was that dependencies can be in multiple areas, meaning modifying one thing requires you to go modify other files, which is really annoying.

    Another engine I enjoyed is RPG Maker Vx Ace, as it uses Ruby 1.9.3, and you can completely overhaul the game to make it not recognizable as most RPG Maker games are, and on top of that you can pull Ruby code off Github and use it within the game. I have yet tried multithreading in RPGMaker, but there is no reason why you can not pull satellite telemetry data in real time to generate tiles in a map.

    Geminosity

    • Newcomer
    • Posts: 9
    • Karma: +0/-0
      • View Profile
    Re: Making a Roguelike in Gamemaker
    « Reply #12 on: April 17, 2013, 09:18:44 PM »
    My current approach for "Nya's Yarn" (the new version of Nya Quest) in Game Maker is that i have a 'game' controller that does the AI and turns (all objects store a function they'll execute once the player does something and it decides what to do next time only once it's been executed and cleared.) The player is locked out of controls until everything has finished acting to maintain a robust turn structure :3
    Map generation is done by scripts run in the room startup to save me needing a seperate object for it.

    I also don't have any collision in the current version (I just store the map as a grid of numbers and whenever something tries to move to a square it checks that it's a 0 first and if it's not it'll react appropriately based on the ID number in that square :D )

    In Nya Quest, I didn't have that all setup so I just had a queue on the player object that the enemies would add their actions to and it would run through it and execute them all whenever the player acted. It's not quite as efficient because it basically adds the extra step of all the enemies accessing the player to store their flag on the queue, while the new method i botched together just queries them when the time comes. It also has potential problems of the player acting before something has time to add stuff to their queue, though I haven't seen this happen during any games of Nya Quest so far :o

    As for game maker itself there should be a free version of studio on steam. I was trying that before I upgraded to the pro version for super cheap during a sale so there's no real major need to use 8.1 unless you want to :3

    edit: to add to the list of tutorials that Jo's kindly linked, I recommend Derek Yu's posts too (he of spelunky fame :3 ) as it not only covers all the basics you'll need to make any kind of game in Game Maker, but also explains a few vital concepts like objects, inheritance and whatnot.

    part 1
    part 2
    part 3
    part 4

    Enjoy! :D
    « Last Edit: April 17, 2013, 09:27:15 PM by Geminosity »

    guest509

    • Guest
    Re: Making a Roguelike in Gamemaker
    « Reply #13 on: April 17, 2013, 09:38:01 PM »
    Nice Gems!

    Note he covers how to create your own FONT in section 4. Seems a bit obscure for a beginner tutorial but definitely something of interest to the roguelike crowd.

    guest509

    • Guest
    Re: Making a Roguelike in Gamemaker
    « Reply #14 on: April 20, 2013, 05:20:45 AM »
    I feel like a bone head. I just discovered the 'with' and 'other' commands.

    It can be used to easily settle 'bump' events. For example

    If it's the player's turn and he bumps a bad guy, you can do a simple collision event for the bad guy, and take his HP away. Like this...Bad_Guy_HP = Bad_Guy_HP - other.Attack_Value.

    Likewise when the baddies are going you can do similar against the player.

    This will stop you from needing to create a 'bump' object and reading stuff in I think.

    This works I think...anyone know about the 'other' command?