# PureBasic Forum

 It is currently Mon May 20, 2013 8:40 am

 All times are UTC + 1 hour

 Page 1 of 1 [ 13 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Tilemaps, etc..Posted: Mon Aug 29, 2011 11:16 pm

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
Are there any good examples of tilemap systems made in Purebasic?

I am just thinking ahead to my next project, and I really want to attempt a console style 2D RPG (ala early Final Fantasy and other SNES RPG's)
Pixel artists are some of the most expensive, so I'm gonna have to rely on free assets (there are some nice ones out there) and my ability to modify them (decently, I hope).

If anyone has thoughts about these types of games I'd like to hear them. I know there are a variety of ways you could do a Tiled Map system (Character substitution seems to be really popular, i.e Letter = Tile , saved in a text file format, sometimes with the structure being the actual map in-game)

I'm more interested in the effects side of things though. I've never worked with graphics of any kind before, beyond pasting some simple stuff together for a GUI in DarkBasic..

Doing special things like fade-in/out, or other such special effects. I'm not very good with the math involved in image transformation/manipulation etc.. So any good resources I could learn from would be a helpful start.

_________________

Top

 Post subject: Re: Tilemaps, etc..Posted: Mon Aug 29, 2011 11:41 pm
 User

Joined: Thu Feb 19, 2004 1:25 pm
Posts: 13
Tile mapping is really a very easy to do technique. I'm sure if you invest some thinking time you will figure it out yourself. I did.

To get you started:

per frame, you draw every tile that is visible on the buffer. The math is really easy.
Lets say you have a screen that is 800*600 pixels and your tile size is 20*20 (totally arbitrary) then you know you get 800/20=40 Tiles per column and 600/20=30 tile per row. So you do a loop: for 30 times, draw all 40 tiles in a line.
I store my tile indexes in a simple 2d array... you can do it by character, but i prefer to use integers and write my own editors... in the long run that is easier to work with when you actually see what you are doing.

Your "camera" on the map is just an offset in the level array by x,y.

And at that point you can already scroll per tile.

Softscrolling is done by using modulo. Divide a per pixel camera position by tilesize and you know which tiles to draw. Per pixel camera position modulo tilesize gives you how much you have to displace everything on drawing.

Hope that gives you some inspiration. I could do an example, but not before weekend as I have a couple of 12hr work days ahead of me this week.

Top

 Post subject: Re: Tilemaps, etc..Posted: Tue Aug 30, 2011 11:37 am

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
Is an Isometric view a lot harder to achieve?

I probably will end up making my own editor in the long run, although I am not sure of the style I want to do it in yet (orthogonal, isometric, etc)

_________________

Top

 Post subject: Re: Tilemaps, etc..Posted: Tue Aug 30, 2011 1:34 pm
 User

Joined: Thu Feb 19, 2004 1:25 pm
Posts: 13
I still managed to figure out Isometric tilemapping with a pencil and paper(those are some of the most important tools for a programmer - pencil, paper and an eraser), so I don't think it is much harder.
It poses some slightly more difficult challenges though, like drawing order, screen to map coordinate conversion etc.

No promises, but if I find time I may write some example code this weekend on general tilemapping and isometric tilemapping. I didn't spend much time thinking about Ultima style orthogonal, though (as it makes me feel queasy for some reason) so I will definitely skip that one.

Top

 Post subject: Re: Tilemaps, etc..Posted: Tue Aug 30, 2011 1:53 pm

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
No worries, I probably won't start this project for a while.

I'm just thinking ahead. I still have to finish my Text RPG Engine & Editor Tools

_________________

Top

 Post subject: Re: Tilemaps, etc..Posted: Wed Aug 31, 2011 6:19 pm

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
Another Question..

I don't know what's coming in PB 4.6, but just running on what we currently have. Could I do this with hardware acceleration? Using the Sprite3D related functions? any potential issues there?

Anyone know if there is stuff coming that allows for more/better 2D under Direct3D/OpenGL ?

_________________

Top

 Post subject: Re: Tilemaps, etc..Posted: Thu Sep 01, 2011 12:24 am
 User

Joined: Thu Feb 19, 2004 1:25 pm
Posts: 13
The 2D side of things is actually quite nice already. I probably wanted to do the example code with Canvas/software 2d for my convenience, though.
I wouldn't bother thinking about OpenGL/Directx, you don't need to know about those if you use Sprite3D, which works very fine.

Those shouldn't create any issues.

4.6 is supposed to have bigger improvements on the 3D engine part, which doesn't really have anything to do with the Sprite/Sprite3D side of things, but right now they are undocumented. Early this month the final version is planned for release which will bring documentation for the improved engine3d commands.
You would possibly want to use engine3d for creating a "real" 3d game. I don't care about those too much though and haven't used it so far. I don't have a lot of Math knowledge when it comes to 3d and also if you create a "real" 3d game, you also need 3d assets, which i suck at.

Also, I am an old fart and like the 2d look.

Top

 Post subject: Re: Tilemaps, etc..Posted: Thu Sep 01, 2011 8:55 pm

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
I agree with you. I very much like the old 2D look, specifically of older RPG's but even some of them from the 90's on Playstation did cool things with sprites in 3D-ish environments.

I also suck at math, and its why I haven't given serious tries to 3D, but I'm more interested in any performance benefits of using the hardware, I guess. However after playing Sacred 2:Fallen Angel, released just before Ascaron went under, I was very intrigued with making a game in 3D, and then locking the camera to a range that essentially mimics an Isometric Engine, except with Camera rotation.

Either way I suck at both 2D and 3D art of any kind.. I can't even do pixel arts lol

_________________

Top

 Post subject: Re: Tilemaps, etc..Posted: Thu Sep 01, 2011 9:56 pm
 User

Joined: Thu Feb 19, 2004 1:25 pm
Posts: 13
Actually, using the
Engine3D commands to create a 3d environment and having 2D figures in it might work. You could even have all the game logic be 2d and even use Tilemapping with 3d objects. However, I'd have to look into that myself which I don't really have time for right now, so I will stick to true 2d with accelerated Sprite3ds.

As for art. Well, I'm trying to learn drawing now but so far I suck at that too. However, there is one way to get nice graphics with zero talent. There are special 3d programs with some free and a lot of rather inexpensive assets.

Have a look at DazStudio http://www.daz3d.com/i/software/daz_studio?
or http://poser.smithmicro.com/poser.html. I use the later for isometric renderings of 3d chars which are entirely made from stock content.

Top

 Post subject: Re: Tilemaps, etc..Posted: Thu Sep 01, 2011 11:33 pm
 Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
you should take a look at this

http://forums.purebasic.com/english/vie ... hp?t=12351

_________________
http://www.mediafire.com/pbstuff

Top

 Post subject: Re: Tilemaps, etc..Posted: Thu Sep 01, 2011 11:36 pm

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA

I have a resource in mind, that has free to use "Chipsets" (Environment, Characters, Objects, etc) in the RPGMaker style, which I like because its basically just like old SNES RPG's.
Hopefully I can modify some of that to look a little unique. But like I said the project is off in the future for now, and I'm just collecting ideas and asking some questions.

I might experiment with 3D Env/2D assets at some point later.

_________________

Top

 Post subject: Re: Tilemaps, etc..Posted: Fri Sep 02, 2011 9:39 am
 User

Joined: Thu Feb 19, 2004 1:25 pm
Posts: 13
Be careful with these resources though... a lot of them are ripped from commercial games. Now, I don't think there is a lot reason for companies to defend 15 year old sprite resources, but you never know.

Top

 Post subject: Re: Tilemaps, etc..Posted: Fri Sep 02, 2011 5:17 pm

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1284
Location: Waterloo, WI - USA
I'm careful about that, and it's usually pretty obvious when things come from games, imho. But I grew up on a lot of those games so maybe its easier for me to tell..

Either way, most of the ones I have in mind are originals, released by a specific person/group.

_________________

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 13 posts ]

 All times are UTC + 1 hour

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forum

Search for:
 Jump to:  Select a forum ------------------ PureBasic    Coding Questions    Game Programming    3D Programming    Assembly Programming    The PureBasic Editor    The PureBasic Form Designer    General Discussion    Feature Requests and Wishlists    Tricks 'n' Tips Bug Reports    Bugs - Windows    Bugs - Linux    Bugs - Mac OSX    Bugs - Documentation OS Specific    AmigaOS    Linux    Windows    Mac OSX Miscellaneous    Announcement    Off Topic Showcase    Applications - Feedback and Discussion    PureFORM & JaPBe    TailBite