PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Gapidraw TileDemo help...

Okay, I have to finally face the music, the games I want to make require a scrolling world, 2d side scroller to be exact.

the thing is, ive avoided doing this like the plague...partially because im not an artist, partially because it seemd quite complex... so now though its time to face the music.

I noticed that the gapidraw release has a nice tiledemo, that uses a thing called tile studio. after about 1/2 hour of playing with tile studio i have some vague idea of the whole process for creating a level (though It seems to do sprites as well, and I dont understand how, i have my own sprite class i use).

So my question is, what do i have to do to get the tile studio stuff working under gapidraw...it says in the tile demo main cpp file header comment:
"Modified to work with GapiDraw by Johan Sanneblad"

Okay so what exactly was modified? as in if i want to use tile studio (the best option now? so i dont have to write my own tile ripper, and map editor and map exporter) with gapidraw, what needs to be done/change everytime I make a level, what pitfalls do I have to look for, what is the quickest path to getting just a simple sprite jumping around on the screen with tiles that have properties to not allow passing of sprite from one direciton or the other, i suspect i would have to write all this code that handles the collision of tiles (not sure how to do this) by somehow colliding tiles and then checking their values (that little hex/decimal value in tilestudio i can edit) to see what the properties of the tile is...

okay then I noticed in the tiledemo there are a bunch of fucntions like:
Clip
CalcLayerPos
MoveScreenTo
CorrectView
etc.. etc..
are these basically generic functions that any game using tilestudio maps in gapidraw would need? I just have to start out by editing or creating varations of these functions that handle the animation andd rawing of my sprites using my sprite class?

Any help to get me full steam ahead here would be greatly appreciated, as tackling and figuring out tilestudio will be a great task unto itself.
(not to mention making myself an artist to create tiles for my levels of the simple run jump attack game i want to try to make)

Thank you,

-Shane
i dont know exactly how the tiledemo works, but it might be reading the file created with tilestudio. so what you have to do is see how it looks like and base your engine on that editor. or else just create a converter to your own fileformat. basically you need a map which indicates how many tiles there are in the x/y direction, for each tile have a index to the tile texture map, know if its solid or not so character can 'know' where to walk or collide.
i find the drawing and map building to be the hardest.. once you have a world created is not that hard to put it on the screen and with some char jumping around with some simple physics..
in the future you might end up writing your own editor, for anything that lacks in tilestudio
hope i was of any help
I would also like to use TileStudio with GapiDraw but there aren't any simple tutorials to help get people started. The only examples I've found are'nt for GapiDraw.

Johan, isn't there any way you could create a simple tutorial on how to do some of the basics, or how to use the existing TileStudio tutorial with GapiDraw. I'm sure if this process was simpler more people would flock to GapiDraw for their tile-based games.

I left a thread on the TileStudio forum a long time ago but nobody seems to use this anymore.

Hope somebody can help.

Thanks,
I am not familiar with TileStudio, but I can tell you my advice for scrolling.

I believe it is all about coordinate systems. Define the coordinate system of your world. Then define how that world's coordinate system is transformed to appear on the screen.

Do pretty much everything in world coordinates. For example, let's say you want to select a game object by clicking on the screen. Simply transform the screen point to a world point, then do the selection in world coordinates.

Scrolling then becomes easy: you just move the view origin in the world. When you draw, only draw what is visible in the view.
whaleyboy · 23 Sep 2004, 11:24 UTC — Tile Studio
Sorry to dig this thread up from the past, but I have also been looking for a simple tutorial on getting started with using gapidraw with tilestudio. I posted a message on the tilestudio site, but as PDA Monkey has had no luck in getting a response I thought I'd try here. Instead of typing it out again I'll do a quick copy/paste:

I am currently putting together a side scrolling shoot'em up using GapiDraw. I have been looking into TileStudio to create the scrolling backgrounds I will need. I read through the tutorial and read through the 'TileDemo' that comes with GapiDraw that is supposed to demonstrate how to use TileStudio with GapiDraw. As I am just starting out as a game programmer I found it quite complicated to follow exactly what was going on (the lack of comments didn't help). I know this is rather a major thing to ask, but could anyone walk me through exactly what is going on in that TileDemo program, or if it is easier, the basic steps I need to complete in getting my GapiDraw program to display tiles created in TileStudio (I don't need to use animated tiles and a single layer of tiles would suffice for starters)? Any assistance would be greatly appreciated! :)
Try searching for key words like game, programming, tile, scrolling.

Here are some articles, maybe some will help.

http://www.gamedev.net/reference/list.asp?categoryid=44
Yeah, I've looked into making my own tile engine, which shouldn't be a problem. My main problem is with how Tile Studio creates the code that you import into your own program. It creates a couple of structs and loads of different variables and pointers and has no documentation as to what each does or how to use it correctly. All I really need is for the code it generates to have proper comments so I can more easily figure out exactly what I need to do with it. Even the tiledemo you get with gapidraw isn't commented well. :(
If we make the assumption that the world you create will be constructed by putting together a bunch of tiles to form the image on the screen, I have a suggestion for writing your own editor that may seem bizarre to some...

Use Microsoft Excel.

Seriously.

The benefit is you already have a giant sheet of graph paper, in essence, to draw on. You can write some relatively simple VBScript to do whatever you need, and finally output a binary file in whatever format you want. Then just import it into your project, use it as you would any block of memory, and off you go.

That's actually how I did the level maps for K&G; Arcade. Granted I didn't have too many tile types to deal with, but the concept is exactly the same. In fact, you can do something as simple as just saying that a "1" in a cell represents a certain tile, "2" another, "A" a third, and so on, and just manually enter the values in the cells, or you can do something much fancier and have a form off to the side that renders your map as you draw it. Up to you.

But the point is, Excel is a fantastic tool, with a little bit of scripting behind it, for many things in game development.
Another zany tool to use is an image program like Paint Shop Pro or Photoshop. You can use layers and draw all your tiles (1 per pixel). When done, export as XPM. That format is ready to use in C directly. Just use one colour per tile type and you are all set.
That's an interesting thought... Wouldn't you just wind up with a giant mosaic of colos though? Strikes me as a bit tough to work with (especially a month down the road when you want to tweak the map a little bit).

I'm a PSP fan myself though, and there's certainly plenty of unusual ways to use it.
For just static tiles, why not draw your map as a big bitmap in Photoshop/whatever and have a little c script parse it out for you? Just set photoshop's grid to your tile-dimensions and place your tiles as appropriate.

Perfect visualization. If you only operate with a certain set of tiles distinct tiles, it shouldn't even take that long to generate a map file.

If you really wanted to free-hand it, you could edit the map by hand and have the script generate your tileset too.

That was my plan for a level editor. Let you know how it works out, if I ever get any free time.
Say you want a 64x64 map with 10 different tiles. Make a 64x64 image with a palette of 10 colours. Turn off antialiasing and all that. Zoom in so the image pixels are larger than the screen pixels. Draw your map.

If you save your map as XPM, you don't have to parse it or anything, it's already C code. XPM is C code.

Here's an image: Image

Here's the XPM:

Code:

/* XPM */
static char *www[] = {
/* columns rows colors chars-per-pixel */
"18 16 41 1",
" c #141029",
". c #20274D",
"X c #4A2F45",
"o c #636260",
"O c #455F8E",
"+ c #597798",
"@ c #407AA7",
"# c #4E88AA",
"$ c #5A9BBC",
"% c #738291",
"& c #6A92A6",
"* c #7E94A7",
"= c #79A2B9",
"- c #4BAAFB",
"; c #6AADE8",
": c #69CBFB",
"> c #AE1E04",
", c #9E755A",
"< c #FB4606",
"1 c #FF6E16",
"2 c #B09771",
"3 c #FF8214",
"4 c #FD9732",
"5 c #FFBB09",
"6 c #FFB22F",
"7 c #FFB979",
"8 c #FFCB3E",
"9 c #85A8BE",
"0 c #8DB5CA",
"q c #8CD6F3",
"w c #80FAFF",
"e c #FFCB97",
"r c #C3F8FF",
"t c #DCF6FD",
"y c LightCyan",
"u c #F2FFFE",
"i c #FBFBFB",
"p c #FFFFFA",
"a c #FCFFFF",
"s c gray100",
"d c None",
/* pixels */
"dddddddddddddddddd",
"dddddddddddd,odddd",
"dddddddd468dX>dddd",
"ddddddd436641<dddd",
"dddddd43664334dddd",
"ddddd446641<es4ddd",
"dddd446641<7iuy4dd",
"ddd645641<7sutrr4d",
"dddd&231<4sssurrqd",
"dddd@w2>,ssr9+=qwd",
"dddd+w:$:pa0. +qqd",
"dddd#w:-:st9. +q:d",
"ddddd;:-;pr9. +q:d",
"dddddd$-;ir=..@#Od",
"dddddddO-uq#+*dddd",
"dddddddd%odddddddd"
};


If you want tile transitions though, you'd have to add those programmatically. But that's relatively trivial.

I've used this approach and it works.

Graphics programs have scripting languages so you can probably make use of them.

Another idea is to use a text processor (e.g. awk or perl) to process the data from the XPM into another format. I've done that and it works well enough.

The salient point here is to leverage existing tools for all they are worth.
Sorry for not responding earlier to this thread, but if you take a close look and try to understand the tilestudio file format it's really not all that difficult. The sample application is difficult to understand however, the only modifications I did was to make it fit into the GapiApplication framework and replace the DirectDraw calls into GapiSurface calls.

Try reading the output from TileStudio (begin with a small 2x2 tile map) and try to blit them on the display. Then expand from that. If you don't understand the file format you are perhaps better of using another tool such as Excel or Photoshop as mentioned above.

//Johan