sio2 beginner
4 posters
sio2 beginner
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
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
Re: sio2 beginner
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
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
@ oioioi
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 .
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
Re: sio2 beginner
here is the code I use in my fps project:
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?
- 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
few problems again
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 ..
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
Re: sio2 beginner
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
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
Re: sio2 beginner
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
>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
Similar topics
» Request: glut+SIO2 project template with SIO2 releases.
» SIO2 md2 Tutorial
» sio2 and big map
» Budweiser, SIO2, & Beer Pong
» SIO2 v1.3.6
» SIO2 md2 Tutorial
» sio2 and big map
» Budweiser, SIO2, & Beer Pong
» SIO2 v1.3.6
Permissions in this forum:
You cannot reply to topics in this forum