Tuesday, September 11, 2018

Gamemaker paths "orient" (rotate) around ZERO not their first point.

So, I was making some paths for my enemies to follow, specifically, a path that sort of looks like a bouncing ball. I said soft of. It's Graph Paper Shooter, not a ball bouncing simulation.

Since it was so simple, I just started drawing on the path editor.
I was not careful to make sure my first point was zero. That led to some unexpected behavior.

The idea was that these particular enemies would leave the spawner and orient their path such that it pointed in the general direction of the player. For this to work, I needed to set the variable "path_orientation" after I told the object to start following the path.

Here's the thing: when setting path_orientation in GMS2, the path will rotate around the 0,0 point (x=0, y=0) as defined when the path is created in the editor. It does not rotate or orient around the first point of the path, as you might expect. The documentation for path_orientation does not mention this. The docs for path_rotate (an actual function) mention this, but path_rotate rotates the original path object, not the path you're using.

So, just a heads up. When you use path_orientation and your paths are going completely the wrong direction, check that your path starts at the origin.

Sunday, August 26, 2018

Changelog for August 26, 2018

It's been a heck of a week, family health issues have kept my busy pretty much up until the weekend.

The weekend has, however, been productive:
  • Complex enemy pathing has been implemented
    • This took the bulk of the time, deserves its own blog post
    • Enemies will now go around complex obstacles and room shapes to get at the player
  • Irregularly shaped rooms are now an option and have been implemented
    • More work than it sounds like :-)
  • Completely rewrote player movement code 
    • no more "bouncing" off walls
    • if moving at an angle the player will slide across the wall in the non-blocking direction
  • Player and enemy bullets now asplode when hitting walls
  • Enemies no longer fire if they're not facing in your general direction
    • will still fire at walls though. 
    • They are stupid
  • New hidden wall type to keep the player from cheesing bosses (by sneaking behind them)
    • Can fire through these
  • Added "Robbietron" tileset and enemies
    • Uncolored boss is drawn:

  •  Added four (so far) irregularly shaped rooms, including what is probably the most annoying one ever, the "five minute hallway". 
    • takes about 400 health ticks to traverse the entire width of the room. 
  • Added configurable backgrounds based on dimension (space, desert, tanktankzombie, etc)

Wednesday, August 15, 2018

Changelog for August 15, 2018

  • Still stuck on Polygon of Horror fight design, so doing other things...
  • Got started on the "tanktankzombie" boss fight - "TANK TANK....SUPERTANK"

    • I may add a "?" to the end of the title. First I have to draw it (and all the other punctuation, which is on the todo list)
    • brought super tank artwork into GMS2
    • created title screen
    • tank shoots giant bullets at you. whoopdedoo. 
      • it's a start

  • Generalized boss room startup code
    • setting common variables
    • drawing the boss health bar
  • Made minor changes to health management script so that bullets values aren't static
  • Minor adjustments to the boss_dead screen - still not happy with it
    • Now it just says "NICE" gps-style with all the dead monsters splatted on top of "NICE";
  • Minor adjustments to the Mr. Cortmander boss fight - you can't cheese him by climbing under his desk anymore.
  • Colorized all of the text with screens using GPS-style text
  • interstitial rooms no longer tick off your health or show the score UI
  • Completed the Options screen:
    • music volume
    • sfx volume
    • full-screen mode (yes/no)
  • Decided on a new Dimension: 
    • filled with crap you find outside (you know: bitey critters)
    • Boss: THE SUN.
      • It should never be 102 degrees in Helena MT.
      • I wanna kill the sun.
  • Not playing World of Warcraft (everyone else in the house is) 

Monday, August 13, 2018

From paper to living enemy

I am not a very good artist. My line control is unstable. My circles are rarely round. And while I can use graph paper to make geometric shapes that are based on moving from square to square, I have difficulty making free-form drawings that are in any way symmetrical.

So, I fudge it. For something like the spider queen, I drew one half of the queen until I was happy with it, and mirrored it.
First I drew her on lined paper, then scanned it in.
Next step is to use paint.net to turn her into a monster.
The four images above are:
  • The original scan
  • the original scan minus the paper lines
  • Then I mirrored the original image 
  • Then I colored it
Then I "animated" the "test", by making a bunch of frames where they were in different positions, and the result is thus:
For the "Polygon of Horror", the boss is protected by shield generators that look like this:
They spin. And you might notice that it's more or less perfectly symmetrical. 

  • Drew just the one arm as two separate pieces
  • Scanned it in
  • pulled the paper lines and artifacts out of the image
  • Then I assembled the two pieces as separate layers
  • Then copy/pasted the arm 3 times adding 90-degree rotation each time (for a total of 8 layers)
  • Then I started coloring it in.
  • The smaller center piece is just a scaled down copy of the the outer piece
  • The center circles are little bit of cheating,
  • I didn't actually draw those by hand, but rather decided once it was in the game that it needed a little "ejector" from which nastiness (for the player) will spawn.

Saturday, August 11, 2018


So, I'm working on the boss fight for the "Polygon of Horror" where the boss and the shield generators have shields up part of the time. The player ship needs to bounce off of them. Since this is a twin stick shooter and not a platformer, collision detection and behavior need not be complex. In fact, it needs to be simple.
And it has been up to now. Simple, but tedious. On wall collisions, the player object was literally checking to see which wall object it was hitting and then acting accordingly. This involved putting "left" walls on the left of the room, "bottom" wall on the bottom of the room and so on.

It was not, how you say in America, a general solution.

Well, for a round object like a shield, this is obviously not going to work, so I had to come up with something else. And I did:
//get the center of the object I just collided with
px =other.x
py =other.y

//get the difference in position between my center and that of the object
tx = x - px;
ty = y - py;
//get the sign of that difference
sx = sign(tx);
sy = sign(ty);
//get the X to Y ratio of the line between the two points
//in absolute terms
ar = abs(tx/ty);
at = abs(ty/tx);

//assign a new location "15" ish pixels from the collision in the opposite direction
x += sx * (min(15, 15 * ar))
y += sy * (min(15, 15 * at));
//YAY, no trigenometry

When the player collides with an object now, I run the above and it bounces 15 or so (will tweak it later) pixels in the opposite direction. I could probably get it down to like 4 lines of code, but this is actually readable.

 Next, I created a single collidable wall object (instead of four) and surrounded the room with it:
 Those grey blocks (which are invisible at run time) are all identical, and the code to deal which each is exactly the same. Th exact same code is used on the shields in the boss level:
This also means that I can finally get around to having the player ship actually collide with the enemy spawners (to their detriment)

Friday, August 10, 2018

What I'm working on right now....(8/10/2018)

Normally, I'd post a change log for today's date, but nothing that I'm working on is actually done yet.

Right now, I'm working on the boss fight design for the Polygon of Horror boss fight.
This has required learning about the realities of dealing with paths in GMS2. Maybe I'll go into that another time. Now that I've got it down, there will be lots of bullet hells :-) And...more than likely, a much needed design on the "Mr. Cortmander" boss fight.

Since I want the shield generators (in the corners) to also spawn enemies, I had to generalize the enemy spawn code  and turn it into a function. Previously, it was only run by the enemy spawner, so it's not a case of "had the code in a bunch of places", but rather a case of "I totally do not want this in two places". There's some complicated crap going on in there. So, now things other than "spawners" can spawn enemies.

Also, while I was at it, I decided that I wanted the player ship to bounce off the shields around the generators and the boss. So I spent about an hour working out a generalized solution to bouncing the ship off of stuff. Such as the walls. Right now, the ship checks to see if the ship has a hit a "left wall", and if so, moves to the right. If it hits the "right wall", it moves left.

The new code figures out where to bounce the ship to based on the difference in the location between the center of the ship and the center of the object it just hit. This gives me the information I need to figure out which direction the ship needs to bounce. On on the one hand it means I have to put more (hidden) "wall objects" on the borders of the rooms. On the other hand, it means that they can all just be the same kind of object and only one collision check, which is now generalized, needs to be run.

Have also been working on new art for powerups, new monsters, and the elements of the boss fight shown above. Showing off the new monsters will have to wait until I put together some web friendly image strips.

And finally, the inter-dimensional interstitial has been redesigned. Now it just randomly splats all the critters you've killed on that level all over the screen. Kind of like how the "Next Dimension" screen does it - but, to be clear - one picture for every single enemy killed.

Wednesday, August 8, 2018

Change Notes for August 8, 2018

  • Interstitials
    • Next Up:
      • Shows you what's going to happen on the next dimension
      • Floor and wall art change to match what's up coming
      • random enemies from the upcoming level are thrown at the screen.
      • May decide to animate them in the future. May not.
    • End of Dimension
      • Shows you a visual representation of all of the critters you've killed
      • Not sure I like it.
      • If I do, then on the sound design phase, I'll change it so they show up "one at a time" which a stomping noise. Or maybe once stomp for each type of enemy.
        • yeah, that seems more likely, otherwise, we'll be here all day.
  • Fix a few bugs:
    • The dimension picker was all messed up
      • I was trying to be too clever when I first wrote it
        • If the code you write is at the limits of your cleverness, then you are, by definition, too stupid to debug it.
        • I was.
      • Had to rewrite it from scratch
        • Actually works now
      • At game start, it shuffles the list of available dimensions.
      • You'll go through that list until you've seen them each once.
      • Then it reshuffles.
      • So, the last of one complete run and the first of the next could be the same, otherwise, you won't see duplicates.
    • Found another "script_execute" bug or three.
      • Had my functions calls formatted wrong which resulted in some odd behavior.
      • Will do a dev-blog post on this as it's an interesting GMS2 specific behavior
    • My point-defense upgrade for the missile rig was setting the score rather than adding to it (= rather than +=)