Contacts
صفحه اصلی پورتال | صفحه اصلی تالار | ثبت نام | اعضاء | گروه ها | جستجو | پرسش و پاسخ | فروشگاه الکترونیکی | خرید پستی بازی های کامپیوتری





صفحه اول انجمنها -> ساخت بازی با نرم افزار 3D Game Studio -> سوال و جواب فنی مجلات AUM - بخش دوم
 

ارسال يك موضوع جديد   پاسخ به يك موضوع ديدن موضوع قبلي :: ديدن موضوع بعدي

سوال و جواب فنی مجلات AUM - بخش دوم
نويسنده
پيغام
مهمان







5 شنبه 22 تير 1385 - 09:41
پاسخ بصورت نقل قول
سلام دوستان
در زیر قسمت دوم سوال و جواب مطرح شده در مجلات گوناگون AUM را مشاهده می فرمائید .
امیدوارم که برخی از سوالات شما عزیزان در این متن پاسخ داده شده باشد.
در ضمن علی آقا ! خیلی لطف دارید . من هم امیدوارم که این مطالب به درد بچه ها بخوره . البته اینرا هم مد نظر داشته باش که من و شما زمانی تشنه وار به دنبال چنین منابعی بودیم و مطمنا" حالا هم کسانی هستند که دنبال چنین مطالبی میگردند .

كد:


Q: I enjoyed the "elevators for skyscrapers" code from Aum36. Can I use the keys on the keyboard to go to a certain floor? "1" would take me to the first floor, "2" would take me to the second floor, and so on.

A: Use the modified version of the script:

 

var video_mode = 7; // 800x600 pixels

var video_depth = 16; // 16 bit mode

 

var floor1 = 39; // heights (in quants) for the 3 floors

var floor2 = 520;

var floor3 = 1032;

 

var goto_floor = 0;

var ready_for_clicks = 1; // enables (1) / disables (0) the elevator buttons

 

/////////////////////////////////////////////////////////////////////////////////

 

bmap pointer_pcx = <pointer.pcx>;

 

/////////////////////////////////////////////////////////////////////////////////

 

string elevator_wmb = <elevator.wmb>;

 

/////////////////////////////////////////////////////////////////////////////////

 

sound beep_sound = <beep.wav>;

 

/////////////////////////////////////////////////////////////////////////////////

 

function toggle_crosshair();

function button_clicked();

 

/////////////////////////////////////////////////////////////////////////////////

 

entity* my_elevator;

entity* button_red;

entity* button_green;

entity* button_blue;

 

/////////////////////////////////////////////////////////////////////////////////

 

function main()

{

       on_d = null; // disable the debug panel for A5

       level_load (elevator_wmb);

       mouse_map = pointer_pcx;

       mouse_mode = 0; // hide the pointer at game start

       while (1)

       {

               mouse_pos.x = pointer.x;

               mouse_pos.y = pointer.y;

               wait (1);

       }               

}

 

function toggle_crosshair()

{

       mouse_mode = (mouse_mode == 0) * 2; // mouse_mode = 0 or 2

}

 

action player1

{

       proc_late();

       player = my;

       my.invisible = on; // hide the player model

       while (1)

       {

               vec_set (camera.pos, my.pos);

               camera.z += 50;

               camera.pan = my.pan;       

               camera.tilt += 10 * mouse_force.y * time;

               my.pan -= 20 * mouse_force.x * time;

 

               vec_set (temp, my.x);

               temp.z -= 3000;

               trace_mode = ignore_me + ignore_passable + use_box;

               temp.z = -trace (my.x, temp); // trace 3000 quants below player's feet

 

               temp.x = 10 * (key_w - key_s) * time * ready_for_clicks;

               temp.y = 8 * (key_a - key_d) * time * ready_for_clicks;

 

               ent_move (temp, nullvector);

               wait (1);

       }

}

 

action elevator

{

       proc_late();

       my_elevator = my;

       my.z = floor1; // stay out of trouble (Wed can drag you towards the dark side...)

}

 

action button

{

       my.light = on;

       my.lightrange = 0;

       my.unlit = on;

       my.ambient = -100;

       if (my.skill1 == 1)

       {

               button_red = my;

               my.lightred = 255;

               my.lightgreen = 0;

               my.lightblue = 0;

               goto_floor = 1;

       }

       if (my.skill1 == 2)

       {

               button_green = my;

               my.lightred = 0;

               my.lightgreen = 255;

               my.lightblue = 0;

               goto_floor = 2;

       }

       if (my.skill1 == 3)

       {

               button_blue = my;

               my.lightred = 0;

               my.lightgreen = 0;

               my.lightblue = 255;

               goto_floor = 3;

       }

       my.enable_click = on;

       my.event = button_clicked;

}       

 

function button_clicked()

{

       if (ready_for_clicks == 0) {return;} // don't allow multiple clicks while the elevator is moving

       ready_for_clicks = 0; // don't register button clicks for now

       if (goto_floor == 1) // pressed the red (1st floor) button?

       {

               if (my_elevator.z == floor1) // if the elevator is at the first floor already

               {       

                       ready_for_clicks = 1; // enable clicking again

                       return; // do nothing

               }

               if ((my_elevator.z == floor2) || (my_elevator.z == floor3)) // if the elevator is at the second or third floor

               {       

                       while (my_elevator.z > floor1)

                       {

                               my_elevator.z -= 5 * time;

                               player.z = my_elevator.z + 48; // 48 = experimental value, depends on the height of the model

                               button_red.z = my_elevator.z + 81; // experimental values

                               button_green.z = my_elevator.z + 105;

                               button_blue.z = my_elevator.z + 129;

                               wait (1);

                       }

               }

               my_elevator.z = floor1;

       }

       if (goto_floor == 2) // pressed the green (2nd floor) button?

       {

               if (my_elevator.z == floor2) // if the elevator is at the second floor already

               {       

                       ready_for_clicks = 1; // enable clicking again

                       return; // do nothing

               }

               if (my_elevator.z == floor1) // if the elevator is at the first floor

               {       

                       while (my_elevator.z < floor2)

                       {

                               my_elevator.z += 5 * time;

                               player.z = my_elevator.z + 48; // 48 = experimental value, depends on the height of the model

                               button_red.z = my_elevator.z + 81;

                               button_green.z = my_elevator.z + 105;

                               button_blue.z = my_elevator.z + 129;

                               wait (1);

                       }

               }

               if (my_elevator.z == floor3) // if the elevator is at the third floor

               {       

                       while (my_elevator.z > floor2)

                       {

                               my_elevator.z -= 5 * time;

                               player.z = my_elevator.z + 48; // 48 = experimental value, depends on the height of the model

                               button_red.z = my_elevator.z + 81;

                               button_green.z = my_elevator.z + 105;

                               button_blue.z = my_elevator.z + 129;

                               wait (1);

                       }

               }

               my_elevator.z = floor2;

       }

       if (goto_floor == 3) // pressed the blue (3rd floor) button?

       {

               if (my_elevator.z == floor3) // if the elevator is at the third floor already

               {       

                       ready_for_clicks = 1; // enable clicking again

                       return; // do nothing

               }

               if ((my_elevator.z == floor1) || (my_elevator.z == floor2)) // if the elevator is at the first or second floor

               {       

                       while (my_elevator.z < floor3)

                       {

                               my_elevator.z += 5 * time;

                               player.z = my_elevator.z + 48; // 48 = experimental value, depends on the height of the model

                               button_red.z = my_elevator.z + 81;

                               button_green.z = my_elevator.z + 105;

                               button_blue.z = my_elevator.z + 129;

                               wait (1);

                       }

               }

               my_elevator.z = floor3;

       }

       button_red.z = my_elevator.z + 81;

       button_green.z = my_elevator.z + 105;

       button_blue.z = my_elevator.z + 129;

       ready_for_clicks = 1;

}

 

 

on_mouse_right = toggle_crosshair;

 

 

function go_floor1()

{

       goto_floor = 1;

       button_clicked(); // call the event function

}

 

function go_floor2()

{

       goto_floor = 2;

       button_clicked(); // call the event function

}

 

function go_floor3()

{

       goto_floor = 3;

       button_clicked(); // call the event function

}

 

on_1 = go_floor1;

on_2 = go_floor2;

on_3 = go_floor3;

 

 

Q: How can I move objects using the mouse?  When you click an object and move it around the object should follow the mouse.

A: Use this example; it allows you to pick up, move and drop objects:

 

function pick_or_drop()

{

       wait (1);

       my.skill1 += 1;

       if ((my.skill1 % 2) == 1) // clicked the object?

       {

               while (mouse_left == on) {wait (1);}

               while (mouse_left == off) // move the object until the player presses the mouse button again

               {

                       temp.x = pointer.x;

                       temp.y = pointer.y;

                       temp.z = 200; // move the object 200 quants below the camera, play with this value

                       vec_for_screen(temp.x, camera);

                       my.x = temp.x;

                       my.y = temp.y;

                       my.z = temp.z;

                       wait (1);

               }

       }

       else // drop the object

       {

               vec_set (temp.x, my.x);

               temp.z -= 3000;

               trace_mode = ignore_me + ignore_sprites + ignore_models + use_box;

               my.z -= trace (my.pos, temp); // place the object on the ground

       }

}

 

action click_and_move

{

       my.skill1 = 0;

       my.enable_click = on;

       my.event = pick_or_drop;

}

 

 

Q: How can i have a multi-language game (English / German)?

A: Use the following example:

 

define english 1;

define german 2;

 

string displayed_str;

 

text english_txt // create an array of strings using a text

{

       strings = 5;

       string = "english text 1";

       string = "english text 2";

       string = "english text 3";

       string = "english text 4";

       string = "english text 5";

}

 

text german_txt // create an array of strings using a text

{

       strings = 5;

       string = "german text 1";

       string = "german text 2";

       string = "german text 3";

       string = "german text 4";

       string = "german text 5";

}

 

text displayed_txt

{

       pos_x = 300;

       pos_y = 100;

       string = displayed_str;

}

 

function display_text(line_number, language)

{

       if (language == english)

       {

               str_cpy (displayed_str, english_txt.string[line_number]); // set the proper English string

       }

       if (language == german)

       {

               str_cpy (displayed_str, german_txt.string[line_number]); // set the proper German string

       }

       displayed_txt.visible = on; // show the text

       sleep (5); // for 5 seconds

       displayed_txt.visible = off;

}

 

// display_text (0, english) will display "english text 1"

// display_text (3, german) will display "german text 4"

 

 

Q: How can I create a simple 3D side scrolling player and camera snippet?

A: Use the following snippet as a base:

 

// this action is set up for a player that's traveling from left to right in Wed's top view

action player_side_scroll

{

       var walk_percentage;

       while (1)

       {

               c_move (my, vector((key_cul - key_cur) * 2 * time, 0, 0), nullvector, glide);

               if (key_cur + key_cul != 0)

               {

                       ent_animate(my, "walk", walk_percentage, anm_cycle);

                       walk_percentage += 3 * (key_cul - key_cur) * time; // 3 = "walk" animation speed

               }

               else

               {

                       ent_animate(my, "stand", walk_percentage, anm_cycle);

                       walk_percentage += 2 * time;

               }

               camera.x = my.x;

               camera.y = my.y + 300; // might need changes depending on your level setup

               camera.z = my.z;

               camera.pan = my.pan - 90;

               wait (1);

       }

}

 

Q: I'd like to know how to set the frame rate directly. I tried setting fps_max at 60 but I was getting 56 fps. If I set the fps_max at 70, it was running at 66.7 or so. Classic games, like Sonic and Mario, run at 60 fps and the frame rate is kept as is. It's either I run at 56 (too slow and a little jerky at times) or 67 (too fast). How do I set the fps at exactly 60?

A: Fps_max allows you to set an approximate (maximum) value for the frame rate; however, you can use a small script to do the fine tuning. Please remember that the frame rate won't be exactly the same on other computers because of their different video cards.

 

// use "1" and "Q" to set fps_max, and then use the "real" fps_max value in your script

 

var fpsec;

var init_frames;

 

text info_txt

{

       layer = 20;

       pos_x = 60;

       pos_y = 0;

       string = "fps_max            real frame rate";

       flags = visible;

}

 

panel framerate_pan

{

       pos_x = 50;

       pos_y = 20;

       layer = 15;

       digits = 20, 0, 4, _a4font, 1, fps_max;       

       digits = 150, 0, 4, _a4font, 1, fpsec;       

       flags = overlay, refresh, visible;

}

 

starter set_fpsmax()

{

       while (1)

       {

               if (key_1 == on)

               {

                       fps_max += 5 * time;

               }

               if (key_q == on)

               {

                       fps_max -= 5 * time;

               }

               init_frames = total_frames;

               sleep (1);

               fpsec = total_frames - init_frames;

               wait (1);

       }

}

 

 

Q: I'd like to have a switch that turns on / off a light; more than that, it should pop up a text when the player is touching it with the mouse. Is this possible?

A: Sure.

 

text light_txt

{

       layer = 2;

       pos_x = 300;

       pos_y = 275;

       string = "That's a light switch!";

}

 

function light_on_off()

{

       my.skill1 += 1;

       if ((my.skill1 % 2) == 1)

       {

               my.lightrange = 500;

       }

       else

       {       

               my.lightrange = 0;

       }

}

 

action light_source // attach it to the light source

{

       my.skill1 = 0;

       my.red = 255;

       my.green = 255;

       my.blue = 200;

       my.enable_scan = on;

       my.event = light_on_off;

}

 

function switch_event()

{

       if (event_type == event_click)

       {

               wait (1);

               temp.x = 360; // horizontal scanning angle

               temp.y = 180; // vertical scanning angle

               temp.z = 1000; // scanning range = 1000 quants

               scan_entity (my.x, temp);

       }

       else // touched with the mouse?

       {

               light_txt.visible = on; // display the text for 5 seconds

               sleep (5);

               light_txt.visible = off;

       }

}

 

action light_switch // attach it to the switch

{

       my.enable_click = on;

       my.enable_touch = on;

       my.event = switch_event;

}

 

 

Q: I want to place a panel on the screen (2d coordinates) exactly over a special 3d position. How can I do that?

A: Use the following example:

 

bmap my_pcx = <my.pcx>;

 

panel my_pan

{

       bmap = my_pcx;

       layer = 15;

       flags = overlay, refresh, visible;

}

 

function highlight_me()

{

       var temporary;

       while (1)

       {

               vec_set (temporary, my.x);

               vec_to_screen (temporary, camera);

               my_pan.pos_x = temporary.x;

               my_pan.pos_y = temporary.y;

               wait (1);

       }

}

 

action my_entity

{

       highlight_me(); // attach the panel to the entity

       // put the rest of the code for your entity here

}

 

 

Q: In my game I have a gun model. I don't want a player model but I want the gun to be attached to the screen like in a fps game. Can anybody help me?

A: Use this simple "entity" definition:

 

entity my_gun

{

       type = <microuzi.mdl>; // put the name of your model here

       layer = 10;

       view = camera;

       x = 25; // x, y, z adjust the position of the weapon in relation to the camera

       y = -10;

       z = -10;

       flags = visible;

}

 

 

Q: Has anyone tried to run the engine in a frame? I can see how it would be done using panels, overlaying the areas you don't want showing - but isn't that a waste of resources?

A: You don't have to hide the areas that don't need to be displayed - create a smaller engine window and place it where you want it like this:

 

// make sure that big.pcx has a black (rbg = 000) cutout that has the same size with the small camera

bmap big_pcx = <big.pcx>;

 

panel big_pan // that's a 640x480 pixels bitmap

{

       bmap = big_pcx;

       layer = 15;

       flags = overlay, refresh, visible;

}

 

view small_camera

{

       layer = 20; // appears over big_pan

       pos_x = 63; // pos_x and pos_y give the position of the view

       pos_y = 188;

       size_x = 116; // size_x and size_y give its size

       size_y = 160;

       flags = visible;

}

 

starter action_camera()

{

       camera.visible = off; // hide the big, predefined camera

       while (player == null) {wait (1);}

       while (1)

       {

               small_camera.x = player.x; // show the player on the small camera

               small_camera.y = player.y;

               small_camera.z = player.z + 200;

               small_camera.pan = player.pan;

               small_camera.tilt = -90;

               wait (1);

       }

}

Q: Can I display the engine version on the screen? I am a beta tester and I'm not sure what version I'm running at a certain moment.

A: Use this example:

 

string version_str;

string engine_str;

 

text version_txt

{

       layer = 5;

       pos_x = 30;

       pos_y = 25;

       string = engine_str;

}

 

starter display_version()

{

       sleep (5); // wait until the level is loaded, the splash screen is displayed, and so on

       str_for_num(version_str, version);

       str_cpy(engine_str, "Starting Acknex v");

       str_cat(engine_str, version_str);

       version_txt.visible = on; // show the engine version for 5 seconds

       sleep (5);

       version_txt.visible = off;

}




سر بلند باشید : ستاره
ارسال  بازگشت به بالا
 

نويسنده
پيغام
Ali
مدیر کل
مدیر کل


تاريخ عضويت: شنبه 20 تير 1383
تعداد ارسالها: 2983
محل سكونت: On the edge


جمعه 23 تير 1385 - 07:43
پاسخ بصورت نقل قول
ستاره جان این مجلات AUM چجورین ؟ مجانی هستن یا پولی ؟ چطوره همشون رو بگیریم ، درسته بذاریم برای بچه ها تا استفاده کنن...



علی

_________________
پی سی گیمرز - آرشيو بزرگ بازی های کامپیوتری
ارسال  بازگشت به بالا
ديدن مشخصات كاربر ارسال پيغام خصوصي ارسال ايميل ديدن وب سايت كاربر نام كاربري در پيغامگير Yahoo
 

نويسنده
پيغام
jonathan
مدیر انجمن
مدیر انجمن


تاريخ عضويت: جمعه 8 ارديبهشت 1385
تعداد ارسالها: 1166
محل سكونت: شيراز


جمعه 23 تير 1385 - 11:34
پاسخ بصورت نقل قول
واقعا لطف داريد

_________________
Then you came right in
tearing out my soul
tearing out my soul
tearing out my soul
tearing out my soul
tearing out my soul
ارسال  بازگشت به بالا
ديدن مشخصات كاربر ارسال پيغام خصوصي
 

نويسنده
پيغام
jonathan
مدیر انجمن
مدیر انجمن


تاريخ عضويت: جمعه 8 ارديبهشت 1385
تعداد ارسالها: 1166
محل سكونت: شيراز


جمعه 23 تير 1385 - 11:35
پاسخ بصورت نقل قول
واقعا لطف داريد

_________________
Then you came right in
tearing out my soul
tearing out my soul
tearing out my soul
tearing out my soul
tearing out my soul
ارسال  بازگشت به بالا
ديدن مشخصات كاربر ارسال پيغام خصوصي
 

نويسنده
پيغام
مهمان







1 شنبه 25 تير 1385 - 20:53
پاسخ بصورت نقل قول
مجلات AUM بصورت کتابهای الکترونیک از سایت www.3dgamestudio.com به صورت کاملا رایگان قابل دانلود هستند که شامل پروژه و ... هستند .
ارسال  بازگشت به بالا
 

نمايش نامه هاي ارسال شده قبلي:   
ارسال يك موضوع جديد   پاسخ به يك موضوع    صفحه 1 از 1 تمام ساعات و تاريخها بر حسب 3.5+ ساعت گرينويچ مي باشد


 
پرش به:  


شما نمي توانيد در اين انجمن نامه ارسال كنيد.
شما نمي توانيد به موضوعات اين انجمن پاسخ دهيد
شما نمي توانيد نامه هاي ارسالي خود را در اين انجمن ويرايش كنيد
شما نمي توانيد نامه هاي ارسالي خود را در اين انجمن حذف كنيد
شما نمي توانيد در نظر سنجي هاي اين انجمن شركت كنيد


unity3d

بازگردانی به فارسی : علی کسایی @ توسعه مجازی کادوس 2004-2011
Powered by phpBB © 2001, 2011 phpBB Group
| Home | عضويت | ليست اعضا | گروه هاي كاربران | جستجو | راهنماي اين انجمن | Log In |