Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.
Ok, I'm starting this mega thread because I'm looking for help when it comes to game development on Linux, but rather than post my own thread I thought it might be a good idea to start a mega thread.

The thread should cover stuff like:

General Game Development Theory
OpenGL Development
DirectX Development
Libraries (SDL/Alegro/XNA)
Multiplayer/Networking
Game Sound

Adbot
ADBOT LOVES YOU

Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.
The last couple of days, I have been putting to paper a designing for game I've been thinking about for a couple of weeks and now I'd like to put it in to development.

Graphically, it's not a complicated game, think along the lines of Tron/Rez wireframe, but to be honest I'm having difficulty finding a good Linux based tutorials to start me off. I did some C/OpenGL development back on Windows, but that's coming up to about 7 years ago so I'm really rusty.

Can anyone point out some good tutorials. I'm thinking going with SDL is probably my best option , although I'm happy to look at anyone else's suggestions.

Bizarro Buddha
Feb 11, 2007
http://gpwiki.org/

GPWiki has a bunch of tutorials for all sorts of stuff. They're not the most up-to-date, but they're a starting point.

http://nehe.gamedev.net/

NeHe always gets brought up when people want OpenGL tutorials. I've not actually used them myself, though, so I can't vouch for how good they really are.

I'm just starting to get into OpenGL with SDL myself. I've got an OpenGL book that I'm continually putting off reading. :(

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha
NeHe opengl with glut and openal?

Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.

Bizarro Buddha posted:

http://gpwiki.org/

GPWiki has a bunch of tutorials for all sorts of stuff. They're not the most up-to-date, but they're a starting point.

http://nehe.gamedev.net/

NeHe always gets brought up when people want OpenGL tutorials. I've not actually used them myself, though, so I can't vouch for how good they really are.

I'm just starting to get into OpenGL with SDL myself. I've got an OpenGL book that I'm continually putting off reading. :(

Yea, I've looked at NeHe - looks ok, but I can't find a downloadable version for working on my commute, and it's pretty windows oriented :( I've got the red book too, but it's quite a few years old now (got it about the time Quake 3 came out) so I don't know how up to date it is, but I suppose for the simple graphics I want to do it'll probably be a good start

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha
http://www.legalsoft.com.cn/download/go.asp?i=4&n=/download/cg/nehe.pdf
Will this work, its dated Dec 2004 which is a bit of a bummer, but should be right for the most part.
If you look at that pdf, the first slide is setting up in MacOS with glut.
Follow that guide and you'll have a window created for you with your render function set.
Not sure how large your project is, but that's pretty simple for a lot of stuff.

Doc Block
Apr 15, 2003
Fun Shoe
Stay the hell away from NeHe's tutorials, they're terrible. Instead, start off with the ones by Nate Robbins, which are drat nice and even mentioned in the OpenGL Red Book.

Also, the OpenGL Red Book is recent if you've got one that covers the latest version of OpenGL. Right now OpenGL is at 2.1, with 3.0 coming out "real soon now". I've got the one that covers both 1.5 and 2.0, so mine isn't too out of date.

If your Red Book is from the Quake III era, just get a newer, more up-to-date one.

Get the OpenGL Orange Book whose version matches the new Red Book you're going to buy :)

If you want to do any sort of semi-advanced graphics at all, get GPU Gems 1, 2, & 3. Also check out the Game Programming Gems series.

Use SDL for window creation/handling and input with OpenGL for graphics. It runs on pretty much every platform under the sun, and unlike GLUT it's meant for more than just toy applications.

It'll probably be easier to use an existing engine or renderer, though. OGRE and Horde3D seem like decent open-source renderers. There's also Open Scene Graph. When it comes to closed-source engines, there's always Torque, but I don't know how well that runs on Linux these days.

Ferg
May 6, 2007

Lipstick Apathy

kewlpc posted:

It'll probably be easier to use an existing engine or renderer, though. OGRE and Horde3D seem like decent open-source renderers. There's also Open Scene Graph. When it comes to closed-source engines, there's always Torque, but I don't know how well that runs on Linux these days.
As a brand new 3D programmer I picked up OGRE for my game engine. It's pretty powerful, but keeps stuff simple. I've spoken with a few folks who have written their own graphics engines from scratch, and it sounds like I'm doing the right thing using a pre-built engine before tackling my own.

Edit: I had never checked out Horde3D before, this looks way way more lightweight than OGRE is. Are any of you experienced in both that you could sum up the pros and cons of each? OGRE is seriously robust, but I find it frustrating that my engine has a lengthy load time using the bare minimum requisites to run an OGRE application.

Ferg fucked around with this message at 15:57 on Nov 24, 2007

Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.

kewlpc posted:

Stay the hell away from NeHe's tutorials, they're terrible. Instead, start off with the ones by Nate Robbins, which are drat nice and even mentioned in the OpenGL Red Book.

Also, the OpenGL Red Book is recent if you've got one that covers the latest version of OpenGL. Right now OpenGL is at 2.1, with 3.0 coming out "real soon now". I've got the one that covers both 1.5 and 2.0, so mine isn't too out of date.

If your Red Book is from the Quake III era, just get a newer, more up-to-date one.

Get the OpenGL Orange Book whose version matches the new Red Book you're going to buy :)

If you want to do any sort of semi-advanced graphics at all, get GPU Gems 1, 2, & 3. Also check out the Game Programming Gems series.

Use SDL for window creation/handling and input with OpenGL for graphics. It runs on pretty much every platform under the sun, and unlike GLUT it's meant for more than just toy applications.

It'll probably be easier to use an existing engine or renderer, though. OGRE and Horde3D seem like decent open-source renderers. There's also Open Scene Graph. When it comes to closed-source engines, there's always Torque, but I don't know how well that runs on Linux these days.

Yea, I was thinking of getting an up to date book, mine only covers OpenGL 1.2, which is fine for me at the moment, but if I intend to do more advanced stuff a new red + orange book might be an idea (although I am only running on a crappy Intel built in graphics card on my laptop).

I've got Torque, I've had the licence for about 6 years now, but in that time the documentation has never really improved and it's even worse for Linux.

I'll check out Horde3D - I looked at Ogre3D, but it didn't really have good linux docs too.

zigb
Mar 21, 2007
Is this a good place to talk Source engine modding/development, or should that go elsewhere?

csammis
Aug 26, 2003

Mental Institution

zigb posted:

Is this a good place to talk Source engine modding/development, or should that go elsewhere?

It's a game engine, this is a game development megathread, go for it.

Subotai
Jan 24, 2004

How do I translate screen space coordinates to world space coordinates in D3D? For instance I have a texture that is 200x100 pixels and I want to find out the world space size for that texture. How the 200x100 translates to world space coordinates.

Madox
Oct 25, 2004
Recedite, plebes!

Subotai posted:

How do I translate screen space coordinates to world space coordinates in D3D? For instance I have a texture that is 200x100 pixels and I want to find out the world space size for that texture. How the 200x100 translates to world space coordinates.

You question doesn't really make sense. It doesn't matter what screen size a texture is. It can be stretched onto any sized surface in world space. On the other hand, if you were to display the texture on the front clip plane without stretching it, it would still appear to be be 200x100.

Subotai
Jan 24, 2004

Madox posted:

You question doesn't really make sense. It doesn't matter what screen size a texture is. It can be stretched onto any sized surface in world space. On the other hand, if you were to display the texture on the front clip plane without stretching it, it would still appear to be be 200x100.

Well I have a texture I am dynamically generating and putting text on it and then putting it on a billboard. The billboard size is defined in world space coordinates and I need it to match the texture size which is defined in pixels. If the sizes dont match the text looks stretched or squished.

Kerris
Jul 12, 2006
Don't you fucking dare compliment a woman's voice on the forums, you fucking creepy stalker.
http://wiki.freegamedev.net/
http://forum.freegamedev.net/

- Free as in speech? Mainly frequented by OSS game developers.


http://nightschool.near-time.net/

- Blog on physics engines, collision detection, internet multiplay.


http://aigamedev.com/

- Site (includes blog) on Game AI development and implementation.

haveblue
Aug 15, 2005



Toilet Rascal

Subotai posted:

Well I have a texture I am dynamically generating and putting text on it and then putting it on a billboard. The billboard size is defined in world space coordinates and I need it to match the texture size which is defined in pixels. If the sizes dont match the text looks stretched or squished.

Without knowing exactly what you intend to do with this texture, it sounds like it may be easier to change the projection/viewport so that world space is identical to screen space.

Madox
Oct 25, 2004
Recedite, plebes!

Subotai posted:

Well I have a texture I am dynamically generating and putting text on it and then putting it on a billboard. The billboard size is defined in world space coordinates and I need it to match the texture size which is defined in pixels. If the sizes dont match the text looks stretched or squished.

Sounds like you just need to make sure to make sure the height:width ratio of the billboard quad is the same as the texture's ratio. Then it won't look stretched/squished. As HB said, also, it may still look not-right if the projection/viewport is set up to do something out of the norm.

If the texture is not going to cover the entire billboard, you still need to make sure the ratio of your UV coordinates is the same as the texture's ratio, but the billboard shape itself won't matter.

Subotai
Jan 24, 2004

Madox posted:

Sounds like you just need to make sure to make sure the height:width ratio of the billboard quad is the same as the texture's ratio. Then it won't look stretched/squished. As HB said, also, it may still look not-right if the projection/viewport is set up to do something out of the norm.

If the texture is not going to cover the entire billboard, you still need to make sure the ratio of your UV coordinates is the same as the texture's ratio, but the billboard shape itself won't matter.


Hmm well keeping the ratio does keep the text from looking out of proportion, but it seems that I still need to make sure the billboard is roughly the same size as the texture the text is on, because making a 14 point font the size of a third of the screen makes the text fuzzy. So anyway I looked up some info on transforms and I think I might have the solution. I have to test out the code though.

Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.
A little update on my game development adventure.

At the moment, I have been learning Python from scratch - so far I'm LOVING it - finding it much easier than C/C++

At the moment, I've not got much further that writing a OO Blackjack game, and some minor GUI stuff, but my next move is to look at PyGame (and possibly Soya3d) to start doing some 3D stuff.

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha
Hehe I'm in a similar boat - I went to ruby from C++ and have been working with GL. Its a lot of fun :)
Just doing some small stuff to learn the language, I think I'll try tetris or something.

POKEMAN SAM
Jul 8, 2004
Collision Detection questions:

Okay, so I have a 2D game (Pygame) that I wrote for one of my classes, and I was wondering what the next step to improving my collision detection system would be.

My constraint is that I have up to three collision rectangles (all axis-aligned to the world) per object (different objects have different sized rectangles and may not have all three,) plus one encapsulating rectangle that I use for primary collision detection. The three collision rectangles are a Hitbox (chest) a Walkbox (feet) and a selection rectangle (for UI stuff mainly.)

Right now I use a plane-sweep algorithm where I sweep across and keep track of all of the potential collisions based on the encapsulating bounding box, at which point I pass each pair into the collision handler, which based on the type of the two objects in collision, determines the behavior, specifically things such as whether or not two characters are colliding at their Walkbox (if not, ignore the collision) and handle the collisions.

The system works fine for up to around 100 objects on screen, but after I start getting around 150 objects, it slows down quite a bit, which is why I'm wondering what the next logical step would be. I'd like to drop the plane-sweep method and go for something more robust, but I don't know what direction to look at this point. The constraints should remain the same throughout the project, the only thing really changing is the number of objects handled by the detection algorithm.

Sex Bumbo
Aug 14, 2004

Ugg boots posted:

Collision Detection questions:

First, do all 150 objects need to be able to collide with all other 149 objects? If you can group them up somehow it can help - for example, projectiles can hit enemies but will probably never hit other projectiles.

Also, you can try sorting your objects first by their position. Then you just need to compare objects that are close each other since objects far away can't possibly be colliding. Here's a link for more information: http://www.ziggyware.com/readarticle.php?article_id=128
It's geared towards xna so it has some extra information but I thought it was really easy to follow.

HauntedRobot
Jun 22, 2002

an excellent mod
a simple map to my heart
now give me tilt shift
I've refrained from posting about it before as I have a tendency to start things and not finish them on a regular basis, but I've been designing a little puzzle game in the vein of Boulderdash on my coffee breaks, and have started coding.

I've tried this before but always the other way round (try and make an engine first, then work out what to do with it) - this way seems to be working better. As I'm hoping this will become part of some future showreel for getting a job in the games industry I was torn over whether to implement it in XNA (would've meant targeting Windows/XBox, learning C#) or try and go cross platform by doing it all myself, which in the end won out. I figured, it would be more interesting to code that way.

I'm using wxWidgets and OpenGL to make the framework which so far seems to be working great - this means I can target Windows and Linux as Linux could do with some native games. A bit of a headache getting OpenGL to play ball in a wxWidgets framework, but I found some tutorials that helped demistify it. My big problem with wxWidgets is it's a bit rough around the edges, and I'm kind of afraid to upgrade it... I'm a few versions back already, and I'd like to think I could just hit "update" or download a new version of wxPack but I'm scared of breaking my toolchain >:(

Horn
Jun 18, 2004

Penetration is the key to success
College Slice
Does anyone have an opinion of PyGame vs Soya? I'm reading through the Soya documentation and it seems pretty well fleshed out whereas pygame has always seemed a little clunky to me.

Digital Spaghetti
Jul 8, 2007
I never gave a reach-around to a spider monkey while reciting the Pledge of Alligence.

Horn posted:

Does anyone have an opinion of PyGame vs Soya? I'm reading through the Soya documentation and it seems pretty well fleshed out whereas pygame has always seemed a little clunky to me.

Yea, I like the look of Soya too, but it's been forked to PySoy (although this again doesn't look complete).

I also came across Pyglet which looks interesting and although the docs are pretty basic at the moment, it's got me started.

Subotai
Jan 24, 2004

Does anyone know how to render a billboard using screen-space coordinates instead of world space in D3D? I want to put a billboard at x,y screen space coordinates.

POKEMAN SAM
Jul 8, 2004

Subotai posted:

Does anyone know how to render a billboard using screen-space coordinates instead of world space in D3D? I want to put a billboard at x,y screen space coordinates.

You'll want to use the inverse of your World-To-Screen Matrix to find a Screen-To-World Matrix to transform your points with. Then you can just draw your billboards there.

Madox
Oct 25, 2004
Recedite, plebes!

Subotai posted:

Does anyone know how to render a billboard using screen-space coordinates instead of world space in D3D? I want to put a billboard at x,y screen space coordinates.

If you aren't talking about rendering to the screen for a UI type thing, ignore me :p

If you are using DirectX, you can use D3DFVF_XYZRHW instead of D3DFVF_XYZ, I believe. Its been a while since I used that one, but it should let you specify vertex coordinates in screen space, bypassing any world transform. Remember that the screen space cordinates go from -1 to 1 in DX.

Personally, I prefer to work in actual screen coordinates for my UI, so I use D3DFVF_XYZ type vertices and scale the x and y coordinates to the screen size in my shader something like :

position.x = position.x * 2.0 / screenWidth - 1.0 - halfpixel;
position.y = position.y * 2.0 / screenHeight - 1.0 - halfpixel;
position.zw = 1.0;

where half pixel is 0.5 * screenWidth, etc

magicalblender
Sep 29, 2007
I'm investigating ways of converting .bmps into texture maps, so I can do more than flat colors in OpenGl. OpenGl.org says such a capability doesn't exist within the gl library. Nehe uses auxDIBImageLoad, but the aux library is "strongly discouraged" by opengl.org. Nate Robbins just loads his textures from ppm files, which doesn't seem to help either. So, what can I do to display my .bmps on the screen?

Doc Block
Apr 15, 2003
Fun Shoe
Look for a library that can load the image type you need.

Of course, I'm not aware of there being one just for BMP. Try something like DevIL or SDL_image (requires use of SDL), both of which can handle multiple image formats (probably including BMP).

Or visit wotsit.org, look up the BMP file format, and write your own loader. BMP files are fairly simple if memory serves, so writing a loader shouldn't be too hard.

forelle
Oct 9, 2004

Two fine trout
Nap Ghost

kewlpc posted:

Stay the hell away from NeHe's tutorials, they're terrible. Instead, start off with the ones by Nate Robbins, which are drat nice and even mentioned in the OpenGL Red Book.

I disagree with this. There is some good stuff in NeHe's tutorials. I've got to admit that I don't read the text, but I still find myself dipping into the code sections occasionally to remind myself of how something works.

Regarding Red and Orange books, just man-up and use the spec and extension definitions. :)

Seriously though, after a while, the spec is the only reference you really need. If you're doing any OpenGL programming you should have a copy of this handy.

http://www.opengl.org/registry/doc/glspec21.20061201.pdf

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha
I looked at the Nate Robbins tutorials, and although they are really funky, they clearly target a different crowd. NeHe teaches you OpenGL from the ground up, Nate Robbins shows you how the parameters of a function call come together. OpenGL colour books are equally sucky at walking you through step by step. Great reference, terrible point to start.

As for the BMP loading, code stealing is the best way, but if you're stealing code you may as well steal something that doesn't completely suck. PNG is cool, but libpng is a dependency that I really can't be bothered with.

Here is a TGA loader I found on the net somewhere:

http://pastebin.com/f7c2b44e2

http://rapidshare.com/files/73582942/tga.rar.html

Just call it with
GLuint tex = loadTGATexture(filename)
or set a texid your self loadTGATexture(filename,texid)

haveblue
Aug 15, 2005



Toilet Rascal
The main thing I found the Red Book good for is structuring how you get started exploring GL- first vertices, then transformations, then lighting and shading, and so on.

Karanth
Dec 25, 2003
I need to finish Xenogears sometime, damn it.
libpng is really nice for image loading.

If you're just getting started with 3D, google around for a university graphics course's page. Many will have downloadable versions of class notes that start from a math background rather than a, "how do I pushed polygons?" angle.

gra
Feb 21, 2006
I'm working in DirectX/C++ just now. At the moment, I move things along the x and y axis and rotate them around the z axis - but I want to move the object "forward" along the heading it's been rotated to (I'm thinking asteroids - where the ship moves along the direction it's heading). Any idea/tutorials on how to do this?

Mind Riot
Aug 6, 2006

by Fragmaster

gra posted:

I'm working in DirectX/C++ just now. At the moment, I move things along the x and y axis and rotate them around the z axis - but I want to move the object "forward" along the heading it's been rotated to (I'm thinking asteroids - where the ship moves along the direction it's heading). Any idea/tutorials on how to do this?

You could just keep the ship stationary and move the surrounding objects in the opposite of the ship's velocity

Also, anyone here have some decent DS programming experience? I'm trying to get into it, so if anyone can point me in a good direction that'd be cool

Mind Riot fucked around with this message at 22:29 on Dec 1, 2007

POKEMAN SAM
Jul 8, 2004

gra posted:

I'm working in DirectX/C++ just now. At the moment, I move things along the x and y axis and rotate them around the z axis - but I want to move the object "forward" along the heading it's been rotated to (I'm thinking asteroids - where the ship moves along the direction it's heading). Any idea/tutorials on how to do this?

Just some simple vector math, really. Instead of moving the ship 1 unit in the Y direction, to move it forward just move it cos(angle) in the X direction and sin(angle) in the Y direction. If you're not keeping an angle, and your direction is in the form of a vector, just normalize that vector (let's call it V) and move Vx * speed in the X direction and Vy * speed in the Y direction.

pianoSpleen
Jun 13, 2007
printf("Java is for programmers with no %socks", "c");

Ugg boots posted:

The system works fine for up to around 100 objects on screen, but after I start getting around 150 objects, it slows down quite a bit, which is why I'm wondering what the next logical step would be. I'd like to drop the plane-sweep method and go for something more robust, but I don't know what direction to look at this point. The constraints should remain the same throughout the project, the only thing really changing is the number of objects handled by the detection algorithm.

Look into quadtrees. The performance payoff might be a bit iffy for a game with such simple collisions, but in general this is what they're best for.

If that's too complex/overkill in your opinion, you can always just do a simple sector system and only compare collisions with objects in the same sector (and have some overlap between sectors).

It might seem like that's just as slow because you need to work out which sector they're in, but if you look at the heart of the problem you'll realise there's a combinatorial explosion happening (eg, the number of comparisons is always n!; if you use sectors it could be anywhere between 0 and n! and may not always be less but has a much much better best case) which this can limit.

POKEMAN SAM
Jul 8, 2004

pianoSpleen posted:

It might seem like that's just as slow because you need to work out which sector they're in, but if you look at the heart of the problem you'll realise there's a combinatorial explosion happening (eg, the number of comparisons is always n!;

That's not true with a plane sweep algorithm. It runs across the X direction and pushes objects onto a stack, as it leaves that object's collision it pops them off. If one is pushed on there when there are already others in the stack, it adds those combinations to a list of potential collisions. Same is done in the Y direction.

I'm not naively comparing each object to every other object to determine if they're colliding or not (which would be O(N^2))

Also, how did you get a factorial number of comparisons? The most I can think of is N^2, if each object is compared to every other object.

Adbot
ADBOT LOVES YOU

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha

gra posted:

I'm working in DirectX/C++ just now. At the moment, I move things along the x and y axis and rotate them around the z axis - but I want to move the object "forward" along the heading it's been rotated to (I'm thinking asteroids - where the ship moves along the direction it's heading). Any idea/tutorials on how to do this?

Oh poo poo, i ran into the same problem the other day, but on a bigger scale. Is there a generalisation I can make which ignores the angle the player is facing? At the moment, I have to use different math functions depending on the angle (eg 0-90, 90-180, 180-270, 270-360)

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply