Game Design Music and Art

Making Platform games - pros and cons – null

null
Junior Member

Posts: 7
From: UK
Registered: 02-26-2002
hi,

What is the best way of creating a platform game?? Is the best way to make the background using tilemaps, or using grabimage on a long picture? Also, if using tilemaps, how do you make certain tiles walkable on, or unpassible ie, a wall?

I've also got a problem with imagescollide. IT doesnt seem to work when using to types. I have a type for bullets, and a type for enemies, but i keep getting illegal type conversion errors. Each type has an x and y field, and this is what i'm trying to do :

If ImagesCollide (bullet,bullet\x,bullet\y,0,enemy,enemy\x,enemy\y,0) Then
....
end if

Any help on that? Also,if anyone could point me to a tutorial on simple platform games,it'd be great.


Too many questions, not enough room!!

null

Gift
Member

Posts: 85
From: Palatine, IL, USA
Registered: 02-11-2001
Hi null,
I am using 3D Game Studio by conitec, to do alot of that lower level stuf. I know that others have had some sucess with Blitz Basic and others. Its kind of nice to not have to do everything from scratch.
Love in Christ
Gift
MeanManInOz
Member

Posts: 388
From: Hobart, Tasmania, Australia
Registered: 06-26-2001
The *best* way is to use DirectX, and to use tiles. Each tile is given an underlying value in order to denote it's interation with the player, i.e. if you will die for touching it, pass unscathed, pass only in certain directions, not pass it, etc.

If you want to be a programmer, you need to look at C++. If you want to write games for fun without having to learn too much ( which is OK, if that is all you want ), then something like Blitz Basic appears a good choice in that there is a modicum of support for it here. The web is bursting with support for C++ though.

Krylar

Administrator

Posts: 502
From: MD, USA
Registered: 03-05-2001
I agree that if you really want to get into the game industry and do games, than C++ and DirectX is the way to go...but hobbyist coding I would take BlitzBasic over C any day. It's easier by far and it's more than fast enough for most any 2D game. Even the 3D stuff in BB is pretty quick.

Since you're showing BlitzBasic code, check out www.blitzcoder.com for a bunch of tutorials and such on these things. Also, I'm in the completion phase of "Programming 2D Games in Blitz Basic", which Guildhall is publishing. Should be out in a couple of months.

------------------

MeanManInOz
Member

Posts: 388
From: Hobart, Tasmania, Australia
Registered: 06-26-2001
Hey, congratulations on getting a book published !!!

I considered a GDI+ book but decided I didn't have the time, nor any idea how to go about it. It's a very cool thing to have done.


Klumsy

Administrator

Posts: 1061
From: Port Angeles, WA, USA
Registered: 10-25-2001
do you find GDI+ fast enough?

i found it to be a slow dog...

------------------
Karl Prosser
Karl / GODCENTRIC
Klumsy / Surprise ! Productions.
ME / Redeemed by the Living God :)
Husband of my amazing wife Aleshia
Klumsy@xtra.co.nz
May God Bless you, he sure does me.

MeanManInOz
Member

Posts: 388
From: Hobart, Tasmania, Australia
Registered: 06-26-2001
Did you use it under .NET, or straight C++ ? Did you try to do real time stuff with it ( as in games ) ? DX is for games, but I have written a paint package in GDI+ including the ability to draw over an area freehand and use that irregular area as a brush. Speed was not a problem. Also written many complex image filters in GDI+ and GDI, and noted no real speed differences.
Klumsy

Administrator

Posts: 1061
From: Port Angeles, WA, USA
Registered: 10-25-2001
you are right gdi has some nice features..
i require realtime..
for GDI stuff i use delphi and assembler and speed normal gdi up...
so gdi+ seems real slow, but yes it has some nice features for non realtime..

Karl

------------------
Karl Prosser
Karl / GODCENTRIC
Klumsy / Surprise ! Productions.
ME / Redeemed by the Living God :)
Husband of my amazing wife Aleshia
Klumsy@xtra.co.nz
May God Bless you, he sure does me.

MeanManInOz
Member

Posts: 388
From: Hobart, Tasmania, Australia
Registered: 06-26-2001
It's always the tradeoff - how can we go from a simple drawing tool to full alpha transparency and texture mapping and not lose some speed ? In that light I think they did a good job, but it's no replacement for DX.
MadProf
Member

Posts: 181
From: Larnaka, Cyprus
Registered: 01-24-2001
hey null,
welcome to CCN!

quote:
What is the best way of creating a platform game?? Is the best way to make the background using tilemaps, or using grabimage on a long picture? Also, if using tilemaps, how do you make certain tiles walkable on, or unpassible ie, a wall?

i wrote a moderately simple platform game in BB a few months ago, and did it via a ASCII map, which looked something like this:


________=______
_______===_____
___=__====_____
_============__
_______________

etc. the "_" being blank, and the "=" being for full blocks.

I then wrote a function to load the map, running through each line, adding 30 to an X (horisontal) value per every byte, and adding 30 to a Y (vertical) value per every new line. Then each time I came accross a "=", it would create a new instance of "block" (a custom type), and set its X and Y values to those previously mentioned.

This way I easily could make as many maps as I wanted, to any size at all.

Drawing the map was no big deal either, You basically tell blitz to draw a pixmap at the X and Y positions for each and every tile, blitz will deal with clipping any you dont want. To make it so you can scroll about the place, following your main character, you subtract the characters X value (and half the width of the screen) from the X of each block you draw, and subtract the Y value (and half the height of the screen) from the Y value of each block.

This system can be easily modified to have other object (block) types as well, so you could have map:


______*_____
____________
_____/=\____
____/===\___
___@@@@@@@__
============
============

with "/" and "\" being slopes, and "@" being visable-yet-walk-thru-able blocks, and "*" being score or something, perhaps a teleporter.

Oooh, before I forget, To do collisions with the characters and with the "landscape" of blocks, use just standard mathmatical "If (me\x+me\width>platform\x) and (me\x<platform\x+platform\width)...", not the Blitzbasic image collision functions, as they are slower. But thats just a small point.

quote:
I've also got a problem with imagescollide. IT doesnt seem to work when using to types. I have a type for bullets, and a type for enemies, but i keep getting illegal type conversion errors. Each type has an x and y field, and this is what i'm trying to do :

If ImagesCollide (bullet,bullet\x,bullet\y,0,enemy,enemy\x,enemy\y,0) Then
....
end if


well... I thought that ImagesColide *had* to use actual BB images, I dont know, I've not got it installed currently. But you could probably use something like:


If ImagesColide (bullet\picture,bullet\x,bullet\y,0,enemy\picture,emeny\x,enemy\y,0) Then
...
End If

which would have bullet\picture being an image... If BB cannot have types containing images (I cannot remember), then you can easily change it to (bullet_picture,bullet\x,.....etc

quote:
Any help on that? Also,if anyone could point me to a tutorial on simple platform games,it'd be great.

well... I haven't done much blitzbasic for a while, I should do, but hardly ever use windows any more.

Bascially tho, I try and use techniques which are mathmatical as much as possible, and then its easy (relitively) to port a program/game from one language to another, rather than relying on Image based functions, for anything other than drawing, because they tend to be different, but all maths functions are the same (nearly )

Good luck, and I hope I helped some!

MadProf

------------------
7 days without prayer makes one weak.
------------------
This message edited only in the formatting. No content was changed.

[This message has been edited by MadProf (edited March 01, 2002).]

null
Junior Member

Posts: 7
From: UK
Registered: 02-26-2002
Thanx for your help, certainly has pointed me on course. When you say pixmap, do u mean a tilemap??? I presume that the total height of your tiles has to add up to the screen resolution you are using for it to fit snug.

null

null
Junior Member

Posts: 7
From: UK
Registered: 02-26-2002
hi

ps, i work out that to fill the view area with graphics at 800x600, for each screen you need roughly 19*25 tiles to fill it. Am i write in thinking that the level maps of @'s and -'s etc are going to be huge for a fairly long level!!??

null

MeanManInOz
Member

Posts: 388
From: Hobart, Tasmania, Australia
Registered: 06-26-2001
They will obviously grow in size as you build levels, but that's why you do it with a char array, it is memory efficient, and once you've built the framework, building a level editor is a snap.
MadProf
Member

Posts: 181
From: Larnaka, Cyprus
Registered: 01-24-2001
um... pixmap/tilemap... dunno. i'm looking the BB info up right now on their website...

I think what I mean by a pixmap is :


global gfx_block
gfx_block = LoadImage("block.bmp")

type of thing, so that you can


DrawImage gfx_block, x, y

to draw it whereever you want. then you'd draw multiple blocks with a loop running thru all your block data, and DrawImageing the same Image to screen each time.

About the blocks thing, yes, you do end up with *very* big"____=___" type things eventually, but for a big level, you are going to need a lot of data, and as MeanMan said, charmaps are memory effeciant, and very easy. I stored them in a file, and loaded it from there, Editing a text file like that takes only a few minutes, and you can see how the level is going to be, aproximately.

blocksize/screensize, yep. or you can draw onto another Image, and then draw it in the middle of the screen with player score/other info around the place.


+-----------------------+-------+
| | |
| | Score |
| *** | Could |
| * * | Go |
| * * __| Here. |
| * _______| | |
| [] _____/ | |
|______/ | |
| | |
+-----------------------+-------+
| Level Info Could go Here ... |
+-----------------------+-------+

something like that (in graphics, not ASCII )
(unless you like ASCII a lot!)

Cheers,

Dan

PS - I could send you my platform game if you want, its a bit messy around the edges still, but if you want to see it, I've still got it.

------------------
7 days without prayer makes one weak.

null
Junior Member

Posts: 7
From: UK
Registered: 02-26-2002
yes dan, that'd be great. mail it to platformdemo@jamnett.co.uk, thanks. I've got a scrolling map now up and running, what i'm trying to do now, is make certain tiles 'solid'. This also applies to platforms, ie :

+-------------------------+
| |
| |
| XXXX X |
| XXX |
| XXXXX |
|@@@@@@@@@@@@@@@@@@@@@@@@@|
+-------------------------+

In this example, how do i make the X's solid. I know i can assign values to each block in the type, but how do i set up an x/y mechanism, so my man reacts to these, and can stand on them etc etc?

Also, jumping. I have written a function that reduces the y value of the player to originalX - 40, then back up. Is there a better way?? This would have to take collisions with solid tiles into account. Any ideas?

I'm writing a level editor at the mo, for 25x19 maps (specifically for 800x600), which will let you build levels out of blocks with point and click ease, then generating the raw data from the picture. If there's one already one out there, where is it, i want it! And if not, i'll finish mine and anyones welcome to it.

[This message has been edited by null (edited March 01, 2002).]

MadProf
Member

Posts: 181
From: Larnaka, Cyprus
Registered: 01-24-2001
i also created a type for "character", which had these values:

x,y,width,height,x-speed,y-speed,picture,name,player

and perhaps a few more. those are the basic ones.

X and Y are obvious, ditto width and height. x-speed is a integer value, which can be positive or negative. the same with y-speed. each "frame" or run thru the main game loop, the code checks to see if the character is "allowed" to move x-speed pixels on the X axis. (Allowed means like colision detection and such). If allowed, then it would add the x-speed value to the X value, and, after doing the rest of that sort of thing (Y value, other characters, etc) it would draw each character at the specified X and Y positions.

About Collision detecting... um... basically, you can do a run thru all the blocks (if you are clever (unlike me) or spend a lot of time figurring it out (also unlike me) then you could just check the blocks "near" the character, to make things faster) and test to see if your character, if he is "over" the block (Y + Width is greater than Y_value_of_block and Y value is less than Y_value_of_block + Width_of_block), and if it is, then you test if adding the Y_speed will make the character be below the block. If so, then you change the Y_speed to 0, and then add the Y value to (block\Y - (character\Y + character\height)) (the difference between the foot of your character, and the top of the block). This then drops your character directly onto the block, and stops him/it from moving. Anyway, This is what I've done in my game/engine/whatever. It probably is possibly to figure out some super-cool algorithm which runs at double the speed and does colision detection for you, but I didn't. Too much time it would have taken when I wrote it .

Anyways... I've sent the file (.tar.gz, i think winzip can cope).

Dan

PS - What I was planning to do with the engine I wrote was to make a whole game engine with it, with an editor and everything, do do make a platform game all you needed to do was drop in the graphics and levels. I never made the rest, but perhaps we should try togeather to make a big platform game engine with all the bells and whistles ( as well as pullies, blocks and tackles, ladders, clarinets and brass section)?

------------------
7 days without prayer makes one weak.

null
Junior Member

Posts: 7
From: UK
Registered: 02-26-2002
a point and click game maker??? That would be good. Probably best to wait for blitzmax to come out september, cus we could then link our program directly into the compiler
Crptc_Prgrmr

Member

Posts: 169
From:
Registered: 02-05-2002
I don't know if anyone's interested, but there is a 2d game system, called Game Maker, which allows you to create all kinds of games with a very graphical interface, and a language nearly identical to C. Its very complete, and free.

Check it out at:
http://www.cs.uu.nl/people/markov/kids/gmaker/games2.html

MadProf
Member

Posts: 181
From: Larnaka, Cyprus
Registered: 01-24-2001
thanks for the link, but actually, i kinda like the idea of writing the engine. I like writing enginey type things That way I can work at a project until I prove it works, and then say "its done!!!" rather than have to spend time making graphics and levels and such.

I actually like making graphics, and levels, but I've never liked making graphics and levels for *my* games. odd.

Anyways, by game maker, originally, I was meaning like a *lot* of predefined engines and functions and such, that would link as librarys/includes directly into any blitzbasic project. So eventually it might look like:


include("platform_engine.bb")
include("map_loader.bb")

me_bmp = LoadImage("me.bmp")
me_person = CreateCharacter(me_bmp,7,9)
map = LoadMap("map.map")

type of thing, so all the functions needed to make a platform game are there, so no re-inventing the wheel is needed. I would also like to try writing this sort of thing in some other language too, like python, or C(++?), or something, so I can develop in linux.

I ntg now, mens breakfast at 20 to 8 tomorra morning at the church.

Dan/MadProf/Me/Whoever.

------------------
7 days without prayer makes one weak.

MeanManInOz
Member

Posts: 388
From: Hobart, Tasmania, Australia
Registered: 06-26-2001
Python ? Python is cool at what it does, but surely it's not the right choice for a game engine. C++ is the obvious choice on many levels, although the presentation layer is still going to be platform specific.
MadProf
Member

Posts: 181
From: Larnaka, Cyprus
Registered: 01-24-2001
well.. i'd have thought that it doesn't matter which language to use, really, these days. computers are fast enough that you can do 2d platform game graphics thru pretty much any language (although I would *not* want to try in intercal/BF/etc). Because a platform game isn't terribly complicated, its just a little fiddly in some of the maths and such, having it all as python would mean that a game creator could use an easy language, such as python, to learn some about game design, produce a few games, and then perhaps write an engine themselves in C++/C/Java/C#/whatever.

Python does all the object oriented stuff well, and so thats no problem, is easy, and elegant, so ditto, no problem. I'm not sure about compiling, but perhaps the parrot thing will have something to do with that. anyway, its not like theres anything wrong with a non-compiled language.

I dont think there is a "right choice" for languages. You can use whatever you want. Clanlib/SDL would be an obvious choice for the graphics in C(++), and then it would be platform independant.

MadProf

------------------
7 days without prayer makes one weak.