FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

sio2 beginner

4 posters

Go down

sio2 beginner Empty sio2 beginner

Post  sindhutiwari Wed Jun 03, 2009 11:45 am

hi friends ,
i have developed utility applications for iphone , need to develop a game ,
it will be very much helpful if some one could answer to it

Q1. i need to move a character and when i press a button it must fire -- how to do this ? using accelerometer movement is possible but shooting ?
Q2. need to move a character which find's another character (player) and shoots -- AI any clues

thats all , a quick description will give a start to my project

regards
sindhu tiwari

sindhutiwari

Posts : 3
Join date : 2009-06-03

Back to top Go down

sio2 beginner Empty Re: sio2 beginner

Post  oioioi Wed Jun 03, 2009 1:32 pm

Q1 - look at the touch functions in the tutorials, all you need to do is check if the x and y pos of the touch is within the shoot button. If your making a shooting game I can post my code for the shoot function, just tell me if you need it.

Q2 - there are lots of info online about AI, there is noting sio2 specific you need to know to make AI

oioioi

Posts : 136
Join date : 2008-12-02
Location : Norway

Back to top Go down

sio2 beginner Empty Re: sio2 beginner

Post  yarri Wed Jun 03, 2009 4:03 pm

AI steering & seeking... I recommend the Opensteer library:
http://opensteer.sourceforge.net/

--yarri

yarri

Posts : 81
Join date : 2009-04-10

Back to top Go down

sio2 beginner Empty @ oioioi

Post  sindhutiwari Wed Jun 03, 2009 7:15 pm

hello friend ,
Thanks for the quick response
it will be great if you could post code here or send me at sindhutiwari@hotmail.com

regarding AI .. i am a big dumbo ..looking on internet , if i get something good i will post here .. for reference to beginners like me .

sindhutiwari

Posts : 3
Join date : 2009-06-03

Back to top Go down

sio2 beginner Empty Re: sio2 beginner

Post  oioioi Thu Jun 04, 2009 8:13 am

here is the code I use in my fps project:
Code:
bool shoot(int range)//range is how far away you can hit a object, I use 100-
{   
   btVector3 from( sio2->_SIO2camera->_SIO2transform->loc->x,
              sio2->_SIO2camera->_SIO2transform->loc->y,
              sio2->_SIO2camera->_SIO2transform->loc->z);
   float totalDistance = fabs(sio2->_SIO2camera->_SIO2transform->dir->x) +
                     fabs(sio2->_SIO2camera->_SIO2transform->dir->y) +
                     fabs(sio2->_SIO2camera->_SIO2transform->dir->z);
   vec3 increase;
   increase.x = sio2->_SIO2camera->_SIO2transform->dir->x / totalDistance;
   increase.y = sio2->_SIO2camera->_SIO2transform->dir->y / totalDistance;
   increase.z = sio2->_SIO2camera->_SIO2transform->dir->z / totalDistance;
   
   btVector3 to( (increase.x * range) + sio2->_SIO2camera->_SIO2transform->loc->x,
             (increase.y * range) + sio2->_SIO2camera->_SIO2transform->loc->y,
             (increase.z * range) + sio2->_SIO2camera->_SIO2transform->loc->z);
   
   
   btCollisionWorld::ClosestRayResultCallback ray( from, to );
   sio2->_SIO2physic->_btSoftRigidDynamicsWorld->rayTest( from, to, ray );
   if( ray.hasHit() ) //if there is a hit
   {
      btRigidBody* hitRigidbody = btRigidBody::upcast( ray.m_collisionObject );
      if( hitRigidbody )//if the object is dynamic of rigidbody(not static)
      {   
         SIO2object *hit = (SIO2object*) hitRigidbody->getUserPointer();
         //do stuff to hit object, like reduce HP and stuff like that
         return true;//return true if we got a hit, you could of course change it to return the hit object if you want
      }
   }
   return false;//return false if no object was hit
}

This function finds the first colliding object on a ray form the camera to a given range in the direction the camera is looking .This is for a first person shooter! If you want to use it for a different type of game you need to change the "from" and "to" vectors to the values you want.


btw is that openSteer thing only for racing games?

oioioi

Posts : 136
Join date : 2008-12-02
Location : Norway

Back to top Go down

sio2 beginner Empty few problems again

Post  sindhutiwari Sun Jun 07, 2009 8:01 pm

Thanks @ above , i am still a noob so please clarify few more doubts i will be thankful for ever

1. I have learned rendering a blender file into the project , using the template provided , how to access different objects ?
clarification : i have seen in examples that a object is accessed by its name , now i want to do something like , i want to access objects individually and animate them .

2. Thanks for the shooting code , how to assign the shooting code to my character ?
clarification : i can place a button like shoot , on key press i will call that shoot method but how to interact with that object, (assigning different events to different objects )

3. suppose its like levels i want to render more than 1 blender file , how to do that ?
clarification : suppose i have a buttons like level 1 and level 2 now level 1 loads a different .sio2 file and level two too, please tell me how to do that


* i am still a noob with this ..

sindhutiwari

Posts : 3
Join date : 2009-06-03

Back to top Go down

sio2 beginner Empty Re: sio2 beginner

Post  sio2interactive Sun Jun 07, 2009 8:46 pm

I really suggest you to do the following for each tutorial:

1. Watch the video tutorial (if available)

2. Read and understand the code that is used for the tutorial

3. Reproduce from scratch the tutorial using the default template.

You'll see that this will answer all your questions Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

sio2 beginner Empty Re: sio2 beginner

Post  yarri Mon Jun 08, 2009 1:20 am

Um, your questions seem to be more about game design than the SDK, but here goes...

>i want to access objects individually and animate them .
Two major choices: control object motion directly yourself (IPO or setting the object's location manually) or using physics (Bullet).

>but how to interact with that object, (assigning different events to different objects )
In your main loop (ie., templateRender() ) either directly control the object and check for collisions or use Bullet and check for collisions.

>suppose i have a buttons like level 1 and level 2 now level 1 loads a different .sio2 file and level two too
Lots of choices, I guess the major choice you need to make is whether to use UIKit or not? I'm using a ViewController to create a game lobby (ie., manage levels) and just pass the level information to the engine (ie., templateLoading() ).

--yarri

yarri

Posts : 81
Join date : 2009-04-10

Back to top Go down

sio2 beginner Empty Re: sio2 beginner

Post  sio2interactive Mon Jun 08, 2009 2:03 am

dude... make him learn progressively don't scare him right away Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

sio2 beginner Empty Re: sio2 beginner

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum