Re: How to do complex graphics output efficiently?
comp4k678 <[email protected]> Fri, 29 Jan 2016 12:40:19 +0100
| Newsgroups | gmane.games.devel.sweng |
|---|---|
| Message-ID | <[email protected]> |
Hi Peter If you want to learn the basics, the traditional way of running a game is with a game loop, an endless loop where you check input, update the internal game logic, and render the screen in that order. For 2d games, first you render the background, and then you render sprites on top of that, in order. For 2d games with animated sprites you simply draw a different frame at the position of each object each time you render the screen. The individual frames can be stored as any format, e.g. PNG. Forget about (animated) GIF, it's outdated. Historically, games are mostly written in C/C++, although Java probably is used on Android these days and I'm pretty sure Python has excellent support as well. When developing for a PC, I wouldn't do it in Java, although there's nothing wrong with the language per se, it's just not so much used for making 'simple' games so it will be hard to find help. So I'd probably go with Python so I don't have to wait for things to recompile as is the case with C/C++. Python is a fun and easy language to try things out with. For 2d games, the bare minimum you need is a language and a graphics library that allows you to draw sprites on the screen (so you don't have to manually update every pixel ;), and to get input from e.g. keyboard and mouse. For C/C++, SDL is a good choice although it's a bit old, but it will be quite efficient. (It probably won't use much of your GPU, instead, efficient CPU instructions are used, which is fine because the overhead involved with using a GPU will be larger than the speed gain for 2d. Even slow CPUs can handle 2d graphics perfectly well.) Also, be prepared to get better at programming as you go, the best school is to try things out, to look at other people's code and learn from that. For 3d games, if you don't want to use a framework, you'll have to learn plain OpenGL so your graphics card is used to render stuff, but most tutorials found on the web are incredibly outdated so the best way to go is read an experts book, but those are hard for a beginner. Also the way to set up an OpenGL context is platform dependent so you have to do the work again for each platform. And you can't just call OpenGL from your game objects because that will lead to a lot of code duplication and unnecessary coupling. So you'll have to write your own engine, which is a lot of work and so far from one's initial motive to make a fun and interesting game that it's really better to just use a decent engine. In the community, C++ is the most popular choice, you'll get the best performance but it's also a pain in the ass to wait for things to compile each time you change something, and you have to manually write header files which is unnessary work IMO, a machine should do this for you. Java is better in this regard but there aren't a lot of people using it for 3d games (unless maybe Android). Anyway it's been such a long time I did anything gamedev-related so don't take my word on what languages & library to use. But I'm pretty confident about what I said about the 'basics' of 2d & 3d development. Good luck Joeri On 01/29/2016 08:31 AM, Peter Nabbefeld wrote: > > Hi, > > I've never developed a game before, and I wonder how to do complex graphics > output efficiently. Currently, I dont't want to use a framework, just want > to learn some basics. > > So far, it's about these two issues: > > 1. In 2D games, You often have objects behaving equally, e.g. a swarm of > birds, all flapping with their wings - sometimes even asynchronous. From my > point of view there seem to be two possible solutions: (a) Using animated > GIFs (b) Using one object with several image layers, which could be drawn > individually using Flyweight objects with timers/counters. > > 2. How to make a 3D view with e.g. animated animals, fog, etc.? I want to > use Java, Ogre4J seems to be inactice since 2009, JOGL seems rather basic, > so is there any good framework to draw animated 3D objects? > > Kind regards > Peter > > _______________________________________________ > Sweng-Gamedev mailing list > [email protected] > http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com > _______________________________________________ Sweng-Gamedev mailing list [email protected] http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com