• Hello, Guest! Welcome back, and be sure to check out this post for more info about the recent service interruption and migration.

Help getting started with retro software development

nightingale

Well-known member
So I will post the level editor, but first I want to figure out what was causing that bug where the last tile was an incorrect value that caused the game to crash. I manually fixed all the levels in ResEdit, but once I patch the map editor I will post it as well, in the next few days.
 

olePigeon

Well-known member
I suggest you add a dialogue box that pops up when you first open it. Donate $5 if you like the game. Good ol' shareware. :)
 

nightingale

Well-known member
I was thinking a pop up that tells you to mail $5 along with a postage paid return envelope to send you a code to remove the pop up. Really keep it authentic.
 

nightingale

Well-known member
So, lots of progress and updates since the last post! I've added a bunch of new enemies and features, and squashed a lot of bugs. I'll post another demo soon for anyone who is interested.

One thing I'm not quite sure how to deal with is overcoming the keyboard repeat rate which is set in the keyboard control panel. To start, I just went with the default keyDown and autoKey events to handle movement of the player character. The trouble with that is depending on how you set the repeat delay and repeat rate in the control panel, holding down an arrow key will either make the player movement very slow or very fast. I would like to control the speed of the player character, and also time movement with movement of other game mechanics.

What I have tried, with some success, is just setting the keyDown event to initiate continuous movement in the specified direction, and then used the keyUp event to stop all movement. This works quite well for achieving the speed and movement rate I want, but I've found it's very unreliable. Any key up event will stop movement entirely, so if you quickly switch between going up to going left, for example, and you hit the left key before releasing the up key, then releasing the up key will stop movement, even though you are holding down the left arrow.

The reliability of just using the keyDown and autoKey events was much smoother, but I lose the control I want. Is there a more elegant way of overcoming the control panel settings for my specific application without affecting the rest of the system? I would imagine this is a fairly common problem to overcome with games, as you wouldn't want players to gain or lose a speed advantage by setting a control panel item.

Anyone have any ideas?
 

joshc

Well-known member
I suggest you add a dialogue box that pops up when you first open it. Donate $5 if you like the game. Good ol' shareware. :)
I was thinking a pop up that tells you to mail $5 along with a postage paid return envelope to send you a code to remove the pop up. Really keep it authentic.

Or make it postcardware for that ultra retro feel...

See https://postcardware.net/ for an archive of the postcards received by Aaron Giles, the author of JPEGView.

I'll post another demo soon for anyone who is interested.
I'm interested. Happy to help test, mostly on OS 9.2.2 on a G4 as that's the only classic Mac I have setup properly at the moment. (assuming you want to support something that 'late').
 

Crutch

Well-known member
One thing I'm not quite sure how to deal with is overcoming the keyboard repeat rate which is set in the keyboard control panel. To start, I just went with the default keyDown and autoKey events to handle movement of the player character. The trouble with that is depending on how you set the repeat delay and repeat rate in the control panel, holding down an arrow key will either make the player movement very slow or very fast. I would like to control the speed of the player character, and also time movement with movement of other game mechanics.

What I have tried, with some success, is just setting the keyDown event to initiate continuous movement in the specified direction, and then used the keyUp event to stop all movement. This works quite well for achieving the speed and movement rate I want, but I've found it's very unreliable. Any key up event will stop movement entirely, so if you quickly switch between going up to going left, for example, and you hit the left key before releasing the up key, then releasing the up key will stop movement, even though you are holding down the left arrow.

Why does any keyUp event stop movement? Just check to see which key was released (in the ‘message’ field of a keyUp event, same as with keyDown). If the user is moving left but the ‘up’ key is released, ignore it.

Or: you could skip keyDown/keyUp entirely and use GetKeys() to check which keys are down yourself every time through the event loop.
 

Crutch

Well-known member
Addendum: on (older versions of?) vintage Macs you won’t get keyUp events at all unless you tell the Toolbox you want them by calling SetEventMask(everyEvent) at the start of your program. I assume you are doing this already.
 

nightingale

Well-known member
So I worked on this a little bit last night, and I actually implemented something similar to what you are suggesting. Essentially the most recent keyDown event sets the direction of travel, and when there is a keyUp event, it checks to see if the key that was released matches the current direction of travel. If it does, it stops movement, otherwise it ignores it. This has solved the issue of having "left over" keyUp events interfere with movement. (Yes, I did change the SetEventMask to everyEvent)

I was not aware of GetKeys() -- I will look into that to see what it can do for me, but it sounds like it will be a different way of getting to a similar result to what I have.

I've now designed it so that the player only moves once per "turn" (1/5 of a second), and synchronized it with the movement of enemies on the map. Which is very useful for making sure the player movement aligns with the enemy movement, which is an important game mechanic, but has the disadvantage that if they press the key right at the beginning of a "turn", it feels slightly laggy, and if they push the button right at the end of the "turn", they might overlap 2 turns and end up moving two spaces. I can re-write this so it behaves more like it used to, where the movement happens instantly and independent of the enemy movement, and the repeat rate is timed from when the movement initiates instead of when the "turn" starts. That would lose the synchronization I wanted, but realistically, at 1/5 of a second, I don't think it will actually be perceptible and shouldn't affect gameplay.

This is more of a choice I have to make than a technical problem I have to overcome. I gained a lot of clarity just from talking it out. I also have played some other of my favourite games and a lot of the things I thought were problems are actually the behaviour of other similar games, and I never noticed the behaviour before until I started looking for it.

Thanks for your help! I'll try to finalize what I'm going to do with movement this weekend and then post another demo, assuming I still have power after Hurricane Fiona passes through tonight.
 

nightingale

Well-known member
Alright, so the power is back on, here's what I've been working on:

Download: Angry Robots! Deluxe Edition

Keep in mind the Map Editor (at least this version) was never really meant for human consumption, so I haven't put a great deal of effort into documenting it. I'd love any feedback on the game that anyone has, or if you encounter any bugs that aren't in the Read Me file.

Disclaimer that none of these are final levels for the game, more like test levels for trying out the different features. In particular, Level 8 has a few items/traps that don't do anything yet so it might not make a tremendous amount of sense.

If you do try out the level editor, the Play Test functionality doesn't work yet, so you'll have to do a little ResEditing to load your level into the game. Follow along in the Read Me for the Map Mover and you should be able to get it.

Enjoy!

@LaPorta @joshc
 

ry755

Member
Woah, this is awesome!! Just finished reading through the entire thread. I've wanted to get into retro Macintosh programming for a long time but I've always struggled with finding the motivation to learn how the Toolbox works, it's so different than what I'm used to :p
 

nightingale

Well-known member
Thanks! When I look back at where I started and where I am now, I'm very impressed with what I've achieved so far. While I had some programming experience, I found it very different getting started on the Macintosh. But once you get to know the toolbox, and how to use the resources that are out there (several Inside Macintosh volumes are always open in my browser), programming for the Macintosh is actually really fun and rewarding. The toolbox takes care of so many things for you, once you get over the hump of learning the ins and outs of how it works.

If I could do one thing differently, I might give consideration to learning Pascal, because Inside Macintosh uses pascal for all the examples. I find I often have to find another book or resource to figure out what the C implementation of toolbox routine looks like once I find what I'm looking for in IM. But I just don't think pascal would be as relevant today and since I already knew a little bit of C it seemed like a more natural starting point.

And without all of the knowledge on this forum, and the people willing to help, I never would have made it this far. I found I needed a lot of help and hand holding at the beginning, but now I'm at the point where I can figure most things out myself, and I only need to seek help when I get really stumped. If programming for the Mac interests you, I highly recommend giving it a try. Plus, now I actually know enough to help others!
 
Top