Xerra's Blog

Drunken coder ramblings

Title sequence update —

Today was a day of pretty heavy research looking into the most effective way to do the scrolling system on the title screen. As mentioned previously, I’ve tried a few different ways with varying success but the general rule appears to be to use a surface to get it done properly. This did turn out to be true.

A development system like GMS 2 works similar to Unity in regard to having a lot of power to automate aspects of your games so you don’t need to manually code them. For example, I found images of the original Paradroid scroll text which had been hacked together probably by someone else who attempted a remake of the game. It was pretty-much the easiest thing in the world to just resize these sprites to the games hard-coded resolution (as it currently as, and will likely need rethinking at some point soon before it becomes too mammoth a task to adjust it) and then set an auto move flag on them to 90. This works in a degree system so 90 = move straight up so placing them on screen and setting the speed would get them moving without any further ado. But I was not in control of what text was built into that image, making sure it was removed from memory once it was out of the bounds of the visibility window, know when the next one had to be put in place and numerous other little things that were important.

So I didn’t like it, Aaron certainly didn’t like it, and that’s 100% “got to go” from the off.

I won’t go too much into what I’m trying to achieve instead, as I’ve documented it previously, but I need the scrolling area within a certain section of the screen, and I can’t cheat and hide bits behind the background as it’s all transparent around the layout as the game is going to be. The game will use all the screen real-estate behind the static sections for level display, score and so on, but scrolling text being visible anywhere but within the window designated would just look a complete mess.

So, a surface was created, a lot of – at present – hard coded areas were setup and temporary text installed so that I could make sure I get the scrolling system in place and working, before I start thinking about the asynchronous text loading and formatting that is going to be required next. Surprisingly, after a few minor bugs crashing everything, it actually fell into place pretty quickly. I had images of multiple draw text lines every frame and then try to pixel move them which, inevitably, it transpired that I was using a surface to actually avoid this whole process.

In a draw event, I just needed to create this surface, draw the text onto it with the correct font and colour, after colouring in the background, then the step event could just be used to draw a certain section of it into the title screen where I wanted it and not have any overhang by trying to cheat. Then I just put in a rough counter to loop the system, add in the routines to colour change the background colour and text colours later on like the original game does.

To me it was a thing of beauty, but it’s probably dead simple to do for someone who’s been using GMS before, no doubt. That’s programming for you.

I’ve implemented the scrolling pause and selectable speeds without going back into the game and checking if it actually did that. For a few lines of code that took maybe 5 minutes to get in place, there’s just no reason to not really have that option. Besides, being able to pause the text is ideal for people who don’t read as fast as the youngsters. IE: Me and other visually impaired people.

So the screen above is what it actually looks like. You can’t see the colours changing, or the actual scrolling, but it does show that a certain area contains the text so I couldn’t cheat and just throw it all up from the bottom of the screen with a black rectangle to hide it, as the border is a custom graphic itself. As you can see, Aarons font is rather nice, when used at the desired size of 32.

This image demonstrates that the scrolling is literally pixel by pixel. When you increase the speed with the cursor down key it does just increment the number of pixels it moves up by, but that’s only logical in a game that’s working of a fixed FPS. It also shows that I’ve got different background colours working ok but I still have a bug in the system that’s changing the text colour. Yellow on white currently looks horrendous.

Naturally the next job is going to be getting the loading of the proper scroll text in and reloading on the fly so I can work out the formatting, due to the different char sizes in width meaning I can’t just use 20 chars per line and expect it to work ok. I have formatting codes within the text I’m using as it is so I will need a rewrite on the hard-coded number of lines the system uses at present, when writing to a surface, or I can rejig the text itself to work round that.

The text itself also needs to go around 10 pixels in on the left and right side to make it look a bit nicer. This looses me some real-estate for long sentences on one line but the trade-off will be worth it. And the other thing I need to be considering now is wether I bring in some of the large robot images that Andrew Braybrook had on his title screen sections during one of the scroll texts being displayed. It would be a lot of effort just for one page but it’s perfectly do-able as long as I can format text around it when it’s on the screen. Maybe have that on the part where the high scores are displayed. It will also give Aaron something interesting to do while getting the right image for me, because I’m sure he’s not busy working on lifts or anything …

I’m tempted to have the title screen with the paradroid logo from the original game display inbetween each scrolling page of text. It will provide a transition between each colour change for starters. If they’re going to be long sequences with all the text in place then it will be a nice break between reading pages of text, for the die-hards who are likely to do exactly that. I’ll probably have a skip key to jump straight to displaying the high score table as that’s the only screen that will ever change once the text is properly set up.

As promised in the previous entry, I have supplied not one, but two pictures of what I’m up to. You lot are just so spoiled 😉

 


Categorised as: Development | Game Studio 2 | Paradroid



Leave a Reply

Your email address will not be published. Required fields are marked *