3rd Person Example(NEW)
3rd Person Example(NEW)
After many hours of straining my eyes, I have made a 3rd person engine. Now it is kind of a WIP, but I believe the main point is made of how I did it, and how you can duplicate it. You'll notice there is a bunch of spaces in the code......you have no idea how much eyes are hurting, I think they're about to explode! No worries though, for I have finished my quest......kind of.....
http://64digits.com/users/g0bl1n/3rdpersonexample.zip
The camera placement is kind of a problem for me, since I don't know where I want it exactly. To experiment with the placement, theres two lines you can edit:
Go to where it says //CAMERA, there will be 3 coordinates, those are the coordinates in relation to the character node.
The other is where it says //PLACE CAMERA. Then where it says 120-LastMousePos, change the 120 and it changes how far up you can look.
Now before everyone jumps on me, I have looked through other examples, and have had help. The code is not all mine, and the graphics aren't mine. The models in the example and in the model folder are from websites I've downloaded from, I do not remember who made them though...
Any questions, feel free to question me!
EDIT:
Oh yea, when or if you play this example, you will see a problem with it. The player model floats whenever he goes from a higher point to a lower point on the map if you hold a W, A, S, or D key. If anyone knows how to fix this, feel free to help a fellow programmer out.
EDIT2:
Uploaded a new version. This one doesn't have a console window. Other than that.....its not really new.....
http://64digits.com/users/g0bl1n/3rdpersonexample.zip
The camera placement is kind of a problem for me, since I don't know where I want it exactly. To experiment with the placement, theres two lines you can edit:
Go to where it says //CAMERA, there will be 3 coordinates, those are the coordinates in relation to the character node.
The other is where it says //PLACE CAMERA. Then where it says 120-LastMousePos, change the 120 and it changes how far up you can look.
Now before everyone jumps on me, I have looked through other examples, and have had help. The code is not all mine, and the graphics aren't mine. The models in the example and in the model folder are from websites I've downloaded from, I do not remember who made them though...
Any questions, feel free to question me!
EDIT:
Oh yea, when or if you play this example, you will see a problem with it. The player model floats whenever he goes from a higher point to a lower point on the map if you hold a W, A, S, or D key. If anyone knows how to fix this, feel free to help a fellow programmer out.
EDIT2:
Uploaded a new version. This one doesn't have a console window. Other than that.....its not really new.....
Last edited by g0bl1n on Sun Feb 24, 2008 9:07 am, edited 1 time in total.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Heh, that's pretty cute. I'm glad you got that working. As it turns out, I did misinterpret your requirements.
OK, comments:
This is evil in so many ways that I hardly know where to begin. Zeroethly, urgh, globals. The order of initialisation of globals is undefined, so it is horribly dangerous to assume that device will be initialised before it's used. Also, DirectX8? Join the 21st century.
With an Irrlicht built from SVN revision 1253, I don't see the floating behaviour apparent in the supplied exe / dll, and pressing space causes the character to hop up and down rather fly upwards indefinitely. What version of Irrlicht are you using?
The behaviour is framerate dependent.
In your mouse handler, when you wrap the cursor position from one screen bound to the other, you'll have one frame where your character turns the wrong way. It won't be very noticeable, but it's an area to have a look at.
OK, comments:
Code: Select all
//Globals
MyEventReceiver rv;
IrrlichtDevice *device=createDevice(EDT_DIRECT3D8,dimension2d<s32>(screen_width,screen_height),32,full_screen,0,0,&rv);
position2d<s32> mousePos = device->getCursorControl()->getPosition();
position2d<s32> lastMousePos = device->getCursorControl()->getPosition();
With an Irrlicht built from SVN revision 1253, I don't see the floating behaviour apparent in the supplied exe / dll, and pressing space causes the character to hop up and down rather fly upwards indefinitely. What version of Irrlicht are you using?
The behaviour is framerate dependent.
In your mouse handler, when you wrap the cursor position from one screen bound to the other, you'll have one frame where your character turns the wrong way. It won't be very noticeable, but it's an area to have a look at.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Wow I didn't notice it was directx8, my total bad. The Irrlicht version is 1.4 and my code should be cleaned up, although I shall not be the one to do it, for I am too lazy, and have precious time watching tv and eating to do.
No really in all seriousness its not clean because its a wip, and I'm not near finished. Half the things I've had to move around to get to work, so I just stopped trying to be neat until I get a better hold on Irrlicht its-self. So anyways...back to that whole hopping thing. I downloaded the newest version of Irrlicht, which is 1.4 I'm hoping.....cause thats what I have......
And back to the globals thing. The mouse_looking void needs to know what "device" is as a variable. So to make it simple....or since I'm lazy......I put it up top for I wouldn't have to do as much. whoooo smiles
But I would like to know why yours isn't hopping and mine is, (OMG I just noticed theres a perfect smiley for the first post!!! I never saw that)please ponder upon while I go to school.
No really in all seriousness its not clean because its a wip, and I'm not near finished. Half the things I've had to move around to get to work, so I just stopped trying to be neat until I get a better hold on Irrlicht its-self. So anyways...back to that whole hopping thing. I downloaded the newest version of Irrlicht, which is 1.4 I'm hoping.....cause thats what I have......
And back to the globals thing. The mouse_looking void needs to know what "device" is as a variable. So to make it simple....or since I'm lazy......I put it up top for I wouldn't have to do as much. whoooo smiles
But I would like to know why yours isn't hopping and mine is, (OMG I just noticed theres a perfect smiley for the first post!!! I never saw that)please ponder upon while I go to school.
-
- Posts: 107
- Joined: Sat Nov 04, 2006 9:42 pm
I don't want to seem like a jackass but writing clean, good code the first time, every time will basically always get you better results faster. Get yourself in the habit.
And for anything other than a very small project it'll actually save you work, thus maintaining your laziness.
And for anything other than a very small project it'll actually save you work, thus maintaining your laziness.
Frosty Topaz
=========
It isn't easy being ice-encrusted aluminum silicate fluoride hydroxide...
=========
It isn't easy being ice-encrusted aluminum silicate fluoride hydroxide...
I really like the example, please clean the code so I'll be able to learn from it easily
And try the latest SVN revision of irrlicht, it might help.
How can I access the Subversion server?
And try the latest SVN revision of irrlicht, it might help.
How can I access the Subversion server?
I uploaded a clean version of the code...although what I think is clean might not be to other people!!! So be warned...naw just kidding its pretty good if I don't say so myself.
And is there a way of download the SVN revision as a whole instead of one file at a time? Because I got this link:
https://irrlicht.svn.sourceforge.net/sv ... cht/trunk/
One at a time?!
/cry
EDIT: NM, this was the checkout thingy right? I did this, but I did it again anyways and it still does the float/bounce thing.
And is there a way of download the SVN revision as a whole instead of one file at a time? Because I got this link:
https://irrlicht.svn.sourceforge.net/sv ... cht/trunk/
One at a time?!
/cry
EDIT: NM, this was the checkout thingy right? I did this, but I did it again anyways and it still does the float/bounce thing.
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
Hehe...
Although it is not very good organized, its really useful for the complete noobies like me.
I tried to create a new project with the code, but it gives me lots of errors.
Any chance of someone of the better-skilled users to show us better organised version and implement it in a whole project? It gives me lots of unresolved external errors and I don`t know what to do. I think it won`t be too much work if you have used Irr for a while. I believe it may turn into a useful working tutorial, so the absolute noobies to use it as a base and this way I`m sure lots of useless topics will be skipped.
PS: Currently it`s about my 8th hour working with Irrlicht, just passed the "easy" marked tutorials, so please don`t laugh at me...
Although it is not very good organized, its really useful for the complete noobies like me.
I tried to create a new project with the code, but it gives me lots of errors.
Any chance of someone of the better-skilled users to show us better organised version and implement it in a whole project? It gives me lots of unresolved external errors and I don`t know what to do. I think it won`t be too much work if you have used Irr for a while. I believe it may turn into a useful working tutorial, so the absolute noobies to use it as a base and this way I`m sure lots of useless topics will be skipped.
PS: Currently it`s about my 8th hour working with Irrlicht, just passed the "easy" marked tutorials, so please don`t laugh at me...
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
Anyone?
Is this THAT difficult? Just to create a VB project environment with this 'main.cpp' file and post a link?
Or at least give me some advice how to fix all those unresolved externals?
I can complie it, but building gives me that:
Is this THAT difficult? Just to create a VB project environment with this 'main.cpp' file and post a link?
Or at least give me some advice how to fix all those unresolved externals?
I can complie it, but building gives me that:
Code: Select all
------ Build started: Project: TPS, Configuration: Debug Win32 ------
Linking...
Main.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function _main
Main.obj : error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$_main
Main.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function __ehhandler$_main
Main.obj : error LNK2001: unresolved external symbol __fltused
Main.obj : error LNK2019: unresolved external symbol _cos referenced in function _cosf
Main.obj : error LNK2019: unresolved external symbol _sin referenced in function _sinf
Main.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
Main.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) referenced in function "protected: virtual void * __thiscall irr::core::irrAllocator<wchar_t>::internal_new(unsigned int)" (?internal_new@?$irrAllocator@_W@core@irr@@MAEPAXI@Z)
Main.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) referenced in function "protected: virtual void __thiscall irr::core::irrAllocator<wchar_t>::internal_delete(void *)" (?internal_delete@?$irrAllocator@_W@core@irr@@MAEXPAX@Z)
Main.obj : error LNK2019: unresolved external symbol _memset referenced in function "public: void __thiscall irr::core::CMatrix4<float>::makeIdentity(void)" (?makeIdentity@?$CMatrix4@M@core@irr@@QAEXXZ)
Main.obj : error LNK2019: unresolved external symbol _atexit referenced in function "void __cdecl irr::scene::quake3::`dynamic initializer for 'irrEmptyStringc''(void)" (??__EirrEmptyStringc@quake3@scene@irr@@YAXXZ)
Main.obj : error LNK2001: unresolved external symbol __purecall
Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *,char const *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@PBD@Z) referenced in function "void __cdecl `dynamic initializer for 'device''(void)" (??__Edevice@@YAXXZ)
Debug\TPS.exe : fatal error LNK1120: 13 unresolved externals
Build log was saved at "file://d:\GAMEMAKER\Irrlicht\Resources\00 Third PERSON\00.Our Game\TPS\TPS\Debug\BuildLog.htm"
TPS - 14 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Well, you have to provide the necessary information, otherwise help is basically impossible.
What I still don't understand is what you mean by VB?! Since it's C++ code, you should probably use MSVC, but VB seems pretty wrong. Anyway, for the MSVC you can find the necessary files in the folder TestProject under example/
And your linker error looks like you did not link in the CRT or some other pretty basic support library. Check your compiler manual or google for the necessary libs.
What I still don't understand is what you mean by VB?! Since it's C++ code, you should probably use MSVC, but VB seems pretty wrong. Anyway, for the MSVC you can find the necessary files in the folder TestProject under example/
And your linker error looks like you did not link in the CRT or some other pretty basic support library. Check your compiler manual or google for the necessary libs.
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
OOPS...
I`m trying to compile it in VisualStudioC++2008(full). Those VB are becasue I worked recently in Basic or sth like that. Those bad habits... Sorry.
What I`m tryng to do exactly is to import the main.cpp code from this Third person example into a project. When I create a new one with the main.cs in it I can complie it, but building gives me those errors. Obviously it`s something in the environment settings that I cannot understand. That`s why I`ll be very thankful if someone create a working project and upload it somewhere, or tell me what am I doing wrong...
PS: Sorry for the late post, but I had some connection problems
PS2:
Latest build log:
I`m trying to compile it in VisualStudioC++2008(full). Those VB are becasue I worked recently in Basic or sth like that. Those bad habits... Sorry.
What I`m tryng to do exactly is to import the main.cpp code from this Third person example into a project. When I create a new one with the main.cs in it I can complie it, but building gives me those errors. Obviously it`s something in the environment settings that I cannot understand. That`s why I`ll be very thankful if someone create a working project and upload it somewhere, or tell me what am I doing wrong...
PS: Sorry for the late post, but I had some connection problems
PS2:
Latest build log:
Code: Select all
------ Build started: Project: TPS, Configuration: Debug Win32 ------
Compiling...
Main.cpp
d:\gamemaker\irrlicht\resources\00 third person\00.our game\tps\tps\main.cpp(18) : warning C4305: 'initializing' : truncation from 'double' to 'float'
d:\gamemaker\irrlicht\resources\00 third person\00.our game\tps\tps\main.cpp(60) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
d:\gamemaker\irrlicht\resources\00 third person\00.our game\tps\tps\main.cpp(66) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
Linking...
Main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *,char const *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@PBD@Z) referenced in function "void __cdecl `dynamic initializer for 'device''(void)" (??__Edevice@@YAXXZ)
D:\GAMEMAKER\Irrlicht\Resources\00 Third PERSON\00.Our Game\TPS\Debug\TPS.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://d:\GAMEMAKER\Irrlicht\Resources\00 Third PERSON\00.Our Game\TPS\TPS\Debug\BuildLog.htm"
TPS - 2 error(s), 3 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Last edited by shadowslair on Thu Apr 03, 2008 11:22 am, edited 1 time in total.
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
Added, It seems that this was the main problem. Now it gives me that:
Which is weird. The main.cpp is in the project. I added a copy in the folder too...
Code: Select all
c1xx : fatal error C1083: Cannot open source file: '.\Main.cpp': No such file or directory
Build log was saved at "file://d:\GAMEMAKER\Irrlicht\Resources\00 Third PERSON\00.Our Game\TPS\TPS\Release\BuildLog.htm"
TPS - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========