Your Own Game Engine in 2 seconds: Tutorial

Problems building or running the engine, queries about how to use features etc.
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla

Your Own Game Engine in 2 seconds: Tutorial

Post by Rohit Chauhan »

Hi all , This Last HowTo Will make you start up with your game engine with OGRE for
Graphics , Newton for Physics and Audiere for sound.It will be done in not more than 2 minutes, so that beginners get started with learning about game engine rather wandering wastefully in the forums and web.

On To how to integrate audiere with OGRE , see my tutorial elsewhere in forum “Adding Sound to OGRE in 2 Seconds : Tutorial” or go to this link

http://www.ogre3d.org/phpBB2/viewtopic.php?t=18176

Now we are left with integrating Physics,
Unpack NewtonSDK,
In Anjuta(Linux), Go Settings->CompilerandLinkerSettings and add full path to include and library paths . I had for e.g. /home/rohit/newtonSDK/sdk
In Libraries ,
Add Newton (Youll see OgreMain and audiere already there if you followed the tutorial)

Now to your main.cc file add statement1 2 and 3 (from my OGRE+audiere tutorial)
Or simply paste following code.


#include "ExampleApplication.h"
#include “Newton.h” //statement1
#include “audiere.h”
using namespace audiere;

static NewtonWorld *myworld; //statement2

AudioDevicePtr device(OpenDevice());
OutputStreamPtr song(OpenSound(device,”songname.mp3orwhatever”,false));

class Game : public ExampleApplication
{
void createScene()
{
Entity *robo;
robo = mSceneMgr->createEntity( "Robot", "robot.mesh" );

SceneNode *node1;
node1= mSceneMgr->getRootSceneNode()->createChildSceneNode( "RobotNode" );

node1->attachObject( robo );

song->setVolume(0.5f);
song->play();
}
};

int main()
{
myworld=NewtonCreate(NULL,NULL); //statement3
Game mygame;
mygame.go();
return 0;
}


Build and Execute .
Obviously , this will do nothing else than creating a pointer to Newton world and creating it . But if all works then you have a full fledged GameEngine in your hands :twisted: and it will definitely get you started on your way quickly to game programming.

On windows (say devcpp) procedure should be same as far as including header files and libraries paths are concerned.

***Remember to make your examples in newtonsdk by typing make in the samples folder to explore possibilities***

***Tips---OGRE+audiere can be easily used to create Great Animated Music Videos and

OGRE+Newton+Audiere = FullBlownGameEngine
:P


I hope It gets Some of You Started in the World of game programming
in no time.
Any Doubts :wink:

GoodBye !
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2

Post by pjcast »

You should probably look into adding to the tutorials on the wiki, as this forum post will easily be lost in a day or two. :wink:
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
User avatar
Frenetic
Bugbear
Posts: 806
Joined: Fri Feb 03, 2006 7:08 am

Post by Frenetic »

Yay for tutorials!

I too recommend wikification.

Also... what do people have against the

Code: Select all

 tag? Jeez. :twisted:
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Post by jacmoe »

With all due respect, this can hardly be called a tutorial, even if you're being sympathetic.
With some work it could probably become a code snippet..

A tutorial is more. Look at the tutorials in the Wiki, and you'll see. :wink:
User avatar
stoneCold
OGRE Expert User
OGRE Expert User
Posts: 867
Joined: Fri Oct 01, 2004 9:13 pm
Location: Carinthia, Austria
x 1

Post by stoneCold »

jacmoe wrote:With all due respect, this can hardly be called a tutorial, even if you're being sympathetic.
With some work it could probably become a code snippet..

A tutorial is more. Look at the tutorials in the Wiki, and you'll see. :wink:
exactly my (unwritten) thoughts :)
User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
x 3

Post by CaseyB »

It would be awesome to work this into a full tutorial though!
User avatar
stoneCold
OGRE Expert User
OGRE Expert User
Posts: 867
Joined: Fri Oct 01, 2004 9:13 pm
Location: Carinthia, Austria
x 1

Post by stoneCold »

But it would also be a quite impossible task,
I mean if you would consider all available libraries in this tutorial (for sound, physics, networking, ...).
I think for_each of these sectors there are 3 - 5+ (sometimes very different) libraries.

For Instance /me is very happy with OgreOde/FMOD instead of Newton/Audiere, and I think it really depends on the characteristics of your project which libs you want to use
(licensing, features, crossplatforming, ...)

I won't keep anyone away from improving this, basically it's a good idea, but I never would call this a "tutorial for a game engine", it's rather a "tutorial for integrating audiere and newton into ogre".

[edit]: @Rohit Chauhan: I really like your enthusiasm, keep it up :wink:
greetings
misterface
Halfling
Posts: 92
Joined: Sat Feb 04, 2006 6:41 pm
Location: Belgium

Post by misterface »

some help needed:

Code: Select all

Error	4	error LNK2019: unresolved external symbol __imp__AdrOpenDevice@8 referenced in function "class audiere::AudioDevice * __cdecl audiere::OpenDevice(char const *,char const *)" (?OpenDevice@audiere@@YAPAVAudioDevice@1@PBD0@Z)	OgreNewtonFrameListener.obj	
Error	5	error LNK2019: unresolved external symbol __imp__AdrOpenSampleSource@8 referenced in function "class audiere::SampleSource * __cdecl audiere::OpenSampleSource(char const *,enum audiere::FileFormat)" (?OpenSampleSource@audiere@@YAPAVSampleSource@1@PBDW4FileFormat@1@@Z)	OgreNewtonFrameListener.obj	
Error	6	error LNK2019: unresolved external symbol __imp__AdrOpenSound@12 referenced in function "class audiere::OutputStream * __cdecl audiere::OpenSound(class audiere::RefPtr<class audiere::AudioDevice> const &,class audiere::RefPtr<class audiere::SampleSource> const &,bool)" (?OpenSound@audiere@@YAPAVOutputStream@1@ABV?$RefPtr@VAudioDevice@audiere@@@1@ABV?$RefPtr@VSampleSource@audiere@@@1@_N@Z)	OgreNewtonFrameListener.obj	
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

misterface wrote:some help needed:

Code: Select all

Error	4	error LNK2019: unresolved external symbol __imp__AdrOpenDevice@8 referenced in function "class audiere::AudioDevice * __cdecl audiere::OpenDevice(char const *,char const *)" (?OpenDevice@audiere@@YAPAVAudioDevice@1@PBD0@Z)	OgreNewtonFrameListener.obj	
Error	5	error LNK2019: unresolved external symbol __imp__AdrOpenSampleSource@8 referenced in function "class audiere::SampleSource * __cdecl audiere::OpenSampleSource(char const *,enum audiere::FileFormat)" (?OpenSampleSource@audiere@@YAPAVSampleSource@1@PBDW4FileFormat@1@@Z)	OgreNewtonFrameListener.obj	
Error	6	error LNK2019: unresolved external symbol __imp__AdrOpenSound@12 referenced in function "class audiere::OutputStream * __cdecl audiere::OpenSound(class audiere::RefPtr<class audiere::AudioDevice> const &,class audiere::RefPtr<class audiere::SampleSource> const &,bool)" (?OpenSound@audiere@@YAPAVOutputStream@1@ABV?$RefPtr@VAudioDevice@audiere@@@1@ABV?$RefPtr@VSampleSource@audiere@@@1@_N@Z)	OgreNewtonFrameListener.obj	
Never used it at all, but unresolved external symbols means you're either missing a C++ file or your not linking with a library you should be linking with. There are other more sinister things that can cause this, but these are the main two.

I'm guessing you're not linking with an Audiere lib file that you need.
misterface
Halfling
Posts: 92
Joined: Sat Feb 04, 2006 6:41 pm
Location: Belgium

Post by misterface »

strange, included almost every folder!

Code: Select all

"C:\eindwerk\audiere-1.9.4-win32\include";
"C:\eindwerk\audiere-1.9.4-win32\lib";
"C:\eindwerk\audiere-1.9.4-win32\bin";
"C:\eindwerk\audiere-1.9.4-win32"
*update*
forgot additional depend. :oops:

*update2*

Code: Select all

	if (mInputDevice->isKeyDown(Ogre::KC_M)){
		AudioDevicePtr device(OpenDevice());
		OutputStreamPtr sound(OpenSound(device,"C:\eindwerk\Ogre\ogreaddons\OgreNewt\demos\bin\release\error.wav", false));
		sound->setRepeat(true);
		sound->setVolume(1.0f);
		sound->play();
		//getch();
	}
nice! it works very simple :)
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

It compiles now?
misterface
Halfling
Posts: 92
Joined: Sat Feb 04, 2006 6:41 pm
Location: Belgium

Post by misterface »

yes, works great
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla

Post by Rohit Chauhan »

Its not really a tutorial , but i call it a tutorial because of my own experience . Because when i was a beginner to C++ and couldnt understand what a pointer is or what a include path is :P I always used to google for "tutorial setting include path" or "what is pointer tutorial".
Basically , it is neither a tutorial nor a snippet nor walkthrough
, Its just a byproduct of me killing my free time :P
Another thought , if you are an independent game developer , OGREnewtonaudiere(and Blender) can make even a masterpiece like FarCry and you only need to learn OGRE and Newton (Blender
skills taken for granted) .I chose Audiere to make atleast sound integration easy.
If you are Valve or ubisoft :P , then you probably dont need any of these , you would instead go for CryEngine and 3500$ max license , 6000$ fmod license
and a couple of thousands for a physics one .
Well and if any of you really thinks it should be in wiki , you can copy and paste it there .Somebody really nicely edited my that blender to ogre tut , Thanks for great work !!! . And I hate that wiki markup , you write something and see something :x .

Meanwhile I am on to write another tu.............................. :wink:
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
User avatar
Frenetic
Bugbear
Posts: 806
Joined: Fri Feb 03, 2006 7:08 am

Post by Frenetic »

So... not meaning any offense, but these "tutorials" are more for your benefit than helping out others? Perhaps these are more like your own "notes" then, rather than a tutorial aimed at being widely helpful. Not trying to shoot you down, just being practical. ;)

After all, making a good tutorial takes a fair bit of time and effort... (so special thanks to those who have taken the time to write the detailed tutorials in the Wiki!) :)
OvermindDL1
Gnome
Posts: 333
Joined: Sun Sep 25, 2005 7:55 pm

Post by OvermindDL1 »

Two things.

OgreNewt.

Code: Select all

 and [code]
tags. [/code]

:)
User avatar
Frenetic
Bugbear
Posts: 806
Joined: Fri Feb 03, 2006 7:08 am

Post by Frenetic »

OvermindDL1 wrote:

Code: Select all

 and [code]
tags. [/code]
Amen, brotha! :D
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla

Post by Rohit Chauhan »

If this is a tutorial
Sticky: Building a project using Anjuta (a fast tutorial)
http://www.ogre3d.org/phpBB2/viewtopic.php?t=5100

and Sticky: Debian Gnu/Linux Tutorial
http://www.ogre3d.org/phpBB2/viewtopic.php?t=5706

are tutorials , then why mine is not :P

BTW , I love criticism , it helps me improve ! :twisted:
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

Rohit Chauhan wrote:If this is a tutorial
Sticky: Building a project using Anjuta (a fast tutorial)
http://www.ogre3d.org/phpBB2/viewtopic.php?t=5100

and Sticky: Debian Gnu/Linux Tutorial
http://www.ogre3d.org/phpBB2/viewtopic.php?t=5706

are tutorials , then why mine is not :P
Their subjects are accurate. They're tutorials on compiling under certain environments. Your post claims to be a tutorial about creating a "Game Engine in 2 seconds". Even if I could type the contents of your post in 2 seconds (;)), I don't think I'd really have a Game Engine :).
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla

Post by Rohit Chauhan »

I ll have to change seconds to minutes , then it would be manageable
:P

BTW 2 seconds is really a "metaphor" to quickstart

:twisted:
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Post by jacmoe »

I like that you are happy about Ogre, but we have to make sure that the tutorials on the Wiki are quality.
Nothing personal:
The better the tutorials are, the less people have to ask for help. :wink:
User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
x 3

Post by CaseyB »

Like I said before I think it would be awesome to expand this into a full, wiki-able tutorial. I hope that you take the time to do it becuase this shows real potential and I think it would add a lot of value!
Rohit Chauhan
Halfling
Posts: 46
Joined: Sun Mar 05, 2006 8:01 pm
Location: India,Shimla

Post by Rohit Chauhan »

Yes ! I am on to it and as soon as i complete writing 4-5 chapters , i ll post it here and on my site .I have already thought name of the
the "gamekit" , its "BONAfide" , the genuine gamekit !

(BONA= Blender,OGRE,Newton,Audiere)
Yesterday , just finished making racket and ball for my lawn tennis game
You can see the Render here,
http://www.elysiun.com/forum/viewtopic.php?t=63752

Right now , i am putting bones inside my player Model :P

Does anybody know about good "crowd" photos , i can UV map on
stadium mesh i am making?if then please email me at
vicky__chauhan@sancharnet.in

:twisted:
O Draconian Devil ! O Lame Saint !
So Dark the Con of Man !
http://one.fsphost.com/ogre3d/