Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2d maps (sort of)

Author
Message
jayjey
12
Years of Service
User Offline
Joined: 17th Feb 2012
Location:
Posted: 17th Mar 2012 18:11
In a 2d game sometimes you can't fit everything on one screen. So how do you move the screen? Is there in equivalent to cameras in 3d?
Design Runner
13
Years of Service
User Offline
Joined: 16th Oct 2010
Location: In my own little world.
Posted: 17th Mar 2012 18:45
You don't move the screen, you move new things onto the screen. If the window for the game is 100x100, place an object at 110x110, then move it to 95x95, suddenly it is visible.

Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Mar 2012 15:08
The old technique used to be to make tiles, and position the tiles to make a screen, and then position an extra set of tiles outside of the screen in the scroll direction. Say if the tiles are 32*32, you have 32 pixels outside of the screen area. Now you can 'get image' the entire screen, and move it, then redraw the extra line of tiles at the end. When the tiles are all moved over, you add a new line of tiles to the end.

However. The new method is to use 3D as 2D. Instead of 'get image', it is faster to move the camera. You can still add an extra line of tiles, but you can use the tiles that have scrolled off the other end of the screen, and re-texture them.

Yet another method would be to use plains the size of the screen. Then to use 2 plains at the same time. Scroll those off the screen, and use whole images for your background. This method doesn't require tiles, so can be more detailed, but uses more memory. To release some of the memory, you could convert the screens to 256 colours using Photoshop's adaptive palette conversion. This would be my choice, because I have noticed that 256 colours has a nice retro look to it.

jayjey
12
Years of Service
User Offline
Joined: 17th Feb 2012
Location:
Posted: 18th Mar 2012 17:50
Thank You, The best idea seems to be to use 3D as 2D. The only problem is that the camera doesn't seem to work in 2D. Is the solution to use sprites in 3D?
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 18th Mar 2012 21:08
You texture small plains. You only need to texture the ones that are about to be scrolled onto the screen.

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Mar 2012 13:24
The best thing about using 3D, is you have so many options.

For instance, you can make a tileset map as a big 3D object, as lots of plains, as a matrix with each tile textured to suit, as a memblock object. A matrix is actually a pretty handy way to work, easy to get started.

If you position the camera above a matrix and rotate it 90,0,0 then it is pointing straight down, so then the 3D X and Z coordinates become the screen X and Y coordinates. You have to decide on a world unit size, like if your tiles are 32x32 each, maybe just using 32x32 for the tile size is the best bet, emulate a 2D coordinate system that way. Matrices are good for tile sets, they use one as a standard, so you just really have to worry about setting the matrix tiles, then position the camera on top, pointing down, and you have a 2.5D tile engine.

Most of my games are fake 2D, I just prefer to work like that. My current project uses plains, big backdrop plains and foreground plains, plains and alpha trans textures for particles. I have a segmented plain mesh as well, that I modify with vertex commands to make an animated water effect, realtime water, even the UV mapping is realtime.

With 3D, it's not a case of ignoring one dimension, you can never do that because there is still Z depth sorting and other issues like that. It works both ways - 3D can introduce problems with zdepth, but it also introduces shaders, bone animated models, different effects for particles etc etc.

Health, Ammo, and bacon and eggs!
jayjey
12
Years of Service
User Offline
Joined: 17th Feb 2012
Location:
Posted: 19th Mar 2012 20:32
Do you know of any book or article that just explains the basics of Dark GDK for new users?
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 19th Mar 2012 21:18 Edited at: 19th Mar 2012 21:19
You need to ask in another forum related to Dark GDK. However, if you find it complicated.. DBPro will easily make a 2D/3D game so fast that you will have to slow it down. I would imagine that DBPro is simpler than Dark GDK.

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Mar 2012 18:31
Yeah, I wouldn't start out with GDK - start with DBPro, get to grips with the engine, then migrate to GDK later if you like. You can always use DBPro for prototyping ideas quickly. One thing with C++, your always better having a plan before starting, it's not ideal for experimental work. Also, I would recommend making your tools in DBPro - like level editors and stuff like that.

Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2024-03-28 13:40:40
Your offset time is: 2024-03-28 13:40:40