FPS Making-Major problems Sounds, Shooting, Crosshair
FPS Making-Major problems Sounds, Shooting, Crosshair
Welcome all, i am a bit newbie, but this is a such mess on forum (especially on searching) so i decided to write for help on advnced type forum, i am making a little amateur project, it will be an fps in Doom world. (as i am a fan of Doom ;] from Id)
Now the story is not important, maps also the AI, these are things what i will do at the end (if i would even make 20% of this what i want to recive).
Now the source code has physics, movement, q3 loading maps and all these basics, teached from tutorials.
Please read this, i know this are konwn problems, but we could make a mega tutorial for fps designers in this topic!!
1.Now the problem is, or ARE:
Shooting - I tried many ways, and i still dont know how to make player shooting. I tried to make it from the techdemo, but when i "take" the code from there , use this what is needs it tells me that -> : "shoot- this function is illegal", i work in Visual c++ 6.0.
It would be great if someone give , or release (pliz!!) some kind of shooting code, i know he wouldn't like to relase his own part of code wich defines shooting, but please, i can't make shooting here!! I need somehow do this shooting. Also i saw all the topics on the whole forum, and those code examples, wich you all have showed, or they dont work, or i don't understand how they works. So if you could also explain a little of this shooting code would be great.
Sorry for my "low" english (Poland), but i think u understand me ;]
2. The second problem: crosshair
So i got the code for crosshair:
driver->draw2DRectangle( irr::video::SColor(100,255,100,100), irr::core::rect<s32>(300,299,500,301) );
driver->draw2DRectangle( irr::video::SColor(100,255,100,100), irr::core::rect<s32>(399,200,401,400) );
As i thought why it didn't work in 640x480, i noticed it must be for higher resolution of course, but turning "game" to 800 or to 1024 resolution have done nothing. My crosshair is invisible , but why?? (maybe it is a paranormal crosshair )
3. The third: Sounds
OK, i have downloaded the audiere.h, and added to include wich my visual have in include paths, also a libray went there to (to librarys), and i took the whole code from techdemo, and this also didn't worked out, like in shooting, i tried everything, also i tried to add a header CDemo.h to include files, it have done nothing. So a little help would be good here. Especially a code describes how to use a sound playing all the time when in game.(some kind of a in game music).
Thak you for your cooperation.
Good luck for all developers.
May the force be with you .
[/b]
Now the story is not important, maps also the AI, these are things what i will do at the end (if i would even make 20% of this what i want to recive).
Now the source code has physics, movement, q3 loading maps and all these basics, teached from tutorials.
Please read this, i know this are konwn problems, but we could make a mega tutorial for fps designers in this topic!!
1.Now the problem is, or ARE:
Shooting - I tried many ways, and i still dont know how to make player shooting. I tried to make it from the techdemo, but when i "take" the code from there , use this what is needs it tells me that -> : "shoot- this function is illegal", i work in Visual c++ 6.0.
It would be great if someone give , or release (pliz!!) some kind of shooting code, i know he wouldn't like to relase his own part of code wich defines shooting, but please, i can't make shooting here!! I need somehow do this shooting. Also i saw all the topics on the whole forum, and those code examples, wich you all have showed, or they dont work, or i don't understand how they works. So if you could also explain a little of this shooting code would be great.
Sorry for my "low" english (Poland), but i think u understand me ;]
2. The second problem: crosshair
So i got the code for crosshair:
driver->draw2DRectangle( irr::video::SColor(100,255,100,100), irr::core::rect<s32>(300,299,500,301) );
driver->draw2DRectangle( irr::video::SColor(100,255,100,100), irr::core::rect<s32>(399,200,401,400) );
As i thought why it didn't work in 640x480, i noticed it must be for higher resolution of course, but turning "game" to 800 or to 1024 resolution have done nothing. My crosshair is invisible , but why?? (maybe it is a paranormal crosshair )
3. The third: Sounds
OK, i have downloaded the audiere.h, and added to include wich my visual have in include paths, also a libray went there to (to librarys), and i took the whole code from techdemo, and this also didn't worked out, like in shooting, i tried everything, also i tried to add a header CDemo.h to include files, it have done nothing. So a little help would be good here. Especially a code describes how to use a sound playing all the time when in game.(some kind of a in game music).
Thak you for your cooperation.
Good luck for all developers.
May the force be with you .
[/b]
Wouldn't it be easier to just stick the crosshair where the mouse is? You will have to do some conversion between mouse points and the screen coordinates and you'll also need to get client area only points when running in windowed mode. Once you've got the mapping right it would work for any resolution.2. The second problem: crosshair
- Nova
I also have some problems with GUI,
And in 640 image didnt appear. It compiles and links ok, everything is ok, it loads it ok, (in dos console it shows that it loaded it), maybe the position is wrong?? (10,10,94,31) <- what means these numbers ??[/code]
Code: Select all
IGUIImage* img = env->addImage(rect<int>(10,10,94,31)); //loads an image
img->setImage(driver->getTexture("base/gui/irrlichtlogoaligned.jpg")); //wybieranie skad ma byc wgrany obrazek
Shooting, hmm? This took me a while to get right, especially the matrix part. Here we go
1) get the absolute transformationmatrix of the gun. We'll call this mat.
2)
range is the maximum number of units the gun can fire. Note that I assume the x axis of the gun node is the one along which it should be firing. It will depend on your model and z is actually probablly more common, I just prefer x for the front of my models
3)
We have just created a line including all points that the gun can hit (assuming projectile width is negligable)
4) now we need to do a raycast. Simply feed the ray from step 3 into CSceneCollisionManager::getSceneNodeFromRayBB and the closest scenenode hit by the ray is returned
5) to determine the point that was hit, you will have needed to have created a triangle selector for each node. Test the ray from step 3 against the triangle selector of the node returned from step 4. You now have the point of the collision
6) There's some limited stuff you can do to make non-instantaneos bullets, but I won't go into it now unless you can't figure it out.
7)I think that's all. Feel free to ask if I didn't explain anything
1) get the absolute transformationmatrix of the gun. We'll call this mat.
2)
Code: Select all
matrix4 targetmat;
targetmat.setTranslation(vector3df(range,0,0));
targetmat= mat * targetmat;
3)
Code: Select all
line3d<f32> ray(mat.getTranslation(), targetmat.getTranslation()); /*set one point to the position of the weapon, the other to the X axis
note that the line is the maximum length that the weapon can shoot*/
4) now we need to do a raycast. Simply feed the ray from step 3 into CSceneCollisionManager::getSceneNodeFromRayBB and the closest scenenode hit by the ray is returned
5) to determine the point that was hit, you will have needed to have created a triangle selector for each node. Test the ray from step 3 against the triangle selector of the node returned from step 4. You now have the point of the collision
6) There's some limited stuff you can do to make non-instantaneos bullets, but I won't go into it now unless you can't figure it out.
7)I think that's all. Feel free to ask if I didn't explain anything
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.
Crucible of Stars
Crucible of Stars
The numbers are the pixel locations that you want.dawasw wrote:I also have some problems with GUI,And in 640 image didnt appear. It compiles and links ok, everything is ok, it loads it ok, (in dos console it shows that it loaded it), maybe the position is wrong?? (10,10,94,31) <- what means these numbers ??[/code]Code: Select all
IGUIImage* img = env->addImage(rect<int>(10,10,94,31)); //loads an image img->setImage(driver->getTexture("base/gui/irrlichtlogoaligned.jpg")); //wybieranie skad ma byc wgrany obrazek
Why not use relative positioning instead of absolute? It will make your crosshair resolution independant.
Electron i have sent u source code for an email, if you could insert there a simple shooting function i would love you for that, i know this is noob like, but i really don't understand it too much about this matrix, and how to define it to work in 100%.
Also could u include a keyMap to shoot function?... (what a shame )
Tyn how do u mean relative?? What i should change??
Also could u include a keyMap to shoot function?... (what a shame )
Tyn how do u mean relative?? What i should change??
I have to go out rigth now, but I'll do my best with and email you back sometime today. I doubt I'll do a keyymap though, sorry but I've never used them. My input system in my own game is very temporary as I'm using irrlicht's input but plan to switch to DirectInput.dawasw wrote:Electron i have sent u source code for an email, if you could insert there a simple shooting function i would love you for that, i know this is noob like, but i really don't understand it too much about this matrix, and how to define it to work in 100%.
Also could u include a keyMap to shoot function?... (what a shame )
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.
Crucible of Stars
Crucible of Stars
Thanks, but I'm not really a great programmer, it's just that I had to implement shooting for my own fps a few weeks ago
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.
Crucible of Stars
Crucible of Stars