123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|718|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Tile-based map games on Blitz2D

Mon, 09 Nov 2009, 03:11
LostUser
I'm thinking of recreating Miami Vice (for the Commodore 64) on Blitz,

URL:
https://www.miami-vice.org/forum/forum_posts.asp?TID=1453

Or, at the very least using the map as somewhere to move around; I guess it would be a turn-based GTA game, sorta like Crime Fighter (url:https://www.pssoft.de/english/index.html)

I've never done tile-based maps before, so hopefully I can get pointers.

There is a full-size map posted here:

And here is one cut up:


However I am not sure:

1) How do I restrict the map to say 320x480 viewport on a 640x480 screensize?

2) With regards to the full size map posted above, what is the best way to resolve this with Blitz? Is it a case of splitting things up?

2) How do I make the map move around based around where the character sprite is?

3) How do I make it so you can't move a character sprite into buildings, or into the sea, things like that?

4) How do I make the map move, but when you get to the edges you don't see lots of black space?

5) Is it possible to have multiple players on the map in different locations which move without you actually seeing them moving?

For example, there are 6 players. You are in the top left, and the other players are randomly placed on the screen somewhere.

Is it possible for the AI to move these players without you seeing them move *unless you are on the same screen as they are?

6) What about handling projectiles (bullets, other cars, and other collisions)?

I'm thinking of using the collision library posted on the code snippets as this seems to work with lots of sprites on the screen.

Any starting pointers would be great.
Mon, 09 Nov 2009, 03:46
Jayenkai
1. For viewports, use Window, which sets all drawing to a preset area.
Don't forget to set it back again, though!!

2. Tiles!
Draw over the image with a 48x48 grid, and you'll be able to easily see how it all pieces together.


Next up, cut each different tile you can spot, and stick them all onto a single tiles image.


Next, go through your map with Notepad open, and write down a letter for each tile.. A being top left (two bits of grass) on the tiles image, X being the helipad.

For every tile on the map, write down the associated tile's letter, and bit by bit rebuild the map in notepad.

Once all of That's done.. Get into the code.
Load the tiles as one image, then load the map data in.
To draw the map..


3. To center the player, ScrollX=PlayerX-(ScreenWidth/2), and the same for Y.

4. Add little breaks to the edges..
if ScrollX>0 then ScrollX=0
if ScrollX<-(1920-ScreenWidth) then ScrollX=-(1920-ScreenWidth)
same for Y.

5. Of course! Just because you don't draw everything doesn't mean it's still not working away inside the code underneath.
Drawing <> Doing

6. However you wish to treat them. Shove them in an array, or a type, or whatever, and just keep them working away in the background.
For building collisions, treat each tile as either Solid or not, and you'll be able to figure out when things hit buildings pretty easily.



* Note, all these are things I usually redo every week, or at least whenever I need a tile map, so I've gotten pretty quick at doing it. But even then, I still tend to do all my pluses and minuses wrong, and have to keep going back and fixing them each week! So you might need to reverse a few of those bits of maths!

(Blimey, what a big post!)

-=-=-
''Load, Next List!''
Mon, 09 Nov 2009, 04:04
LostUser
Wow, that's a great help. I wasn't expecting the quality of information, but thanks a lot.

Is there any articles, or even a very very basic tile based program in Blitz I can have a look at?

I think combining the Tile based library and the collision library would be very helpful.

I have another question. The big map has buildings, but none of the buildings have doors. I obviously have to draw them on, but my question is how to make the system register understand what the doors are, and what they do.

Ie: Go in to warehouse door, get warehouse screen, etc.

Another question.

Lets assume there are 6 players, 5 of which are AI -- how do I make it understand waypoints? Part of my idea is that you're actively playing the game with 5 other AI gamers who are also trying to achieve the same goal as you.

I'm intending to make this as an experimental sequel to my current game which is all button/menu based.

Thanks.
Mon, 09 Nov 2009, 04:14
Jayenkai
The best way to learn is to try out things yourself. If you find something doesn't work, then redo and try something else.

Doors should be easy to implement, but you'll need to draw extra tiles for those, and allow the door tiles to be passable.

For building interiors, add extra sections on the map, outside of the usual available area, and teleport users from Door to Interior

It's simple stuff, just a case of trial and error.

And, probably best not to think of "Waypoints", more "Can't go into building, so probably best to go a different direction"

-=-=-
''Load, Next List!''
Mon, 09 Nov 2009, 05:14
LostUser
Regarding Waypoints.

My idea is that the AI players are attempting to do the same task/objective you're doing; as well as instructing NPC's to do tasks/objectives.

ie: Go to building X, do action, etc.

My idea is to take my turn-based button based game (nearing competition) into a turn-based tile-based RPG/action/strategy game similar to crime-fighter; or a turn-based GTA game.

The objective is to take over specific rackets/buildings and take over the city, so I believe waypoints, or some way to code objectives into the game would still be important or relevant.

I think I need to experiment with what I've got so far before I get ahead of myself, as I have a nature of doing that and then I end up scaling things down.

Thanks for your help.