• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Jeffy

Looking to get into sprite-based 2D game programming

10 posts in this topic

Hi,

 

Would consider myself an intermediate C++ programmer and I would like to learn some game programming but I do not really know where to start looking. From what I gathered, either OpenGL or Direct X is supposed to be the starting point for 3d programming. That or making use of an engine like Ogre.

 

But what about 2d games? This following example appears to be 100% 2D:

 

http://www.ifightbears.co.uk/

 

 

Where can I find a good starting point for learning about entirely sprite-based 2D games?

 

-Jeffy

 

 

 

 

1

Share this post


Link to post
Share on other sites

Maybe you could look at the communities around software commonly used to make 2d games, like GameMaker and Flash. Or focus on a genre dominated by 2D, like platformers or mobile-casual.

0

Share this post


Link to post
Share on other sites

We'll a few good 2D libraries are:

 

- Allegro 

- SDL

- SFML

 

I would personally recommend SFML because it's a very clean modern library that is fully object orientated. The other libraries are very C like.

The only problem you will experience with SFML is that SFML 2 has been released but it does not yet have it's tutorials updated. You can go

with SFML 1.6 but then you'd have to learn the new systax once SFML 2 is fully updated. What you can do however is use the tutorials that

they have on their site concerning SFML 2 and just modify the SFML 1.6 version in the areas where the tutorials have not yet been covered.

 

Good luck.

2

Share this post


Link to post
Share on other sites

SFML is what you want, of the top 2d libs it's the only one that is OOP.  Check my sig.

Edited by EddieV223
1

Share this post


Link to post
Share on other sites

Thanks for the great replies everyone.

I am going to work through Seraph's tutorial as it appears to be exactly what I was looking for.

 

 

Most 2D games you see today are using either DirectX or OpenGL in some way to do their rendering.

How do you spot wether a game is purely 2D or just being 2D while using DX/OGL? I do not know much about the subject, but from what I can tell that bear fighting game I linked appears to be straight 2D without anything 3D-accelerated. Basically trying to see what the limits are to 2D as far as visual FX is concerned.

 

 

Also a few things about terminolgy.

DirectX and OpenGL are basically interfaces that allow the programmer to access the GFX card and SFML(and the others mentioned in the topic) are basically the same but without the 3d capabilites?

0

Share this post


Link to post
Share on other sites

To be honest, it's almost impossible to know for sure unless you've been told.

 

If you go way back to some very old 3d games like Doom, they didn't use a 3d api to make 3d games. They used a 2d API (probably drawing directly to the video frame buffer). It manually did what is now built in to graphics cards. There isn't really anything limiting you by using a 2d API except for the speed of your processor and your own knowledge of 3d mathematics.

 

Going the other way, a programmer can ignore basically all 3d accellerated features of their API to make their 2d game. The programmer would use 'textured quads' to draw 2d sprites. Once that's implmented all the programmer needs to do is say "draw this sprite at this location" to make their 2d game.

 

All that being said, there are often hints when seeing a 2d game whether it uses a 3d API under the hood. Rotating sprites is a costly process without using a 3d API in some way. So if you see a lot of rotation it's probably using 3d api. If you see things like the view smoothly zooming in and out on the action that's probably using a 3d API. If you see transparency changes (fade in/out) it's probably using a 3d API. But again, that's all possible without a 3d API.

 

Things are further confused because a 2d API might be implemented using a 3d API. SFML is implemented in OpenGL for example (and uses that 'textured quads' thing). Because it uses OpenGL, rotating and zooming and using transparency in SFML is simple and fast. SDL was not implemented in a 3d api so you can only do rotating and zooming manually or by getting an add-on, that also does it manually. While SDL allows interoperability with OpenGL, It just creates the window and then the programmer switches to using OpenGL functions so it's mainly just to help set things up in that situation.

0

Share this post


Link to post
Share on other sites

I do not know much about the subject, but from what I can tell that bear fighting game I linked appears to be straight 2D without anything 3D-accelerated.

 

Given that Fist of Awesome runs on OUYA, iOS, and Android, it's safe to assume that everything is rendered using OpenGL ES. You can't (visually) tell the difference between drawing the individual pixels using something like GDI+ vs drawing textured quads using OGL or DX. They look exactly the same. Either one can be 'purely 2D.' It's just a matter of setting up the states/shaders to get things to look they way you want it. Take the below screenshot from a game a friend and I worked on for example:

MainScreen.jpg

 

Everything is drawn using DirectX 9 (to be more accurate, it uses a wrapper around it called XNA.) Basically you create a bunch of textured squares ( called quads ) send those to the GPU and they pop up on the screen. The projection matrices are set up so that everything is projected into 2D space; there is no 3D.

 

So, OGL and DX are not 3D specific. They are more like this generic blob that can do whatever you ask them to do (more or less.) You want 2D? Great, build yourself a shader and set up the correct matrices and you got it. 3D? Same story, create your shaders, set you states, read a couple math books and you are good to go.

 

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0