Sei sulla pagina 1di 35

SIXTY FIVE MILLION AND ONE BC

The Latest demo you’ve ever seen!

DETAILED STEP-BY-STEP TUTORIAL!


Artificial Intelligence
GAME DEVELOPMENT JOURNALS
God of Rock & Falcon Wars
GAME MAKER INSIGHT
Functions in Game Maker
AND MUCH MORE!

LEARN HOW TO PARTICIPATE IN

ON PAGE 15

Page |1
Interviews Resources
November
Previews
2007 http://markup.gmking.org
Reviews Tutorials
Welcome
Contributors

Robin Monks Sr. Editor


Editor’s Desk Eyas Sharaiha
Andris Belinskis
Editor
Editor
Philip Gamble Writer
Bart Teunis Writer
Thomas Hansen Writer
John Leffingwell Writer
Open Source, and Open Source Game Jonah Turnquist Writer
Development Veeti Paananen Writer
We're back! There's another issue inside, with all the Michael Moore Writer
information you need to make your game shine. But before Jono Alderson Writer
you get into that, I want to rant on a little about open Tarik Abbara Writer
Mathew Malone Writer
source. Everyone who I've talked to for more than 10
Robert Colton Writer
minutes knows I love open source software, open source Dan Meinzer Graphic Designer
ideals, and open source content; it's part of the reason why
MarkUp is open source.

But there is a lot more open source content out there that Table of Contents
many people don't know about. For example, if you do an
advanced Google search you can specify to only search for GAMES AND REVIEWS
creative commons licensed content. What some photos to 65 Million and 1 BC....................................... 3
throw into your next project? Yotophoto can find them! Feel Reality Rampage ......................................... 30
like doing some reading? Grab some classic books off Age of Man ................................................. 31
MarDar ........................................................ 33
gutenberg.org!
TUTORIALS
Maybe you want some open source music, to listen to or
Functions..................................................... 20
remix? http://www.owlmm.com/ has filters to only choose Smooth Edges ............................................. 16
open source music. And, most everything on archive.org is Online Highscore Tables ............................. 18
under a liberal usage license too! Artificial Intelligence .................................... 9

And don't forget sf.net and freesoftwaremagazine.com for DEVELOPMENT JOURNALS


open source software! Faction Wars ............................................... 11
God of Rock................................................. 14
See you next month!
MONTHLY SPECIALS
Robin Monks■ Script of the Month .................................... 25
Extension of the Month ............................. 26
Pick of the Month ....................................... 27

MISCELLANEOUS
The Game Maker Race ............................... 15
Customizing GM7 ....................................... 29
Beginning .NET Programming with VB ...... 32

MarkUp is a gmking.org publication; please


visit GMking for more free game
development resources!
Page |2 November 2007 http://markup.gmking.org
e x c l u s i v e p r e v i e w

65 Million And 1 BC
an idea of how the introductory
Overview
screen looks like right now. To be
What an awesome, awesome game!
honest, screenshots don’t do justice
From the moment I double-clicked
to the real beauty of the scene, as
that small icon until the moment I
the sun is constantly moving, and
exited the game the experience was
smooth subtle animations are always
excellent. Right when the game
occurring.
opened, I knew I was in for a big
treat--and boy was I right. What improves the experience is the
great music that is played during the
An early version of the game has introduction. It implies power and
already been released; however, I've greatness, like the music in movies
had an amazing opportunity: an about ancient empires (such as
exclusive look at the new version of 'Alexander the Great').
Sixty five Million and One BC, which
is a huge improvement over the
Introduction
previous version. The incredibly long-
Again, screenshots cannot do justice
titled game was created by snailfox
to this game, specifically not to the
of the GMC, who surely did an
game's introduction. The
excellent job on the game, as you are
introduction film is really cool; the
about to discover.
interaction of the dinosaurs with
each other is spectacular, and the
I did not play the previous version of view moves smoothly to cover
the game –apologies to snailfox – so different areas and even shakes the
I might be describing a feature with moment the meteor hits the ground.
great excitement without realizing The effect is definitely
that it was available in an older commendable.
version. I’d like to point out that
The background music becomes
even though other previews of the
lighter and gentler to draw the
Game exist on competing magazines,
readers concentration to the
this remains an exclusive preview of
interaction between the dinosaurs
the full version of the game, not
and the text appearing on the
available elsewhere.
screen.

The volume goes up and down


First Moments according to the event and its
When I opened the game, I was
significance, and the tempo changes
greeted with the most wonderful
based on the exact moments of the
music and scenery. I've attached


introduction. It is incredibly clear
these four screenshots to give you

Page |3 November 2007 http://markup.gmking.org


Exclusive Preview

EXCLUSIVES
65 Million And 1 BC Cont.
that the music was built carefully and walking, the Ctrl key changes from features. On the top are the two
tailored just for the introduction film. ‘tailwhip’ to ‘run’; when you’re context-sensitive button instructions,
Oooh, awesome, awesome! jumping close to a vertical surface, Ctrl on the bottom center is the health bar,
again changes to ‘climb’; and when and to the bottom right is another
I've also appreciated the fact that the you're climbing, Ctrl becomes ‘let go’ context-sensitive sign which only
intro has some cool jokes--nothing too while Space becomes ‘jump’. appears when it's relevant.
much, but the humor was appreciated. The health bar is jagged, which makes Unlike the Ctrl and Space indicators
However, I was disappointed that the it look kinda “stoney” and I suppose whom are always present (but with
intro is way too long. If only the movie this is done on purpose to give some different labels according to the
could be broken into smaller pieces character to the game. situation), the Talk indicator for the
separated by some cool but minor Enter key only appears when relevant.
gameplay. Otherwise, it disappears.

When I say “appear”, “disappear”, or


User Interface “changes”, I'm actually not describing
Excellent! The screen is organized in a the effect very well. Everything just
very logical way; the controls are fades in and out so smoothly; it's
always on the screen, yet they don't fill unbelievable!
it. How so, you ask? well, at any one
moment, only the relevant controls
appear on the screen. Interaction
The health bar is jagged, making it look
Other than the arrow keys, you only The way the player interacts with
kind of stoney, which seems to be
need two more buttons: the Space and other objects is really nice. I've
done on purpose to give some
Ctrl keys, though the Enter (Return) described this in the section above, but
character to the game. The UI
key is used occasionally. When you are I'll emphasize it a bit more here. When
screenshot above shows all these UI
getting near a vertical surface, the
controls change. When getting close to
a dinosaur, it might act differently,
controls might appear, and a button
which would normally do one thing
would change its behaviour
accordingly. Pretty cool.

Talking

When pressing Enter near a talking


dinosaur, the 'talk mode' begins. When
talking is taking place, there are two
options for the user: continue or skip.

Page |4 November 2007 http://markup.gmking.org



Exclusive Preview

EXCLUSIVES
65 Million And 1 BC Cont.
If a user wants to continue, then Enter
is the button to press. Otherwise,
Escape is the button of choice.

Again, cool graphics are shown to


reflect the changes that have occurred
to the controls. On the bottom left is
Skip and on the bottom right is
Continue, corresponding to the Escape
and Enter keys respectively.

I've also attached a screenshot that


shows the ‘talk mode’. As you can see,
the game gets rid of the unnecessary
UI and enters a quasi-widescreen
mode. Again, this transition is done
smoothly. It's not like the entire screen
fades out; what actually happens is the
UI components fade out, and the black
stripes you see on the top and bottom The amazing thing is that it all happens
of the screen gradually start filling the very smoothly. It's almost as if there's
area. a special transition set of sprites and
frames for each sequence of moves.

Graphics Particle effects are used wisely for fire


I've said quite a few times that and smoke. Nothing is done over-the-
screenshots don't do justice to the top so that the result is light and also pretty cool. The damage is a
graphics. The reason for that is that delicate. Excellent job, I admit. shock-like ring effect or else a cool,
the graphics themselves are good, but delicate blood effect that appears just
what makes them amazing is the Another effect I noticed is the
briefly on the screen.
animation. splashing of water – really cool.

Everything animates so smoothly. The Sound of Music!


Walking is amazing; the legs and feet The music sure does sound excellent
of the dinosaurs appear to move quite all around the game. It has an ancient
realistically relative to the speed of feel, and you can hear occasionally in
motion. Jumping has great animations, the background the beat of those
even when climbing and jumping off ancient instruments in a quick-
vertical surfaces. Hitting, biting, and other moves are

Page |5 November 2007 http://markup.gmking.org
Exclusive Preview

EXCLUSIVES
65 Million And 1 BC Cont.
tempoed "boom, tack-tack boom, forest and get the medicine, you'll Overall
tack". It makes the game more exciting have to fight some enemy dinosaurs, What a spectacular game. While it is
and makes the graphics look better, which doesn't seem to be hard. Right still, even at this extremely mature
also. When the volume of the music is after that you are asked to climb past stage, a work-in-progress, I'm amazed
decreased, birds can be heard in the poisonous worms by jumping back and by how this game will turn out to be. It
background. forth between two or more vertical certainly isn't the typical Game Maker
platforms. That was really hard and game we see anywhere in the GMC.
cost me my life. At this point, I gave It's special and unique.
Though I'm not sure this is the case, it
up.
appears that the state of the music It is really refreshing to see someone
changes with the state of the game. pay attention to all elements of a good
When there's not much to do, or when Storyline game and to making sure the game is--
you're idle, the music does seem to be The storyline is quite simple and nice. in every standard--marvellous.
less exciting and calmer than when you It actually talks about, as the game's
are in a battle situation. name implies, what supposedly I've given only a couple of suggestions
happened Sixty Five Million years ago: about the game, and these are to
the extinction of dinosaurs. A small enhance the difficulty curve as well as
Difficulty Curve make the intro shorter (or break it into
meteor hits the ground, and the
The difficulty curve is something I smaller pieces). I hope my suggestions
dinosaurs know that a bigger one will
didn't like quite that much. The reason are heard, but even if they aren't--
soon follow. The entire mission of the
for that is the game becomes difficult awesome job. See the GMC demo
game is to stop that meteor from
way too early. This was actually a topic.
hitting and save the dinosaurs from
reason why I wasn't able to finish the
extinction.
Up next: Exclusive Interview with

game.
It's a sufficient storyline, and it works snailfox.
well to keep the player engaged.
Right after you are asked to go into the
Snailfox did a good job there, too.
G a m e S c r e e n s h o t s

Page |6 November 2007 http://markup.gmking.org


Exclusive Preview

EXCLUSIVES
65 Million And 1 BC Cont.
Interview
Interview
new sprite sheet or design a shaky takes trial, error and perseverance, I
What do you find easier, camera effect or a moving sun - think. The GM sprite editor has the
building the engine then something minor that won't interfere essential feature to help you animate -
moving to eye candy or doing with the game engine when I it shows you a preview animation of
implement it. It's refreshing to have
the whole thing in one go? the sub images - so as long as you can
the change of focus, and it makes you paste your graphics into there,
I'm sure that it's better to build the
think of ideas you might not otherwise animating should just be a matter of
engine before you add eye candy, and
have had. reviewing the preview animation and
it's probably easier in the long run,
even if it's not that fun. The engine is modifying the sub images as
The animations for 65
the foundation of the game - the basic necessary. Personally, I use Corel Draw
Million and One are amazing,
structures onto which you build the to create the vector graphic sprites
finer elements - and it definitely has to any tips for newcomers on and Photo-Paint to clean up the
be well-established before you start how to improve with their individual frames, and then paste them
tweaking and shaping the visible parts.
Graphics and minor game features are
animation skills?
Thank you, and yes: use vector

usually small-scale elements that rely graphics if you don't already - they Super Sound System
on the more basic working of the make spriting much easier because
engine, so if you go adding those while you don't have to redraw every single Super Sound System is one of those
it's still in development, they'll sub-image. While a lot of GM games classic Game Maker DLLs. It has been
probably stop working as you change purposefully strive for a classic look by around ever since 2005, and is
the engine code that they rely on. having SNES Sonic-style graphics (the incredibly beneficial to games.
only example I can think of off-hand),
But I wouldn't say that you should they're pixel-based (raster graphics) The DLL allows you to use the OGG
work exclusively on the game engine and hard to manipulate. If you want to Sound Format, which is an incredible
until it's complete - for most games change part of a raster sprite, you have open format. OGG has great
that would be a long, dry process and to redraw it, which is really irritating if impression, and high quality, and it

Quick Reviews
you'd probably give up or go mad. As you aren't great at drawing. can be used with Game Maker using
long as you aren't messing with the the Super Sound System.
basic workings of your game, I think it's I'm not great at drawing, so I use
a lot better to work on other aspects in vector graphics, which allow you to The DLL has some nice features, too.
parallel with the engine development; construct 2D objects out of individual You can change the volume, panning,
elements like graphics and storylines shapes, then move, rotate, resize and play multiple sounds, etc. Version
and effects. I think you can be a lot deform them without any loss of 3.2, released in September 2007,
more creative if you have a relatively quality. The shapes in MS Word and solves multiple bugs previously found
flexible approach to building the game. PowerPoint are vector-based, while in the system.
What I've been doing is to focus mainly the stuff you draw in MS Paint is
on building the engine, but take breaks raster.
Get it now!
from it now and then - to draw out a gmc.yoyogames.com/?showtopic=120034
As for the actual animating, that just

Page |7 November 2007 http://markup.gmking.org


Exclusive Preview

EXCLUSIVES
65 Million And 1 BC Cont.
from there into the GM sprite editor. Triforce of Trifle, or whatever; and How come the music so
finally, if you're like me, you'll get the awesome?!
Have you ever tried working (probably misplaced) suspicion that Thank you again! It's a matter of taste
in a team? Which do you you could have done everyone else's though - I'm not expecting everyone to
think is easier? work better than they did. like the music, which is why I added
I really don't know which is easier, the function to switch it off. It's all my
since I've never tried working in a What do you generally use to own (music keyboard, Adobe Audition
team; I imagine there are both achieve smooth and semi- and lots of audio cables) and I'm quite
advantages and disadvantages of doing transparent sprites? proud of it. The tunes are original, but
so. Well, some of the title graphics and mostly based on the soundtracks of
HUD elements have alpha channels, various films and games, which are
The biggest advantage of working in a but the vast majority of the sprites variously referenced throughout the
team, I should think, is that you have don't. The problem with having no game. There's some Zelda and Lord of
access to expertise different from your alpha channel is that Game Maker will the Rings, and of course, Jurassic Park -
own - so you could potentially get only use one colour as the transparent none of the music is ripped or directly
better graphics and sound and copied though, even though I know the
colour of a sprite, which means you
innovation and coding than you would either have to draw the sprite onto a game would sound better for it. I think
be able to produce yourself - and there background of the same colour that original music is a nice touch in a GM
are always people who can do things will be used in the game room, or keep game, if possible.
better than you can, so you might as a jagged, aliased sprite edge that can
well take advantage of that. I've been I can't help but ask... where
be used against any colour - but that's
constantly scouring the GMC forums to
pretty ugly.
did snailfox come from?!
find better ways of coding certain If I told you, I'm afraid I'd have to kill
features, or to ask just how the heck I very slightly blended all my sprites you.
you do vertical platforms; using the with a medium-grey background, the
expertise of other people only makes average colour of all my different room
for a better finished product. There backgrounds. This has worked out Conclusion
would also be a smaller workload for quite well, the grey around the edge of Sixty Five Million and One BC is an
you, and a more accurate, collective the sprites is pretty much excellent Game indeed. I was glad to
opinion on every aspect. undetectable against all of the review it, and also thrilled to interview
medium-toned room colours in my snailfox, its author... whose name is
The drawback of working in a team, of game, but it takes the edge off the (right now, for me) as mysterious as it
course, is that other people are black sprite outlines and makes them ever could be!
involved. While this can be good for all look smoother. If I put them against a
the reasons I mentioned above, it can I truly hope people would make use of
black or white background, the sprites
also mean you end up relying on the tips in the interview, and also try
would show up the grey edges and
someone for something they can't or to create games as complete and
look ghastly.
won't deliver, and creative homogeneous as this is. It is really
disagreements can hamper the whole Note from Eyas: then, may I educating (game development-wise) to
project. You'll have to share recommend reading this issue’s article hear from a creator of an excellent
credit/delegate blame when the game about smooth edges? game.
turns out to be Immortal Defence/LOZ:
Eyas Sharaiha■

Page |8 November 2007 http://markup.gmking.org


Tutorials

TUTORIALS
Artificial Intelligence
Overview
Artificial Intelligence, AI. What is it? if pressed>10
Some people say that it is the ability of {
a machine to act on its own. It is most //actions
}
often thought of as computers acting
like humans. The reality is that AI is This will test if the user has pressed
output based on circumstances, plain the shift key 11 or more times. If he or
and simple. she has, it will perform the indicated
actions. I often receive the rebuttal
It is called Artificial because the
that this is not learning because it is
computer does not actually have any
pre-defined. That is because it can't
intelligence or the capability to
actually learn. That is like asking it to
comprehend what is being presented.
write its own coding. A program can
Remember, computers and machines
only do what you tell it to, nothing
work with 1’s and 0’s, on or off. That’s
more.
all they know, that’s all they can
understand. In the case of "Learning" Another common misconception of AI
AI, nothing is actually learned, all that is that it must express human like In accordance to games, some simple
happens is that the AI creates more quality and be very complex. This is AI could be a boss type monster that
circumstances and outputs based on not true. A single if, then statement jumps to the left, shoots at the player,
what is needed to be "learned." For could be considered AI. For example: jumps to the right, shoots at the
example if you wanted to make AI that player, and jumps back to the left and
"learned" to react based on what key if x<10 repeats the process. The creator could
{
the user presses most you could use improve it by making the attacks it
x+=1
something like the following: } does based on the amount of health or
adding other such outputs based on
if keyboard_check_pressed(vk_shift)==true
{
This will add 1 to x as long as x is less circumstances.
pressed+=1 than 10. The circumstance is x is less
When making human-like AI, such as

} than 10 and the output is to add 1 to x.

Advertisement
Advertisement Advertisement Advertisement

Page |9 November 2007 http://markup.gmking.org


Tutorials

TUTORIALS
Artificial Intelligence Cont.
making a car drive on a road, I like to on the right side, the car should turn the steps you take into code for the
take it step-by-step and think of left. Making the cars stop at traffic computer to test and run.
exactly what goes through my mind lights was not as complicated as you
when I perform the action that the AI would think. To do that I had the cars Michael Moore 
is supposed to do. The tricky part check a point in front for the traffic
about that is that the brain does many light object. If it finds one it takes
things automatically. Think about the whatever state it is and acts
seemingly simple act of walking. When accordingly. Here is how I checked for
Gamepad 2.2
you get up to go get a snack you don't the light and found the sate of said
Gamepad 2.2 is a powerful text
think about walking, you just do it. If light:
editor script created by IsmAvatar.
you delve even deeper into the matter,
light=collision_line(x,y,x+32,y) The scripts are available with an
when you walk you are actually
if light!=noone excellent GUI and example.
fulfilling a long, complicated sequence {
of muscle extension and retraction. I state=light.state While ever since Gamepad 1, the
won't go any deeper but the point is if state=3 editor featured multiple lines, pure
{
that what makes creating human AI so speed=0 GML, a text-cursor that uses the
difficult is the vast complexity of every } mouse and arrow keys to move, and
action that a human takes. The more } other common editing features,
of these minute details you include the some new exciting features were
more realistic it will be. The above coding will check if there is added Gamepad 2.
a light in front of the car. If there is it
The first thing I did when I started takes the state of the light and stores it These include text selection, both
making my Civilian Car AI example was as a variable in the car object to test. If with the mouse and keyboard, as
think to myself, when I drive how do I the state is red (3 representing red) he well as replacement, cutting,
keep on the road? To keep on the road car stops. copying, and pasting of selected text.
you turn when the road turns. That An unlimited amount of lines, wheel
raises another question, how do you The pattern explained above is the scrolling, and line highlighting.
know when the road turns? As basics for developing AI. First take a
humans, we can see what is in front of desired action, interpret what steps The editor comes with an excellent
you, as a person, take to accomplish scrollbar interface which allows you

Quick Reviews
us and comprehend what we see and
use that to base our actions on. The that task, and find a way for the to easily navigate through huge
computer, however, cannot see the program to test for and act upon the amounts of text.
turn the road. In fact, all the road is a same steps you take. As stated earlier,
One of the major features of this
bunch of pixels arranged to look like a artificial intelligence does not have to
editor script in my opinion is the high
road. The method I used to test if the be overly complicated or even express
speed (compared to other GML
road is turning was to check points to human characteristics. You must also
scripts) and the ability to easily
the front left and front right of the car. keep in mind that the computer knows
absolutely nothing except 1's and 0's. process huge amounts of data.
If there is no road on the left side, the
car should turn right, if there is no road When creating your own AI convert
Get it now!
gmc.yoyogames.com/?showtopic=328545

P a g e | 10 November 2007 http://markup.gmking.org


Development Journal

JOURNALS
Faction Wars
Welcome back to the
Faction Wars Development
Diary.
In last week’s article we looked at
planning and structuring your game’s
organization, design process and
infrastructure. In this, our second
issue, we look at ways to better
organize, design and manage your
game’s resources and memory usage.
Faction Wars is a massive undertaking,
and as such, memory management is
something that we’ve had to plan for
right from our first steps.

So, what is memory


management, and how
does it apply to my game? will tend to launch your game, play for Obviously our theoretical game is
Memory is used to store, process and
an hour, and in that time complete wasting lots of memory. But how, why,
manage all of your game’s resources.
two levels. Our theoretical game has and what does this mean? How much
We’ll be looking specifically at textures
about 10 hours of gameplay. of a difference will this make?
and sounds, as they can have the
biggest impact on the way that your Now consider that each level is Memory is used by every application
game functions. Managing your different. They have different tiles, that you might run on your system. As
memory resources is as big a design room settings and sizes, enemies, long as you’ve enough memory
element as your level structure, textures, backgrounds and sound available to run your application, then
storyline and gameplay. effects. Let’s presume that each level there’s no problem. But as soon as you
has 20 different resources. start to run low, your system will look
for ways to actively ‘swap’ memory
Let’s take a look at what By default, Game Maker will load all of around in order to make it available
happens when you don’t those 400 of our resources into
where it’s needed, this is done by the
memory when the game starts - even
manage your memory. Virtual Memory Manager, or VMM.
though the average player will only The VMM swaps memory using the
Imagine that you have a game with 20
need 40 of those resources available hard drive which is relatively slow and
levels.
for an average game session. thus this can dramatically slow down
Let’s presume that an average player

your game. As such, it’s good practice

P a g e | 11 November 2007 http://markup.gmking.org


Development Journal

JOURNALS
Faction Wars Cont.
to make your games run as efficiently //ResourcePath[level,resource_number] Using the script below, the controller
as possible. ResourcePath[0,0] = "/imga.gif" object will read the ResourcePath array
ResourcePath[0,1] = "/imgb.gif"
and load only the resources assigned
ResourcePath[1,0] = "/imgc.gif"
ResourcePath[1,1] = "/imgd.gif" to its own room:
So how do we manage ResourceAmount[0] = 2
for(i = 0;
memory in Game Maker? ResourceAmount[1] = 2
i<ResourceAmount[room_num]-1;
As we’ve discussed, Game Maker loads i+=1)
When specifying resource paths, the {
all of your resources immediately by
first index number states the level in Resource[i] = sprite_add(
default. So, rather than storing all of ResourcePath[room_num,i], 1, 1, 1, 1,
which the resource is used, and the
your resources, sounds and textures 1, 0, 0 );
second states the resource number. }
within your executable (where Game
We also create a variable to specify the
Maker then has to decrypt and process
number of resources in each room. The resources within that room are
all of them, even though only a
now loaded and available to use. For
fraction are likely to be used within We now create a controller object for
example, in room one your 2 resources
that gaming session), you simply store each room. Each room is assigned a
are ‘resource[0]’ and ‘resource[1]’,
the resources externally in the folder number, which is stored in a variable
which can be removed from memory
or sub-folder that comes with the named ‘room_num’. In our theoretical
at the end of the level by using
game. game we have two rooms, each with
sprite_delete(), you can automate
two objects.

Now we only need load resources this with the same for loop I’ve used to
when they are required, and then free
them from memory later when you
they’re not needed.

In the game maker manual there is a


chapter named’ Changing Resources’
that focuses on the scripts and
techniques used to load and unload
resources. It’s well worth a read.

Loading external resources


Let’s presume that our theoretical
game has 10 resources. Two of these
are used in the first level, and two are
used in the second level.

The script below is called at the start of


the game, and defines the names and
location of our resources (overleaf):

P a g e | 12 November 2007 http://markup.gmking.org


Development Journal

JOURNALS
Faction Wars Cont.
image, as these pixels are transparent
load the sprites. they do not serve any function and
Sprite and Texture sizes thus only consume memory. Cropping
Of course these are only the very basic can be done in many graphics editing
When you save sprites in Game Maker,
first steps of memory management, software, including game maker’s
regardless of their size, they’re stored
and there are drawbacks with a system sprite editor.
in memory as the equivalent size of
this simple. You’ll probably want to
the ‘next size up’ in terms of 2^x.
rewrite or modify the code for your
own game to standardize names and e.g., 2, 4, 8, 16, 32, 64, 128, 256, 512, Parting Shot
variables – as well as considering using 1024, 2048, etc. It’s been a busy month for all our team
Constants to store names against your members, but we’ve still made
‘Resource[x]’ variables so as to avoid For example, an image sized as 500 x significant progress. We’re busy
having to check which numbers 200px is stored and processed as one fighting away at pulling together final
correspond to which resources. of 512 x 256, and an image sized as concepts and design ideas, and
1100 x 1100px is stored as 2048 x 2048 sourcing some top notch graphical and
Note that it’s a bad idea to add or - almost double the amount of visual development resources. The
delete resources whilst the player is memory is used! framework is being laid for the future
actively engaged in play. Always do it of Faction Wars, and we’re eager to
between levels, at specified moments, When implementing your resources,
show you some of what the team is
so that you don’t inadvertently slow it’s very important to bear in mind that
producing. As such, next month you
down the game and thus render the the size will always ‘round up’. If your
can look forward to ongoing premier
whole process ineffective. image is 66 x 66, you’re using 128 x
access to all of our tech demos,
128. Can you sacrifice a few pixels to
displays and events… We look forward
Tip: With a structured, scripted system bring it down to 64 x 64?
to seeing you there!
to load resources, it’s easy to create a
custom loading bar or screen by Tip: Always crop your images.
Thanks for reading!
tracking and displaying how many of Cropping is the act of removing
your resources have loaded as a transparent borders around the actual Jono Alderson & Tarik Abbara,
percentage. The Faction Wars Team■

P a g e | 13 November 2007 http://markup.gmking.org


Development Journal

JOURNALS
God of Rock
Well, I am having more problems with
the long notes since I am going to add
chords. Now they cause errors and GM
is logging errors every step so it slows
the game down. So to remedy this I am
going to use two-dimensional arrays.

Now that I have successfully got the


note system working with the arrays, a
new problem with timing arose. The
problem was that the objects where
setting their array information at
around the same amount of time, and
obviously that would cause problems.
So I changed the note system to create
all objects at the same time.

The only problem with this is that, this


may put a lot of strain on the user's
computer and potentially lead to
freezing or lag because the room’s
height is 80,000. So I try to keep as
fewer objects at a time in the room
would slow the game’s FPS down God of Rock when its release date
but, GM does a pretty good job of
massively. So I tried deleting the file came.
handling mass amounts of objects so
every 15 steps. For some reason, that
my game is pretty much lag-free at Next thing you know the Update
worked.
least on my computer. Program would continuously crash. I
Then, only one issue remained and quickly discovered that I was actually
The next problem that occurred was
that was the issue of Star Power writing to the EXE. I don't know how
when I added chords into the game.
draining too slowly. To fix this I that code got in there. I must have
This issue involved notes snapping to
thought I'd subtract is by, about 0.02 been half-way asleep or something.
the wrong x coordinate. So to fix this I
or something like that, every step but
had to completely rewrite the system So now God of Rock is pretty much bug
in the end I decided just to subtract it
this time, using Data Structures. The free so now all that’s left is to actually
every 10 steps, by 1. Now I just had to
new Data Structure System had the release the new version. Now if I could
pre-set the update program that
same problem so I had to try it with just find a fast file host...
updates all my games to download
writing a file in a temp directory. That
Mathew Malone■

P a g e | 14 November 2007 http://markup.gmking.org


Special

Fire and Ice, fire and Ice!


The Race has started since the fifteenth of October, but you still have time to make a game and enter – the
deadline of initial submissions is November 15, 2007, and you can submit updates to your game until a week after
that date.

What is the Game Maker Race? It is the ultimate Game Maker challenge, created as a joint project between: our
Magazine – MarkUp Game Development Magazine, and Game Maker Technology Magazine (GM Tech).

The contest is creative, fun, and for you talented Game Developers, it’ll give you a big chance of
earning some awesome prizes. Do not miss the opportunity!

winner receives two PC games, out following the instructions on-screen.


of this selection: The theme of the competition is the
Prizes following:
 FIFA '08
All Top 20 Games!  Command & Conquer 3:  Make a game related to “Fire
Tiberium Wars and Ice”
For all the top 20 games submitted,
 Rollercoaster Tycoon 3 Deluxe  The game must be 2-dimensional
the candidate will receive a free copy
 Bioshock
of AKUCHIZOKU, by cactus!
 Company of Heroes How to Start?
All Five Finalists  The Sims 2: Bon Voyage
 Worldwide Soccer Manager Get Game Maker from the YoYo
All five finalists will get one USB Games site, and start programming!
2008
Flash Drive each, with a capacity of 1 Remember the criteria of the game
 CSI: Crime Scene Investigation
GB. above.
Hard Evidence
The Winner  Sega Rally The Game Submission must be
 Tiger Woods PGA Tour 08 uploaded to the YoYo Games forum. If
In addition to the 1 GB USB Flash
for some reason that is difficult or not
drive, the first place winner will also
How to Enter? possible, support is available through
receive a 2-year free domain, in
the forums.
addition to free cPanel hosting for You can enter the competition, by
that domain. Not only that, but the navigating to the entrance page and
P a g e | 15 November 2007 http://markup.gmking.org
Tutorials

TUTORIALS
Smooth Edges
smooth edges in a game means any the sprite in Figure 3 to a circular
Smooth Edges
foreground sprite could well-blend object.
“Smooth edges”, in games, is almost
with whatever is behind it (whether it
certainly a graphic requirement for
is another sprite or a background). The
high quality games.
lack of smooth edges might make Figure 3: The Original question mark
“Smooth Edges” as a concept is certain (or all) objects feel out of place. sprite
certainly different from the Game In order to be able to make this shape
Maker feature with the same. While a circle, we could easily use the
the latter could be used to achieve the Smooth Edges in Game function to crop out the four edges
former, other techniques also exist Maker and make the center circular.
that make it easy to do so in Game
Game Maker 6 and 7 How do we do that? We get a black
Maker. background, and draw a white solid
A cool feature exists since Game
Maker 6, and available in all future circle in the middle.
versions of Game Maker:
sprite_set_alpha_from_sprite, which
is an excellent function in my opinion. Figure 4: The Alpha Index for the sprite
The result, when editing the sprite s_q
The function has two arguments, the (Figure 3) with the alpha mask s_qm
first is the id of the sprite to be edited, (Figure 4) using this code:
Figure 1: A circle with Smooth Edges
and the second is the id of the sprite
sprite_set_alpha_from_sprite(s_q,s_qm);
that will be used as an ‘index’ in
determining the alpha of the first Is what appears in Figure 5. The sprite,
sprite. s_q, now looks like this. The action of

The first sprite could be any wanted the script cannot be reversed in
shape, with certain transparent and runtime.
Figure 2: the same circle with no Smooth opaque areas (the transparent option
Edges
should be disabled, most of the times).
Games with no smooth edges (as seen
Figure 5: The new resulting sprite
in Figure 2, above) appear of much less The second sprite, which is the index Obviously, this example is mainly
quality than a game with full smooth of transparency, will have a grayscale concerned with how to use the script,
edges (Figure 1). color. Black means the pixel will be rather than smooth edges. So, there is
fully transparent, and white means the no virtual benefit of using this exact
pixel will be fully opaque. All gray set of actions on a sprite, as Game
What are Smooth Edges?
colors in the middle produce semi- Maker’s single color transparency
“Smooth Edges” as a concept, doesn’t
transparent pixels, according to their would work just fine.
necessarily mean realistic graphics.
distance from ‘black’ or ‘white’.
You could always have bulky, Ex. 2: An actual use of the function
Ex. 1: How the function works

cartoonish sprites and graphics – but If the same question mark in Figure 3
‘smooth edges’ is still needed. Enabling In the first example, we want to turn

P a g e | 16 November 2007 http://markup.gmking.org


Tutorials

TUTORIALS
Smooth Edges Cont.
was to be edited into an actual smooth be immediately integrated into the the sprite properties window.
circular object, then a better mask image, meaning there is no need for an Precise collision requires more
sprite (Figure 6) has to be used. additional mask: it’s all in there. process but is necessary for
non-rectangular objects that
Game Maker 7 introduces support for need collision checking.
Figure 6: The enhanced mask (s_qm2)
alpha channel PNG files.  Preload texture: this option is
If we used the function to have s_qm2 Unfortunately, access to alpha PNG also available in the sprite
as an index, rather than s_qm, we files is only available via code, and properties window, and
would have the result shown in Figure adding a PNG image as a regular sprite defines whether or not should
7. would not make it transparent. the texture be loaded when
the function is called (or
Two functions for alpha channel PNG
alternatively, upon first use of
files exist in Game Maker sprite
Figure 7: The resulting sprite
the new sprite).
handling: sprite_add_alpha, and
Compare Figure 7 to Figure 5 on the  X-origin, Y-origin
sprite_replace_alpha. The former is
previous page. Both are of the same similar to the sprite_add function, Basically, an alpha-transparent PNG is
base sprite, but their pixels have which returns the id of a newly created either saved somewhere, or included
different alpha indices. sprite from a file, and the latter is in the executable (via the inclusion
similar to the sprite_replace function, mechanism) and extracted to a
Game Maker 7: PNG
which the sprite with the given id is temporary folder. Then, the function is
PNG stands for Portable Network
replaced with a completely different used to add (or replace) a certain
Graphics, and is an excellent graphics
sprite, selected from a file. sprite. The sprite drawn would
file format.
automatically be transparent, with
The sprite_add_alpha function has the
The reason why it is really popular, smooth alpha channels.
following arguments:
especially in the web, is because it is
an efficient form of lossless data PNG files could be saved using
 File name: the name of the
compression, but also supports an Photoshop’s Saving-for-Web option, or
PNG file to be replaced, either
alpha channel. many other editors.
relative to the game’s
working_directory, or a full
Lossless data compression means that
the data (file contents) are
file path leading to the file. Conclusion
 Number of sub images: this Adding smooth edges to the game
compressed, usually resulting in a
indicates the amount of sub would indeed give a much better feel
considerably drop in file size, but
images to be used. 1 would to the game overall.
without suffering any loss of quality.
result in a single still sprite,
JPG is an example of lossy
while multiple numbers mean In future issues, other techniques of
compression, where the size drop
that “numbered” sprites need smooth edges will be discussed. These
occurs on the expense of quality
to exist. include using surfaces, scaling along
occurs.
 Precise collision checking: this with GM’s built in “Smooth Edges”
PNG can support an alpha channel, is the same as the feature in feature, and others.
which means that transparency would
Eyas Sharaiha■

P a g e | 17 November 2007 http://markup.gmking.org


Tutorials

TUTORIALS
Online Highscore Tables
realigned. Likewise the navigational restart it. Then create a new object
Introduction links are not always sited in the most which will be used as a button to
Highscore tables or leader boards have logical places; however this gives a submit the player’s highscore online.
long been a common feature in many false impression of the service. Choose the left pressed event and
genres of computer game. then go to the newly added ‘Vex’ tab
After a quick registration form has and drag the single action across. You
Game Maker’s built in highscore table been completed setup is extremely then need to enter the username and
function has been used in many Game simple. The ‘Game Settings’ page asks password combination you used to
Maker games enabling people to for your game name and then enables
compete against themselves and register at the Vex website previously.
you to choose from 4 pre-built themes
family members, but unlike online for your highscore table. After entering your login credentials
games until now very few games have you then have to add details of the
offered online worldwide highscore variables that store the player’s name
tables. and current score in your game. The
graphic below shows how the form
Online highscore tables enable gamers
from around the globe to compete should look if your player name is
stored in a variable called ‘Player’ and
against each other whilst playing a
you have used the inbuilt ‘score’
game on their own computer. The
concept by which they work is very variable in Game Maker.
simple – after the game is over the
gamers score is submitted over the
internet and stored in an online
database of collected scores which can
then be viewed by players. Next you can preview you highscore
table, but since no data has been
Until recently there was no easy way entered yet this is a little pointless.
to do this with Game Maker, but in the Mysteriously the next option then
past couple of months not one but two enables you to embed your Vex
free services have come along which highscore table onto your own
claim to enable easy creation of online webpage in an iframe – all this before
highscore tables. you’ve actually seen how the service
works. You then have to download a
Using a very basic game I have made I
library file and copy it the /lib
will compare the features offered by
subdirectory located in the folder Clicking the button within the game
Blijbol OnScore and Vitarsi Vex.
where Game Maker is installed. The then submits the player’s data over the
download does include a very brief internet to your Vex account and
Vitarsi Vex readme file to this effect, however if places the score within your highscore
you have never used a none-default table. The Vex highscore service
The Vitarsi Vex site looks like it has
library you may not know what to do. allows you to create one high score
been put together in a slightly
table per account which can be used to
haphazard manner and some page
elements could do with being
If you have Game Maker running display the top 10 scores.

P a g e | 18 November 2007 http://markup.gmking.org
Tutorials

TUTORIALS
Online Highscore Tables Cont.
Management options even enable you The step by step instructions provided
delete specific high scores from your by the help file far exceed what is
table if you wish. offered by Vitarsi Vex, however the
service does appear to be targeted at
Links
more advanced users for the simple
GMC topic:
gmc.yoyogames.com/?showtopic=333478 reason that web space is required.
Getting the required files set up on your
Example highscore table:
server is very simple thanks to the
vex.freehostia.com/Vex.php?user=markup
installation program provided which
Example game: guides you through each action you
www.gamemakerblog.com/gmtv/balloon-gmc.gmk
need to take.

The admin panel looks a lot more


compressive than the members area at
Vex and supports an unlimited number
of games and highscore tables.

I was a little disappointed to see that no


demo tables had been set up, because
of the quality of the documentation to
date I was expecting to see this – a
demo mini game linked up to a
Links
highscore table would be a good finish
GMC topic:
to the provided explanation. gmc.yoyogames.com/?showtopic=252864

After downloading a GML connection Example highscore table:


Blijbol OnScore script from your server setup is very gamemakerblog.com/Server/list.php?list=1
Blijbol.nl’s OnScore download contains
simple thanks to the included library Example game:
libraries for use with all versions of
which requires only one variable – your www.gamemakerblog.com/gmtv/balloon-b.gmk
Game Maker from 5.3A and a HTML
highscore table id.
help file.
When the user’s score is submitted a Conclusion
Unlike Vitarsi Vex, OnScore also Both of these services were not without
webpage opens asking for the players
includes encryption making your high their problems, I did not complete the
details. All of the web pages included
score table safer from any potential setup for either of them on my first
with the download are clean and
cheaters. However another major attempt. Blijbol has the better
lightweight and create the impression of
difference between these two documentation and admin area, however
a very professional service.
highscore services is that whereas requires you to have your own web
Vitarsi Vex provides server space to space. Vex on the other hand includes
store your high scores if you choose the hosting of your highscore table so is
the Blijbol service you need to have
more suited for beginners.
access to your own web hosting with
php and MySQL support. Philip Gamble■

P a g e | 19 November 2007 http://markup.gmking.org


Tutorials

TUTORIALS
Functions
Introduction variable, object id,... arguments. Pushing the start button
otherwise) on the coffee machine would equal the
Quite often in a game or program, the
 argument0 - argumentn are the function call. And the returned value
same piece of code is needed multiple arguments of the function.
would be a cup of coffee. Note that
times. A possibility would be to copy- They are parameters that are
passed to the function. These the user of the machine doesn’t need
paste all text, but that way, your code
change the behavior and to know how the machine works
will soon become very hard to
output of the function. internally. This makes it easy for the
understand. The preferred solution
user to get him some coffee. In the
here is to use functions. Functions
As you can see, a function can also same way, it is interesting for a
allow you to group blocks of code and
receive arguments. These are programmer if he can use functions
they offer an easy way to execute that
parameters that are passed to the that perform certain tasks on their
code. Let’s have a look at what a
function and they usually influence the own. And it’s even more interesting if
function is and what can be done with
result of the function. Indeed, a those functions can be combined to
it.
function can also return some make what one could call an “engine”.
information. And this is where
All very interesting, but we’re not able
Function: the general functions get interesting: functions can
take a certain input, either a single to do anything with this. So far for the
concept theoretical approach on functions.
variable or a reference to a data
A function is a concept used in Time for practice with scripts.
structure and they can return a value
programming. All programming
based on the input.
languages support functions in some
way. A function consists of one or Input Output Scripts: functions in Game
more statements that form the Function Maker
function code. Game Maker allows the creation and
The advantage of functions becomes use of custom functions through
Simply said, a function is a piece of
clear here: functions allow for “scripts”. Scripts in GM are exactly the
code that can be executed when
modularity. A program can be divided same as in other programming
needed. How can it be executed? Of
into functions that are complete languages; it’s just that they’re called
course, you first need to write a
“modules” on their own. A function scripts instead. In this article, both
function. Then, the function can be
takes some arguments, a lot of code is terms will be used. However, the term
“called” by the program (or by another
executed within the function and the “script” will only be used for the
function). The syntax of a function call
required results are returned. If you resource “script” in GM.
generally looks like this:
would associate the general concept of
function_name(argument0, argument1,
Now let’s try to write a function that
a function to an object in real life, then
..., argumentn); could be useful in more than one
something real that resembles a
situation: a function to draw text
 function_name is the name of
function could be e.g. a coffee
somewhere in a room. There are a lot
the function machine. The way you like your coffee
of ways to write a function. Some are
 the ()'s indicate that this is a (milk/no milk, sugar/no sugar, strong
very inefficient. We’ll start with the


function (it would be a coffee, …) could be seen as the

P a g e | 20 November 2007 http://markup.gmking.org


Tutorials

TUTORIALS
Functions Cont.
worst possible function and finish with That looks nice. And the function var no_args; no_args=0;
if is_string(argument[no_args])
the ideal, optimized function to doesn’t even need arguments!
argument[no_args]=ord(
perform this task. argument[no_args]);
But have a look at the 5 lines of code
while(argument[no_args]!=0)
There is already a function to draw above the function call. This function is
{
text on screen, draw_text(), but we’d slightly better than the previous one, no_args+=1;
like to have a function that allows the but there’s one thing that should be if is_string(argument[no_args])
user to customize a bit more, such as done differently here: the parameters argument[no_args]=ord(
the text’s colour and alpha. The code should be passed to the function as argument[no_args]);
could look like this: arguments, meaning that they should go }
between the brackets in the function
draw_set_alpha(0.5); After the loop, the variable no_args
call. And another note: never use global
draw_set_color(c_black); contains the number of arguments
variables to pass parameters to a
draw_text(5,5,"Hello!"); passed to the function (assuming no
function (and don’t use global variables
argument is equal to zero).
It should be clear that this function is if you don’t need to).
worthless. Of course, you don’t need Now that we know how arguments can
Now let’s replace the global variables
to copy-paste this code anymore, but be used in a script, it’s time to rewrite the


with arguments. First a small
on the other hand: what’s the use of a
explanation of “arguments” in GM
function that can’t display the text you
functions. A function can take up to 16 Anti Hack for GM
like.
arguments in GM. You cannot define the
The function needs to be able to names of the arguments, they are Anti Hack for Game Maker is a set of
accept parameters. Let’s have a look at named like this: scripts and DLLs that use the CRC
a possible way to do it: algorithm to detect any hack
argumentn
attempts to your game.
draw_set_alpha(global.alpha);
draw_set_color(global.color); where n is the integer index of the CRC is a checksum algorithm, and the
draw_text(global.x, global.y, argument (0…15). DLL itself uses the algorithm to check
global.text);
Or you can use the array notation: and make sure that the game file

Quick Reviews
Okay, nice. Now the function can remains unedited during gameplay.
argument[n]
accept different parameters. Here’s
Not only that, but the DLL comes
the corresponding piece of code to call
Both expressions give the same result. with some debugger protection and
the function (assume that the
detection, etc.
function/script is called Something that is interesting to know is
draw_text_custom): that each of the 16 possible arguments The DLL might not detect all hacking
is initialized with 0. Now assume that attempts, but it detects for all of the
global.alpha=0.5;
you have a function that can take common hack attempts that the
global.color=c_black;
everything as an argument except 0. game might suffer from.
global.x=5;
global.y=5; Then you could check the number of
global.text=”Hello!”; arguments passed to the function like
draw_text_custom(); this: Get it now!
gmc.yoyogames.com/?showtopic=33676
9

P a g e | 21 November 2007 http://markup.gmking.org


Tutorials

TUTORIALS
Functions Cont.
function. It might also not be a bad Short and simple. Et voilà, that’s our final function. It won’t
idea to add some comments to make Now there’s only one thing left to do. get any more perfect than this. Note that
the use of the script more clear. I Clean up the mess, that is. By using the the var keyword is used here to declare
personally prefer a multiline comment functions draw_set_alpha and the temporary variables as local. You
at the start of the script that explains draw_set_color the draw settings have
should always do this when variables are
some things: been changed. Of course, that’s not no longer needed after the execution of
good. After the function has been called, the function. Otherwise, the variables
 What the function is used for. become local to the object that called the
 An explanation of each nothing in the main program should be
changed unless that was the aim of the function and naming conflicts might
argument and the type of the
argument with some extra function. In this case, it could definitely occur, resulting in weird things. An
information on the type, such produce unwanted results. Other text example might make this clearer:
as whether it is an integer, the might suddenly be drawn in a black
range of the variable, a list id, scr_function()
color, while it should actually be drawn for(i=0;i<100;i+=1)

 What the function returns in white. {
//do something
(also including the data type).
The solution is simple: before executing }
 Possible remarks.
the code, we make a “backup” copy of
the variables or settings that get Create event of an object
The script can now be rewritten:
changed and after the code, we restore for(i=0;i<50;i+=1) //i is
/*this function draws some text the settings. If we add that to the script, declared and initialized as a
on the screen with a color and local variable
we get the final code for the script:
alpha {
arguments: /*this function draws some text on scr_function(); //i is
0. x position (real) the screen with a color and alpha reset to 0 and reaches 100
1. y position (real) arguments: } //the
2. text (string) 0. x position (real) loop ends here because i<50
1. y position (real) returns false
3. color (real)
2. text (string)
4. alpha (real, 0...1) 3. color (real)
returns: nothing The problem is this: in the first for loop
4. alpha (real, 0...1)
(remarks) returns: nothing (in the step event of the object) i is
*/ (remarks) declared and initialized. In scr_function,
draw_set_alpha(argument4); */ that same variable i is reset to 0 and
draw_set_color(argument3); var color, alpha; //backup
of variables
reaches 100 after the loop in the
draw_text(argument0, argument1,
argument2); color=draw_get_color(); function. The result is that, after one
alpha=draw_get_alpha(); execution of the function, i<50 will return
This function is much more efficient false because i is 100.
draw_set_alpha(argument4);
than the previous ones. To draw the
draw_set_color(argument3);
text string “Hello!” at (5;5) in a black draw_text(argument0,argument1,argument2);
A solution would be to change the name
color with alpha 0.5, you can use: of the counter variable i in each
draw_set_color(color); situation, but it is much easier and much
draw_text_custom(5, 5, "Hello!", draw_set_alpha(alpha);
more efficient to declare i local to the
c_black, 0.5);

P a g e | 22 November 2007 http://markup.gmking.org
Tutorials

TUTORIALS
Functions Cont.
script by using var: binary file. It would be interesting if we the function can work with both types of
had a function that could do the data.
scr_function() following:
var i; The complete code of the function is
//declaration of i, file_bin_write_string("C:\file shown in listing 1.
which only exists inside .tmp", "Hello");
scr_function You should remember that, when you’re
for(i=0;i<100;i+=1)
 write text to a binary file that is not using GM6 that the file_bin_open
{
//do something
yet open. This means that the file should function doesn’t create a new file when it
} be opened binary, then the string doesn’t exist yet. A simple way on how to
//at the end of this “Hello” is written to it. solve this can be found in the article on
function, i is destroyed binary files in MarkUp’s 3rd issue.
file_bin_write_string(file,
"Hello");
Create event of an object The return statement makes it possible to
for(i=0;i<50;i+=1) //i immediately assign the file id to a variable
 write text to a binary file that is that can then be used in a next function
is declared and initialized
as a local variable already opened and that has its id put in call as the first argument to the same
{ the variable file. The text now appears function, like this (you can try this out in
scr_function(); //i at the current position in the open file. e.g. the create event):
is used and destroyed after
the function call As you can see, the first argument, test=file_bin_write_string("C:\
} //the argument0, is of a different type in both test.tmp","Hello! ");
loop continues until i
cases (real and string). By using is_real file_bin_write_string(test,"And
reaches 50
and is_string, we can make sure that some other text.");
file_bin_close(test);
The variable i is now only known
inside scr_function. That’s why there
will be no problem with i here. i and
/*this function writes a string to a binary file that is either open or not
arguments: 0. file id of an open binary file (real, make sure the mode is write!)
OR

string containing the link to the binary file that needs to be opened (or
i are 2 different variables, but in the created)
1. string to write to the file
code, they have the same name.
returns: the file id of the function
(remarks)
Arguments that are passed to a */
//declare temporary variable to store file id
function or script are also variables var file_id;
that are local to the function. if (is_string(argument0))
{
A last thing that could be of use is the file_id=file_bin_open(argument0,1);
functions is_real and is_string. With }
else
these functions, it is possible to
{
determine the data type of a variable. file_id=argument0;
These functions can also be used to get }
//write the string to the file
the data type of an argument passed var i;
to a function. And this can be used for for(i=1;i<string_length(argument1)+1;i+=1)
{
some interesting things. Let’s say we file_bin_write_byte(file_id,ord(string_char_at(argument1,i)));
have a function to write text to a }
return file_id;
Listing 1

P a g e | 23 November 2007 http://markup.gmking.org


Tutorials

TUTORIALS
Functions Cont.
And that’s it. What we’ve just done is variables (real and string), it is rather functions. Also, when you use function
an implementation of what is called limited, but as you’ve seen in the and variable help, then this will be the
function overloading. This allows example, it still allows for some nice result (see screenshot below)
functions with the same name to work possibilities.
with different types of arguments. All functions from extension packages will
be shown with some information, like the
Since GM only supports two types of
External functions and built-in functions (assuming that the
extension packages creator of the extension package has
taken the time to add this information).
GMZ: Game Maker zip Since version 7, Game Maker has a new
feature that makes it very easy to add Also, a help file can be included with each
Archiver new functionality based on scripts, extension package. This makes it easy to
action libraries and dll functions. This find help on the new functions.
Though we have had our own fair
feature is called extensions. An extension
share of .zip archiving DLLs for Game
package can contain new functions or Extension packages are definitely not a
Maker, the GMC sure did have a
action libraries. bad addition to Game Maker and they
decline recently!
offer an easy way to add functions and
This is how a script looks: action libraries to games and programs.
This DLL is small, supports
compression of ZIP files as well as the scr_function(arguments);
creation of password-protected zip //script as a resource (purple)
files. The End
But when the same script is now in the Indeed, that’s all for this tutorial. I hope it
The Archiver DLL is non threaded, form of an extension package, it’ll look has helped you understand what
Quick Reviews

but for a reason according to like this: functions are and how they can be of
Adventus, the DLL’s creator; after great use to any programmer.
calling the command for extraction, scr_function(arguments);

everything else could soon be


//function from extension package Bart Teunis 
(blue)
executed afterwards immediately,
thus narrowing the chances of a Of course, the comparison between the
player/hacker tampering ‘temporary’ colors is stupid. The real difference is
files. that functions from extension packages
are nicely integrated into the program.
The different color also shows that these
Get it now! functions are treated as real built-in
gmc.yoyogames.com/?showtopic=326729
functions. This is the case for gml and dll

P a g e | 24 November 2007 http://markup.gmking.org


gmlscripts.com Scripts

SCRIPTS
Script of the Month
This month’s script is an excellent one called Contributors
sprite_replace_color, a great script which is capable of While xot was the one to originally create the script, credit also
replacing a certain color on a sprite with another. The goes to EyeGuy for adding the alpha channel support to the
sprite could be animated or even have alpha blending and script. Well done to both of them, pretty good job.
it’ll all work well! It also works pretty well if you want to
replace a range of colors by repeating the use of the script Conclusion
multiple times. The script does not create a new sprite, but As xot told me when I initially found out about the script:
rather replaces the sprite given.
This is perfect for when you want to have sprites with different team colors.
With carefully designed sprites and several calls to the script, you could
Sprite Replace Color replace a range of shades or colors fairly quickly.
The script is awesome; it uses surfaces in a really cool way
to create a new sprite. It creates a surface and two There are many other uses the script, especially in conjunction
temporary sprites: one for the alpha blending and one for with other GML code. You could make it duplicate a sprite
the actual colors, and ‘mixes’ them together to achieve a several times and create a certain color variation, etc. based on
new sprite with alpha blending (like its ‘mother’ sprite). events in the game. The possibilities are endless!
The script frees the temporary sprites and surfaces, so it
Eyas Sharaiha■
shouldn’t take much memory.
draw_set_blend_mode(bm_normal);
/* draw_point_color(0,h,oldc);
** Usage:
tempsprite = sprite_create_from_surface(surf,0,0,w,h+1,p,true,s,l,xo,yo);
** sprite_replace_color(sprite,oldcolor,newcolor)
draw_clear_alpha(newc,1);
** Arguments:
** sprite sprite to change
draw_sprite(tempsprite,0,xo,yo);
** oldcolor color that will be replaced sprite_delete(tempsprite);
** newcolor color used as replacement if (i == 0) {
** Returns: (-1) on error newsprite = sprite_create_from_surface(surf,0,0,w,h,p,0,s,l,xo,yo);
** Notes: if (newsprite < 0) return -1;
** This script replaces one color in a sprite with another. }else{
** No new sprites are created, the given sprite is changed.
sprite_add_from_surface(newsprite,surf,0,0,w,h);
** GMLscripts.com
}
*/
{ draw_clear_alpha(c_white,1);
var sprite,tran,oldc,newc; draw_set_blend_mode_ext(bm_zero,bm_src_alpha);
sprite = argument0; draw_sprite(sprite,i,xo,yo);
oldc = argument1; if (i == 0) {
newc = argument2; alphasprite = sprite_create_from_surface(surf,0,0,w,h,p,0,s,l,xo,yo);
var w,h,n,i,p,t,s,l,xo,yo,surf,tempsprite,newsprite,alphasprite; if (alphasprite < 0) {
w = sprite_get_width(sprite); sprite_delete(newsprite);
h = sprite_get_height(sprite); return -1;
n = sprite_get_number(sprite); }
p = sprite_get_precise(sprite); }else{
s = sprite_get_smooth(sprite); sprite_add_from_surface(alphasprite,surf,0,0,w,h);
l = sprite_get_preload(sprite); }
xo = sprite_get_xoffset(sprite); draw_set_blend_mode(bm_normal);
yo = sprite_get_yoffset(sprite); }
surf = surface_create(w,h+1); surface_reset_target();
surface_set_target(surf); sprite_assign(sprite,newsprite);
for(i=0; i<n; i+=1) { sprite_set_alpha_from_sprite(sprite,alphasprite);
draw_clear_alpha(c_black,1); sprite_delete(newsprite); sprite_delete(alphasprite);
draw_set_blend_mode_ext(bm_inv_dest_color,bm_one); surface_free(surf);
draw_sprite(sprite,i,xo,yo); }
Script of the Month

P a g e | 25 November 2007 http://markup.gmking.org


g m b a s e . c u b e d w a t e r . c o m Extensions

EXTENSIONS
Extension of the Month
Sprite Generator: Tanks
For this week's Extension of the Month I have chosen a
newly added addition to GMbase – A tank sprite generator,
by Sandro. With this extension can actually generate tank
sprites on the fly, during the game execution. The
generator also allows defining options such as its color and
flag. This allows for many features such as allowing the
gamer to customize their tank, allowing tanks to have
random tints and logos, and to save file space (as the
sprites are generated after the game starts).

Main Functions
 tnk_create() Creates an new tank and returns
an id to be used in other functions.
 tnk_set_color(id,color) Sets the color of the
tank. o sw_gl
 tnk_set_back(id,background) Sets a o sw_flame
background to be used as a texture instead of o sw_missiles
a color o sw_homing
 tnk_set_tread(id,size) Sets the size of the
treads  tnk_build(id) Builds the sprites. When you are
 tnk_set_banner(id,color,sprite) Sets the color finished setting the tank settings, call this function.
and symbol used for the banner located on the  tnk_tank(id) Sets the tank body with id to be used
front of the tank. The symbol must be a sprite. for the calling instance
The sprite MUST be 12x12, and have the origin  tnk_turret(id) Sets the tank turret with id to be
set to (6,6). used for the calling instance.
 tnk_set_turret(id,width,length) Sets the
length and width of the turret cannon. Width
must be a value of 0-3, and length should be a Get it Now!
value of 0-10. gmbase.cubedwater.com/?page=extension&id=157
 tnk_set_sweapon(id,weapon) Sets the
Jonah Turnquist■
secondary weapon. Use the following
constants for weapons:
o sw_mgun

P a g e | 26 November 2007 http://markup.gmking.org


Games

GAMES
Pick of the Month
Gythol Granditti
The wind will roar,
And the clouds will bleed,
And the dead will dance,
And the damned will head.
Okay, okay, okay. I admit that this game is pretty old.
“Gythol Granditti” was created back in 2003. In 2005 it was
submitted to the RPG category in the Game Maker
Competition 2005 and ended up as the overall winner of
the category. To make a RPG game in Game Maker is a
pretty difficult and long task thus the number of GM RPG
games is very low, and only a few of them are pretty good,
and this one’s one of them.

Gameplay

Overall, the game has a similar gameplay to most. You


have to control one or more characters through the story One of the strongest parts of this game is the battle engine.
and help them to victory in the very end. Besides that this Many RPG games are using the well known Pokémon battle
game also contains some few minigames, which can be engine: you and your opponent are in turn selecting an attack
found around the world. The first one you will find is to use… In this game it is different. Everyone in your party and
chicken race – bid at a chicken and hope that it is the all the monsters are fighting at the same time, but by turns. You
fastest one, if it is you will win money, if it isn’t you will are still able to move around and face different opponent, while
lose money. you can attack the characters standing in the fields around you.

P a g e | 27 November 2007 http://markup.gmking.org


Games

GAMES
Pick of the Month Cont.
Controls

You control your party using the arrow keys. That’s simply
enough. But then it gets a bit tough Z, X and C are the action
keys, and in my opinion it is a bit hard to remember what key
is used for what, but here you go: Z is the primary key used for
menus, talk, look and in general to accept/decline questions. X
is simply enough as it is only used to turn on or off run mode.
C seems to be used as joker.. It is also called the “start key” of
some reason. Among other things, it is used to stop traders
talking and make them sell something to you, for instance, a
bed for Dolph.

Graphics and Design


you turn your speakers off to get rid of the music. Especially
the background music in town is very annoying.
The graphics are original. The characters are original as well,
and not as the most RPG characters out there. It is a shame
Overall
that they look like they have used tear gas instead of
The worst things about this game are the music and the funny
deodorant, so I’d like to see the characters improved.
looking characters. The things drawing up the score is the
Furthermore the game consists of some nice effects like effects, the story and the engine in general. Also the idea
lightings, mud and shadows. These effects are pretty good, if about adding mini games is great and the very original battle
you keep in mind that this game was made before effects engine.
were introduced in Game Maker.
Thomas Hansen■

Stats
Sound and Music
Developer: CZ Storm
Category: Gythol Granditti
It is impossible to judge the sound, as there are no sound Version: 1.0
effects at all. There are many different pieces of background YoYo Rating: 3.6/6
music… The track depends of the area you are in. The music is Filesize: 9.9 MB
great – or at least just for a while. It doesn’t take long before Download

P a g e | 28 November 2007 http://markup.gmking.org


Tips & Tricks

EDITORIALS
Customizing GM7
Removing the YoYo Games certain types of coding stand out then however if you are going to be
this option is for you. Game Maker’s spending a lot of time creating your
Logo
default setting uses green for game it makes sense to play around
When you install Game Maker 7 the
comments, purple for object names, with these settings to see if it improves
bottom left hand corner of the screen
blue for variables, brown for constants your game making experience.
is taken up with a graphical link to the
and black for pretty much everything
YoYo Games website. Whilst this isn’t Philip Gamble■
else.
a problem with the general running of
Game Maker some people may find it There are 16 different code elements
intrusive. The good news is that it only which you can change the colouring of,
takes 4 clicks to remove it. or you can even disable colouring
entirely if you are crazy.
File > Preferences [General] and then
check the “Don’t show the website File > Preferences [Colors], then select
image in the main window” *OK+ a code element and press [Change]
(Figure 1, below). (Figure 2, to the right).

Remove YoYo Games’ branding (0:35) Change GML default colors (1:01)
http://uk.youtube.com/watch?v=5bBMU8f0Ctk http://youtube.com/watch?v=G_7MpKLD_tk

Change Code Coloring Conclusion


If you are familiar with programming in Obviously Game Maker works
a language other than GML or simply perfectly well without these tweaks,
Figure 2
require more contrast to ensure

Figure 1

P a g e | 29 November 2007 http://markup.gmking.org


Reviews

REVIEWS
Reality Rampage
mention grenades. You can’t really Pros and Cons
throw anything with them, since you’ll Reality Rampage is a top-down shooter
just end up destroying everything else that needs a lot of improvement.
than your target.
Pros
The second time I tested it I actually  Good base
could pass the first level, but not  Graphics are decent
without noticing many major
problems. Cons
 Poor sound effects
What they say The game gets very laggy in some
 No music
“cool!!! 6/6” points. The “command your team”
 Bugs
system works poorly. And… tanks are
 Mediocre story
very easy to cheat with. If you see an
Description  Lag problems
enemy tank, simply back off so that
The story involves a poke at FOX. It’s the enemy tank barely is visible in the
gotta be good. Unfortunately screen. When you’ve done that it Conclusion
(surprise) it’s not. Let me explain: won’t be shooting at you. You can Avoid until bugs are fixed. It could be
simply fire at it. a good game. One day.
I start the game and press new game.
It’s a top down shooter. Ok, I enter a The game contains no music either and Veeti Paananen■
tank. I can’t move because other tanks needs a lot of improvement.
that are not moving and won’t move Supposedly there is a level editor, but
when pushed are in the way. I exit my being unable to complete the game Ratings
tank when I suddenly teleport to a due to major bugs I were not able to
lower area in the screen stuck behind a test it. Graphics:
building. Great. Sound:
Let me, however, add a warning. The
Gameplay:
From the tutorial I already got the game’s method of distribution isn’t the
feeling it has major flaws in it. Aiming Storyline:
best: Click Team Installer, InstantPlay
is downright impossible with the bad Design:
Incompatible, and on top of that: the
control system (hold right mouse game wasn’t converted to be Vista Average:
button to walk, move mouse to aim, compatible. It isn’t quite easy to
Stats
press left button to shoot). It may convert it locally, because the installer
sound like it works, but you have to puts it in Program Files, which results Developer: schmidtbag
aim pretty damn accurately to hit in an “Access Denied” message in the Version: 1.0
anything, especially with tanks. Not to converter. Oh well. Made with: Game Maker 6
Filesize: 7.2 MB
Download

P a g e | 30 November 2007 http://markup.gmking.org


Reviews

REVIEWS
Age of Man
your men attacked by a tiger well
What they say
balance the game.
‘Fun’ is the usual word used to
describe the game. The Game has
potential but needs significant Pros and Cons
improvements in the graphics area to
be a really good game. Pros
 Several well packed and
strategized maps and
Description skirmishes are included.
Well laid out and designed levels,  You will literally play for hours
strategic planning and idea accepting, you can’t stop it is wonderful
sandbox freedom, and little things that and should be put in arcades.
are well fun to play with (like zapping a  Great design and game play go
tiger so it don’t eat your people). well with wonderful sounds.
Anyway who can think, this game is
Cons
Ratings
extremely fun to play for anyone of
 Not very professional and
any age. You can simple quickly and Graphics:
menu is somewhat sloppy in
easily begin playing requires not Sound:
other words needs polishing
tutorials just simply start a new game Gameplay:
and refinement.
although reading the Read Me file Storyline: N/A
 Also you will find the missions
included is still recommended. Design:
fun yet there is not much
This game is fun to play has great replay value once those are Average:
design will keep you entertained for completed.
Stats
hours and so much more. The game
itself and its’ original ideas are just Developer: Hoytman
wonderful you indirectly control you Conclusion Version: 1.0
people saving the user the hassle of Though the game has a nice concept, it
moving armies from place to place and really needs more work to become a
waging wars. You can quickly start a more interesting and fun game. In
civilization in a small area and be order for a player to really enjoy the
game, a better layout, an interface,
Download
fighting the enemy in no time. Simple
things like sneaking in one of you men and a menu should at least be present.
and killing enemies and then having Robert Colton■

P a g e | 31 November 2007 http://markup.gmking.org


Reviews

REVIEWS
Beginning .NET Programming with VB

confusing you’ll kill yourself reading


About the Book Overall, this book did work out for me
the first section it does not explain but I still don’t recommend it for the
 414 Pages
what kind of project you supposed to average reader.
 Written By David Weller,
create or anything it says let’s take a
Alexander Santos Labao, Ellen
Hatton look at the outline for the block class Robert Colton■
 Paper Back (class = object) it does not say where
 Apress Publishing the code goes if you were to make a Order the Book…
console or a GDI program very
confusing. Here!
What You Will Learn
You will be taken through the concepts But I will say that if you are confused
and understandings of GDI (Graphics on how to do things such as rotate an
Device Interface) in Visual Basic. image, then looking at this code will
Object management, collision help yet to create the projects and get
detection methods, project hands on experience; this book is not
organization, transforming images, for the absolute beginners.
drawing primitives, 3D modeling and
I also believe this book tried to cover
methods are all covered in this book.
too much, while they should have
Basic artificial intelligence stuck with just 2D game programming
programming is concepted and because as short as the book was, a
explained. You will actually create an single chapter covered 5-10 concepts
AI in most of your games which in the long run is quite hard to
professionally and while reading this grasp and not very fun to read.
book.
Although this book does manage and
organize a well set of examples that
What I Think will help a developer moving from one
If you’re in the market for buying a language to another who would just
game programming book I am here to like to see the ways of doing things in
tell you not to buy this one. At first VB. And I will say the recently added
glance it looks like an all right book chapter to this revised book is the best
goes through several examples, steps because it actually explains how to
into 3D and is written by Microsoft start the project and where to add the
Developers, but this book is so code.

P a g e | 32 November 2007 http://markup.gmking.org


Editorials

EDITORIALS
MarDar: Creations
The Demon Within
The Demon Within is an ‘expansion pack’ for a Game Maker RPG series: Knight Man. The Role Playing game is a Diablo-
style top-down 2D game that takes place in the ancient times, the times of magic, spells, but also honor. Fight ‘bats’,
demons, and other enemies throughout multiple parts and levels. The game has really good music and suitable graphics,
but the place where the game really shines – to me – is storyline. Smart and creative, well done. You must be warned
though, the game has been created with Game Maker 5.3A, which has poor alpha handling techniques, etc. – so you’ll
almost definitely experience huge slowdowns when you’re hurt, because of the effects. The game is recent, however, even
though it is made with GM 5.3A.

Angels of Time
Angels of Time is an excellent game by jaj, developed for a competition in the period of two months. Angles of Time is
basically a 2D shooter, made out of four levels. The game also comes with a highscore table, which usually is an excellent
addition to games, as it gives an extra challenge to people: beating others’ scores to advance. The game mostly revolves
around fighting violence.. with violence. It’s a cool, fast-paced game, nice graphics, a retro-ish style, nice music, levels, and
just a good overall shine and polish.

P a g e | 33 November 2007 http://markup.gmking.org


Editorials

EDITORIALS
MarDar: WIP
Almora Online – MMORPG
Almora Online is a Massively Multiplayer Online Role Playing Game, and it seems to me that ‘massive’ was never more
appropriate to use! It is an incredibly polished game, the atmosphere is amazing, the music is great (credit is given to Rob
Westwood for composing the music), and it really fits the game’s overall atmosphere. Borek, the game’s created, has done
a magnificent job. Unfortunately however, the game doesn’t seem to be in active development as it used to be, at least not
on the Game Maker Community’s side. However, what is available so far is good enough and deserves recognition for sure.
Amazing gameplay experience.

Fatal Error RTS


Fatal Error is a Real Time Strategy game where you play as newly uploaded Anti-Virus program. This sums it up, basically:
you are an anti-virus program, fighting viruses and worms… where? Inside a computer! An amazing game, action filled ,
and requires a good brain – I recommend it to fans of strategy games, it might be the soft-core solution you need! The
game is actively developed, which is always a good sign, and is constantly being improved and new features are being
continuously added.

P a g e | 34 November 2007 http://markup.gmking.org


Wrap up

WRAP UP
Wrap up
Thank you for reading Issue 9 of MarkUp Magazine, for November 2007! In this issue we continued on our article
format and review formats we introduced back in issue 8, including Development Journals and MarDar, as well as the
game reviews with the new review format.

You might have noticed that ‘The Making of…” is missing for this issue, but don’t worry; it’ll be back next issue better
than ever, hopefully! We continued to publish book Reviews, in which our staff review books related to game
development. The staff receive the books for free from all of the major game development book publishers in the
world! You can take advantage from this offer by becoming a trusted staff member. Click here for more information.

Remember, MarkUp needs your help and contribution! Please contact us and contribute to MarkUp Magazine by
either joining the MarkUp forum, or e-mailing the MarkUp staff.

The MarkUp Staff■■

Check out…
GMking.org is the parent network for MarkUp magazine. It has been recently redesigned to behave as a centralized portal
that links to the four main aspects of GMking.org’s projects: The GMking.org Site *which is now a sub-site of the main
gmking.org page], The GMking.org forums, GMpedia.org, and MarkUp magazines. Come look at, and enjoy the redesign!

MarkUp has sister projects, also developed and maintained by GMking.org, all meant to help Game Developers. To learn more
information about your Game Platform of choice, you could check out GMPedia.org. GMPedia is a game development wiki
with a growing community-base and content.

MarkUp is an open publication made possible by the contributions of people like you; please visit markup.gmking.org for information on how to
contribute. Thank you for your support!

©2007 Markup, a GMking.org project, and its contributors. This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. To view a
copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
Additionally, permission to use figures, tables and brief excerpts from this work in scientific and educational works is hereby granted, provided the source is acknowledged. As well, any
use of the material in this work that is determined to be "fair use" under Section 107 or that satisfies the conditions specified in Section 108 of the U.S. Copyright Law (17 USC, as
revised by P.L. 94-553) does not require the author’s permission.

The names, trademarks, service marks, and logos appearing in this magazine are property of their respective owners, and are not to be used in any advertising or publicity, or otherwise
P a of
to indicate sponsorship g eor |affiliation
35 with any product or service. While theNovember
information 2007 http://markup.gmking.org
contained in this magazine has been compiled from sources believed to be reliable,
GMking.org makes no guarantee as to, and assumes no responsibility for, the correctness, sufficiency, or completeness of such information or recommendations.

Potrebbero piacerti anche