Creating effects in 3D game from scratch, using c++ and DirectX - c++

So the title says it. I couldn't find any info on how actualy build effects into 3D game. I'll maybe stick to some engine later, but for understanding of this whole thing I would need to try it on my own for this time. I found a few about particle systems which may be the right way but any other connection between DirectX and particle systems on google gave results as 3DSmax and etc.
So I would be thankful if you would point me on some tutorials for this, or explaining it...
Last possibilitie would be pointing me on some simple engine focused on this thing (I don't really want to fight through tons of code and understanding how this engine works, I just need to see how they implement this FX stuff).
Thanks
PS: the other possibilitie would be if you know about good book discusing this. It can be more complex but apart from tutorial, books are usually wrote more basicly so this would be also nice way to go

First of all: particle effects are just one kind of effects, it's better you specify the word particle engine :p.
Secondly: search int he articles of Gamedev, it's really the best resource if you want things like this. You can find lots of articles and even better, tons of links, and useful information on the discussion boards. Two articles I can link to is the NeHe lesson about particles in OpenGL, it's not directx but NeHe tutorials for OpenGL are very good. I also found one for directx8 and VB (so a little bit older).
Keep in mind though that a particle engine is often a huge performance hit if you can't optimize it yourself, so try to look at open source game engines (e.g. OGRE) on how they implement it or even better, specific particle engines.

So I would be thankful if you would point me on some tutorials for this
You need to download microsoft DirectX SDK.
In addition to it, you should try NVidia SDK.
You may also try ATI SDK. Study them all.
In addition to them... there are couple of books on OpenGL: "Red Book", "Blue Book", Orange Book . "Computer graphics using OpenGL" by Francis Hill is also a very good one.
Get this info, and start reading.
how actualy build effects into 3D game
This question is too broad. There are lighting effects, particle systems, post-processing effects, physics (which are also effects), and even character animation is an effect. It is unclear what kind of effects you are talking about.
What do you think is better DirectX or OpenGL.
They are more or less equal. You can do same things in both of them. Try both and pick one you liked more. OpenGL is better for playing around and experimenting (because you can easily draw triangle without messing with hardware buffers), available on larger selection of platforms, plus GLSL is better than HLSL (because it doesn't "compile into assembly"). DirectX is geared towards performance from the beginning, available on XBox360, and 9th version was actually good. openGL is more "abstract" and DirectX is closer to hardware.
If you could use the factors as simplicity, area of usage, performance, number of examples and resources etc
If you want simplicity, you should forget about making game engine. You'll have to learn quite a lot of things if you want to deal with 3D.
Both DirectX and OpenGL are used for making 3d-related products.
You can get good performance with both DirectX and OpenGL, and get poor performance if you don't know what you're doing.
Both DirectX and OpenGL have insane amount of examples and books - just search for it. They weren't made yesterday, so enough information is already available.
You need to select goal, select platform, select your API, research available technologies, and start writing code. Wondering "which one is better" is a waste of time. 3D knowledge and algorithm are equally applicable to both APIs.

OpenGL is the best bet to learn I feel. Glut is available free of cost and has all the functions you need to implement a particle engine. Plus theres loads of sample code online. I like the way functions are . Easy to remember and use logically

The best books for learning D3D9.0c/D3D10 are by Frank Luna. Just put him in to amazon or google and you'll get results. He teaches how to build a fully-fledged game engine from scratch.

Related

Game map for DirectX

I am making a game in DirectX 9/C++. I do not have a lot of knowledge about directX. I want to make a map for my game similar to GTA 1. I want to know is there a way to make whole map in some other software and then import and render that map in my directX application.
If, not what are alternatives?
DirectX is not a game engine. DirectX is a programming API. Things like maps, game logic, and so on are completely beyond what DirectX does. It's your burden, as a programmer to implement these things.
Honestly, if you have to ask this question, you should not use DirectX directly, if you want results fast. Instead use an existing, available game engine and implement your game using that. In the past years a number of high quality engines have become available for little money or even free. To name a few:
Unity
Unreal Engine or SDK
CryEngine
Source SDK
There are also a few open source worth looking at:
IrrLicht
Ogre
CrystalSpace
You may also want to look at open source games, which engine you can repurpose. Specifically I'm thinking about Cube2 / Sauerbraten and it's successor Tesseract here.
I would really recommend to use an Engine like Unreal Engine 4. You can get it for little money and it does a lot for you. You can spend a lot of time in designing your game, so you dont need to spend that much time which directx and stuff.

Modelling clothing in C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking to write a bit of software that will end up drawing a human frame (which can be configured with various parameters), and the plan is to have some sort of clothing placed on the dummy.
I've looked at Blender, and OpenGL libraries as well as other rendering and physics engines, I'm not looking for you to tell me how to do this, but mainly I'm wondering what libraries are out there to do this sort of thing?
So there'll be a pattern for the clothing in 2d, then the system, (at least in theory) will be able to translate that in to a 3d representation of a shirt for example? And then place that on the human frame. I know there's a lot of work I need to do for this, however in terms of rendering the clothing on to the frame, and accounting for collisions and how it drops around the frame etc, I've been googling, and have found a few bits, but was wondering if there were C++ libraries out there that would do that.
I'm developing using Visual C++ 2010, and the target environment is a Windows box.
Either that, or i'm going to need to take some physics lessons.
Unfortunately, developing a system like the one your talking about would be insanely difficult. On the plus side, there are alot of easy to use technologies that will help you attain your goal hopefully.
Generally, the way that this type of thing works is as follows: You make some 3d asset in a modeling program such as Blender, 3ds max, Maya, Softimage, etc, and then use this in your program/game. You can think of these programs as just spitting out a bunch of 3d coordinates, which your program, with the help of OpenGL or DirectX can load into memory and render.
Modeling and loading assets is of course the alternative to developing algorithms to generate points. This is what it seems like your trying to accomplish.
The bad news is that clothing is really really complicated. A big part of this is due to the fact that most of it requires simulating cloth dynamics. Another part of the problem is that even if you had a 2d pattern, how would you the manner in which the clothing would adhere to your human model? Is it skin tight? Loose? How will you parameterize that? The placement of the actual clothing on the body is a chore in and of itself as anyone with experience in 3d modeling might tell you.
Nevertheless, some of the industry's brightest professionals are looking for both better ways to simulate cloth, and better ways to automate asset creation.
In summation, the easy answer is that what your trying to do, as interesting and noble as it may be, is going to be extremely difficult and may not have the result your looking for.
As for where you can go for more answers:
If your still intersted in finding a way to automate clothing attatchment to models, I would start by looking around academic websites. Look for any computer science departments which have computer graphics research programs. You will find alot of interesting things there.
For more academic type resources look at Game Programming Gems, GPU Programming Gems, and Graphics Programming Gems book series. They feature many good articles that tackle difficult graphics problems such as these.
Another thing you might do is check out blender a little more. There is an interesting project called MakeHuman
http://makehuman.blogspot.com/
That automates the process of developing human models in blender.
There are a couple of tutorials for putting clothing on the models, take a look at this one:
http://www.davidjarvis.ca/blender/tutorial-05.shtml
For more tutorials on clothing and cloth simulation in blender, you can always check out
www.blendercookie.com
cg.tutsplus.com
I hope some of this has been useful.
From what I remember, cloth is simulated as a mesh of springs which suggests physics libraries for the simulation along with an understanding of the physics of springs/cloth. I've not heard of a physics library tailored to cloth simulation though, but no doubt someone on this site will know of one.
It's answer about cloth simulation itself. (maybe it is not you're intersing in)
If you want to model cloth simulation by some vendors middleware - you can try to use
Havok(it's commercial). It seems to me, that is supports any collision objects, represented by a triangle mesh.
PhysX (it's free), but when you will try to use it there is a lot of constraints on it).
If you want to model cloth physics by you hands I can advise to you this steps:
Refresh base knowledge about physics (Interia, Energy, Newton's law.)
Good start point fo cloth simulation and also physics simulation is that book
http://www.amazon.com/Game-Physics-Pearls-Gino-Bergen/dp/1568814747
Read articles from Siggraph about clothes.
Think about which collision objects do you need
Think about what forces do you need.
Split this challenge to
Broad Phase / Integration / Collision Detection / Collision Response / Constrain Solver
I have developed cloth physics simulation in C++, OpenCL.
It takes me about 4 months to develop, and about 2 months to Debug stage5.
But it was very hot-time in my life, the job has consumed huge amount of time.
except the part that you want to change the dummy while application is running what you want is more or less the example of game engines like Esenthel Engine. the whole idea is to load a mesh for the body and then put a "cloth" (cloth is already defined in most game engines as physical type) on it. but when it come to runtime changes in human frame it becomes a little more tricky since you have to know how you are going to affect the parrameters which is not easy of organic shapes.
Free Game engine to use these days is Unity 3d ... as well it all depends in the detail and as well Maya and 3ds Max are the best of the modeling programs.

Finding the right tools for programming a futuristic-styled UI project

I've always been inspired by dynamic, futuristic-like user interfaces. The best I can describe is a graphic interface such as in the latest Iron Man movies.
Although I wouldn't build a full blown application, I would like to make little snipplets of animations that I plan to make interactive. And maybe put them together someday to make something bigger. Admittedly, I will use for audio manipulation in the future but anyway, that's not the point since it's the animations/graphics I'm unsure of.
I know it's possible to make those kind of animations in Adobe After Effects. I'm just having a hard time thinking of the processes (artistically and programmability) to proceed.
While researching on this on my own I have acquired basic experience with OGRE 3D and Blender. I've imported and compiled meshes on OGRE, have been able to do basic things like move the meshes around which is about it.
I'm beginning to think I may be approaching this the wrong way and there are better tools or if 3D is overkill for those kind of animations when 2D would suffice and maybe provide a smoother experience.
I'm having trouble understanding the process and am wondering two things:
1.)The main thing I'm having trouble understanding is how to get still graphics to make animations? Do the meshes keep the timeline from a program like Blender then a graphics engine like OGRE reads the timeline and plays them?
Most importantly:
2.)Do I even need graphics (meshes)? Most of the interface are thin-border boxes, text and shapes of transparent LED-like colors that can move around dynamically to make that futuristic effect.
Please share your opinions, suggestions and anything you think might help me accomplish to develop those kinds of sexy eye candy! Thanks.
When you look at awesome futuristic UIs in movies, they are usually made of
basic primitives
desaturated colors, and/or one color tone
transparency
a cool font or two
high-tech text, graphs or similar
simple animations to make things look "alive", blinking lights/text and similar
a touch interface, of course
Maybe you can't do a lot about the touch interface, but the rest is really not hard graphics wise, it's a matter of carefully crafted artwork and combining simple elements in a cool way.
Also I would look into Adobe Photoshop and fancy texturing rather than Blender and fancy modelling, as you are looking for a fancy 2D UI, and detailed 3D models will not be that important. Playing around in photoshop (well, or GIMP if you want a free alternative) can help you develop your art skills, and help you get that high-tech, sci-fi look on a 2D surface.
You know, I would go as far as to suggest making some sci-fi wallpapers in the style you are after before trying to solve this problem in code. I think you will find that photo manipulation skills and an eye for art will help you here. And for gods sake, look at those movies (Iron Man, Minority Report etc.) that have those UIs you are aiming at, and analyze what exactly they are. Decompose them like I did in the list above.
As for the "which tools should I use?", I say the answer to that is fairly simple:
OpenGL
Photoshop (or GIMP if you are a starving student etc.)
A compiler & toolchain
A code editor/IDE
A cup
I see this is tagged C++, which is an excellent choice of programming language if I may say so.
Ogre is a full blown 3D engine, which is fine, but not exactly targeted at what you want to use it for. You might find that you struggle to get what you want done (disclaimer: I have not tried this in Ogre, and it might work well for this. Then again, when did you last see Ogre used in an audio manipulation program?). My advice is to learn good, simple OpenGL. That would give you complete power over your UI, not get in your way or limit you in any way. It is also cross platform, well documented, and used by tons of developers all over the world (also for audio manipulation applications). I can't see how you could possibly go wrong with it. The fun part is that it probably won't take you long to get advanced enough in it to start developing some pretty nice UIs. As I mentioned, it's more of an art problem than a coding problem.
The cup is for the coffee, by the way. :)
The easiest and most efficient way is to keep track of all your graphics data (meshes, animations, effects) in "media files" and load & play them in runtime. Though you'll be able to easily change your game without changing the code.
For example, you have a Diablo-like game and you wanna turn it to the future-style. You just need to rewrite some player and AI scripts and modify meshes/effects/sounds/animations. But if you've done those via code - it will be a new game from scratch.
I would suggest Ogre, but you already used that, so by my opinion, you are on the right track.
Look up 'billboards' in Ogre documentation, re: LED and 2D stuff.

Is there a middleground between writing raw OpenGL versus using a full-blown game engine?

I'm playing around with OpenGL and I'm finding myself writing code that I feel like I shouldn't have to write.
GLU and GLUT are nice but not really what I'm thinking of.
Code to load .obj models (vertex and normal vectors) from Blender and render them.
Code for collision detection.
Code for navigation/camera stuff.
Code for simple terrain generation.
But at the same time I feel like a full-blown game engine is more than I need.
Are there any good libraries built on top of OpenGL that I could take advantage of, perhaps to create relatively simple games? I don't necessarily need all of the items listed above. Those are just examples of what I'm thinking of.
Yes.
I can't be more specific as I don't write my own game engines but I do have a list of libraries online at this location, most of which sit below being a full engine.
Ogre
Irrlicht
openscenegraph (replaces performer)
Depending on how much you need, one of these toolkits / libraries might suit your purpose.
GLUT - OpenGL Utility Toolkit
Ogre3D - OGRE Object Oriented Graphics Library
Open Inventor - OpenGL toolkit for scene management created by SGI
Performer - OpenGL toolkit for real-time rendering created by SGI
I learnt my opengl stuff from GameTutorials and Gamedev. Unfortunately gametutorials are no longer a free selection of tutorial (there's some examples) but they were good. Coupled with SDL, you would have code to do everything you wanted - and you'd be able to understand what is going on under the covers, something I find is very useful later on (if, for example you wanted to write HTML5/WebGL code later).
A lot of the game engines aren't as well documented as I'd like (well, weren't a few years back when I was looking), but they might still do what you need. Sourceforge has many, including Ogre3d, Irrlicht, and CrystalSpace.
In general I agree with your sentiment. There is a school of thought that says that programming should consist of pluggable modules. Once youve written an OpenGL app, you should be able to grab a model loader, and/or a skeletal animation engine and plug them in.
The depressing thing is, most of the game engines on that list (that Ive looked at) are all or nothing propositions. They provide an entire framework and do not really take into account the more common real case scenario.
That said, all is not lost. A lot of those engines package up a number of other 'utility' libraries into their distribution. With a bit of patience it is possible to piece together the component libraries yourself: OpenAL for the sound, Freetype for font rendering, libpng, libjpeg etc for image codecs

I want to make a simple 3D game using openGL, where should I start?

I find that I learn best by example. Is there a good website or codebase that shows how event handling, collision detection, modeling, and basic 3D drawing works?
The game I'm trying to begin with is a simple racing game where the user controls a small space ship and navigates through channels, asteroid fields, space colonies, and various other obstacles (I know, real original). Movement is in 3 dimensions. The game should know when the shuttle hit an obstacle. There are defined tracks as there are in most racing games (circuits and linear paths).
Pressing the arrow keys should cause the direction vector to rotate appropriately. Also, the ship should use something like an afterburner when the user presses the space bar, for example. Movement up and down is also an option.
If you want to learn OpenGL, I recommend starting with "OpenGL Red Book", and then looking at NeHe's samples. Red Book is free at least in online HTML format, there are also downloadable PDFs around.
However, Red Book and NeHe will teach you mostly how to use OpenGL; writing games is art, and there's far too much to explain, far too much to learn, and far too much to read about it. Here's just a tip.
This is basic structure of most games. Hopefully it helps with basics. Of course it's not a full game, won't run, and greatly depends on how you do things, but it should give you a basic idea.
void update(float k)
{
// k == time in seconds since last update; e.g. 0.02
ship.y += ship.speed_y*k;
}
int main()
{
while(1)
{
if(hasEvents())
{
event_t evt;
getEvent(&evt);
if (evt.type == keypress && evt.key==down)
{
ship.speed_y=1;
}
}
paint();
new_ticks = get_ticks();
update((new_ticks - old_ticks)/1000.);
old_ticks = new_ticks;
}
}
Not knowing your initial skill level I suggest you taking a look at Ogre3D. It is a complete 3D-rendering engine that has really clean interface to work with, easy to extend and best of all, it's quite multiplatform working on Windows, Linux and Mac OS X. The examples and tutorials provided are pretty self-explaining.
If you want to write your own OpenGL-only engine completely from scratch, Ogre3D may not be the path to follow...
A couple of notes, some of which have already been stated:
The OpenGL Redbook. An excellent place to start. The book has seen several revisions, so the free online version is a bit dated by comparison.
GameDev.net. They are a wonderful resource for developers of all experience, and they have a lot of talented people on the forums. They have answered the question, "I want to make a game, where do I start?" many, many times.
I do not recommend NeHe. I find that the tutorials there, more often than not, confuse a neophyte. The tutorials show "how", but do very little to explain the crucial why.
Game development is a huge multifaceted discipline. It's challenging even if you have very solid math and programming skills.
Two pieces of advice:
Start small. Start small. Start small. You might think your goal is pretty modest, but it will involve a great deal more than you imagine.
Avoid the temptation to cut and paste example code. You will cheat yourself out of crucial understanding.
NeHe
This site helped more then anything when I was learning opengl.
I must give a warning for using nehe because many people have recommended it.(don't have an account to make comments, sorry)
Mainly because it only shows how to do things with the fixed pipeline instead of shaders. The first couple of tutorials might be ok the get a kickstart of how to get something on the screen. But don't waste your time with for example learning how to activate alpha blending and setting up lighting for the fixed pipeline, because if you want to do something that doesn't look like a game from 1999 you will have to relearn how to do all that stuff again but with shaders. Better to learn the new way from the beginning imo.
Firstly, I don't recommend using OpenGL for your first game, especially if you've never programmed before. You should strongly consider the newer and easier methods like XNA with C#.
Secondly, like OpenGL, XNA also has a large number of tutorials on the Internet, which I believe you will find very helpful.
If you've never done programming before, I recommend as a starting project, you should try creating a very simple game like Pong, or Tic Tac Toe. I think you will get a good feel of game development in general. From there, you can start on your actual project from the experience you've gained by creating Pong.
Lastly, the main piece of advice I can give you as you adventure on your quest is to never give up no matter what obstacles you face in creating your game.
Good Luck! ^^
I've no idea how much game programming experience you have, but I'd start with something a bit more limited.
Start with a 2d tile-based game (Sokoban etc) - they're relatively easy to write - something where the objects are always exactly on a tile, that makes things pretty trivial.
Once you've got the principles of that, game loop, timing, processing user input, data model, renderer etc, then you can do something more involved.
Then you can try something like "Asteroids" which is going to need some 2d vector maths, modelling intertia (i.e. integration) possibly a bit of trig. and a non-tile based collision system.
Once you've got that licked, then you can try something 3d - which makes things more complicated again, maths-wise.
I would look around on www.gamedev.net, it contains some excellent tutorials for beginners and in the forums you'll find a great deal of information on any subject related to games programming.
First, you should think about the structure of your code. Every game ever has some variation of the following:
int main()
{
Screen::Init();
Game::Init();
while (Game::isrunning)
{
Game::Update();
Screen::Render();
}
Game::Shutdown();
return 0;
}
The rest just becomes an implementation detail. Try looking at SDL, it handles a lot of the nasty things of Windows programming (initializing a window, loading OpenGL, etc.) so you can focus on writing your game.
Yes, look up tutorials online. Yes, hang out at GameDev.net. Yes, NeHe is confusing and specialized.
For OpenGL, I would combine the OpenGL SuperBible's ability to make one aware of the context and possibilities of OpenGL with a good old-fashioned Google search.
It also helps to know someone who can help you out from time to time. GameDev.net has chatrooms and the people are friendly.
If you want opengl but with the simplicity of python - which could be nice to understand the principle of the API at first - check out the wrappers : http://pyopengl.sourceforge.net/
They are compatible with the latest version of opengl and their development is quite active.