• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

3d animation in game maker studio 1.4

G

Guest User

Guest
It seems to me that I have a little complex animation code that I developed, are there any alternative ways to make it less difficult for the computer and for me?
create code:

Code:
z=0 does=0 color=0 team=0 player=0 control=1 tex_vid=0 choise=0 hpp=0 hp=150 path_x=x path_y=y path=path_add()crew=0 vidobj=3 speed_path=1
direction2=0 spd=0 time_animation=irandom(300) reload=0 time_attack=0 target=0 dead=0 pause=0 timehp=0
stealth=0 wings=0 teleport=0 hpmax=150 aim=0 fight=0 human=6 humanmax=6 status='lot of'
rotbodyx=0 rotbodyy=0 rotbodyz=0
rotheadx=0 rotheady=0 rotheadz=0
rotpelvisx=0 rotpelvisy=0 rotpelvisz=0
rotshoulderrightx=0 rotshoulderrighty=0 rotshoulderrightz=0
rotshoulderleftx=0 rotshoulderlefty=0 rotshoulderleftz=0
rothandrightx=0 rothandrighty=0 rothandrightz=0
rothandleftx=0 rothandlefty=0 rothandleftz=0
rotbrushrightx=0 rotbrushrighty=0 rotbrushrightz=-90
rotbrushleftx=0 rotbrushlefty=0 rotbrushleftz=90
rotkneerightx=0 rotkneerighty=0 rotkneerightz=0
rotkneeleftx=0 rotkneelefty=0 rotkneeleftz=0
rotlegrightx=0 rotlegrighty=0 rotlegrightz=0
rotlegleftx=0 rotleglefty=0 rotlegleftz=0
rotfootrightx=0 rotfootrighty=0 rotfootrightz=0
rotfootleftx=0 rotfootlefty=0 rotfootleftz=0
rotswordx=-90 rotswordy=0 rotswordz=0
rotgunx=0 rotguny=-90 rotgunz=-90

rotation_bodyy=0 rotation_bodyx=0 rotation_bodyz=0
rotation_headx=0 rotation_heady=0 rotation_headz=0
rotation_pelvisx=0 rotation_pelvisy=0 rotation_pelvisz=0
rotation_shoulderrightx=0 rotation_shoulderrighty=0 rotation_shoulderrightz=0
rotation_shoulderleftx=0 rotation_shoulderlefty=0 rotation_shoulderleftz=0
rotation_handrightx=0 rotation_handrighty=0 rotation_handrightz=0
rotation_handleftx=0 rotation_handlefty=0 rotation_handleftz=0
rotation_brushrightx=0 rotation_brushrighty=0 rotation_brushrightz=-90
rotation_brushleftx=0 rotation_brushlefty=0 rotation_brushleftz=90
rotation_kneerightx=0 rotation_kneerighty=0 rotation_kneerightz=0
rotation_kneeleftx=0 rotation_kneelefty=0 rotation_kneeleftz=0
rotation_legrightx=0 rotation_legrighty=0 rotation_legrightz=0
rotation_legleftx=0 rotation_leglefty=0 rotation_legleftz=0
rotation_footrightx=0 rotation_footrighty=0 rotation_footrightz=0
rotation_footleftx=0 rotation_footlefty=0 rotation_footleftz=0
rotation_swordx=-90 rotation_swordy=0 rotation_swordz=0
rotation_gunx=0 rotation_guny=-90 rotation_gunz=-90
step code:

Code:
if instance_number(bridge)>0{if distance_to_object(instance_nearest(x,y,bridge))=0{if dead=0 z=instance_nearest(x,y,bridge).z+9}
else{if dead=0 z=tgz(x,y)+9}}if instance_number(bridge)=0{if dead=0 z=tgz(x,y)+9}
if tex_vid=0{if color=0 tex_vid=tex_gnome_invaders1 if color=1 tex_vid=tex_gnome_invaders2 if color=2 tex_vid=tex_gnome_invaders3 if color=3 tex_vid=tex_gnome_invaders4}
if mouse_check_button_released(mb_left) and instance_number(obj_mouse)=1 and dead=0{if obj_mouse.time_add<=5
{if distance_to_object(obj_mouse)=0{if choise=0{with(army)if crew=other.crew choise=1}
if control=1{obj_cam.target=id if global.voice=0 global.voice=2}}if choise=1 and control=1
{with(obj_mouse)if distance_to_object(instance_nearest(x,y,units))>0{if mp_grid_path(global.grid,other.path,other.x,other.y,x,y,1)=true
{other.path_x=x other.path_y=y if obj_cam.target=other.id{instance_create(x,y,obj_go)if global.voice=0 global.voice=2}}}}}}
if path_speed>0 and dead=0{if not audio_is_playing(sound_mutant_invaders_go) and distance_to_object(obj_cam)<=256 audio_play_sound(sound_mutant_invaders_go,0,0)}
if distance_to_point(path_x,path_y)>0 and dead=0{if mp_grid_path(global.grid,path,x,y,path_x,path_y,1)=true path_start(path,speed_path,0,false)}
if mp_grid_path(global.grid,path,x,y,path_x,path_y,1)=false or dead=1{path_x=x path_y=y path_speed=0 path_end()}
if distance_to_point(path_x,path_y)=0{path_x=x path_y=y path_speed=0 path_end()}
if abs(get_angle_difference(direction2,direction))>30{path_speed=0}
if choise=1{timehp+=1 if timehp=5{timehp=0 if obj_cam.target.crew=crew{global.hpall+=hp global.hpallmax+=hpmax}}}
direction2=smooth_angle(direction2,direction,3)if abs(get_angle_difference(direction2,direction))<=4 direction2=direction
rotbodyy=smooth_angle(rotbodyy,rotation_bodyy,4*path_speed+3+spd)rotbodyx=smooth_angle(rotbodyx,rotation_bodyx,4*path_speed+3+spd)
rotbodyz=smooth_angle(rotbodyz,rotation_bodyz,4*path_speed+3+spd)
rotheady=smooth_angle(rotheady,rotation_heady,4*path_speed+3+spd)rotheadx=smooth_angle(rotheadx,rotation_headx,4*path_speed+3+spd)
rotheadz=smooth_angle(rotheadz,rotation_headz,4*path_speed+3+spd)
rotpelvisy=smooth_angle(rotpelvisy,rotation_pelvisy,4*path_speed+3+spd)rotpelvisx=smooth_angle(rotpelvisx,rotation_pelvisx,4*path_speed+3+spd)
rotpelvisz=smooth_angle(rotpelvisz,rotation_pelvisz,4*path_speed+3+spd)
rotswordy=smooth_angle(rotswordy,rotation_swordy,4*path_speed+3+spd)rotswordx=smooth_angle(rotswordx,rotation_swordx,4*path_speed+3+spd)
rotswordz=smooth_angle(rotswordz,rotation_swordz,4*path_speed+3+spd)
rotguny=smooth_angle(rotguny,rotation_guny,4*path_speed+3+spd)rotgunx=smooth_angle(rotgunx,rotation_gunx,4*path_speed+3+spd)
rotgunz=smooth_angle(rotgunz,rotation_gunz,4*path_speed+3+spd)
rotshoulderrighty=smooth_angle(rotshoulderrighty,rotation_shoulderrighty,4*path_speed+3+spd)rotshoulderrightx=smooth_angle(rotshoulderrightx,rotation_shoulderrightx,4*path_speed+3+spd)
rotshoulderrightz=smooth_angle(rotshoulderrightz,rotation_shoulderrightz,4*path_speed+3+spd)
rotshoulderlefty=smooth_angle(rotshoulderlefty,rotation_shoulderlefty,4*path_speed+3+spd)rotshoulderleftx=smooth_angle(rotshoulderleftx,rotation_shoulderleftx,4*path_speed+3+spd)
rotshoulderleftz=smooth_angle(rotshoulderleftz,rotation_shoulderleftz,4*path_speed+3+spd)
rothandrighty=smooth_angle(rothandrighty,rotation_handrighty,4*path_speed+3+spd)rothandrightx=smooth_angle(rothandrightx,rotation_handrightx,4*path_speed+3+spd)
rothandrightz=smooth_angle(rothandrightz,rotation_handrightz,4*path_speed+3+spd)
rothandlefty=smooth_angle(rothandlefty,rotation_handlefty,4*path_speed+3+spd)rothandleftx=smooth_angle(rothandleftx,rotation_handleftx,4*path_speed+3+spd)
rothandleftz=smooth_angle(rothandleftz,rotation_handleftz,4*path_speed+3+spd)
rotbrushrighty=smooth_angle(rotbrushrighty,rotation_brushrighty,4*path_speed+3+spd)rotbrushrightx=smooth_angle(rotbrushrightx,rotation_brushrightx,4*path_speed+3+spd)
rotbrushrightz=smooth_angle(rotbrushrightz,rotation_brushrightz,4*path_speed+3+spd)
rotbrushlefty=smooth_angle(rotbrushlefty,rotation_brushlefty,4*path_speed+3+spd)rotbrushleftx=smooth_angle(rotbrushleftx,rotation_brushleftx,4*path_speed+3+spd)
rotbrushleftz=smooth_angle(rotbrushleftz,rotation_brushleftz,4*path_speed+3+spd)
rotkneerighty=smooth_angle(rotkneerighty,rotation_kneerighty,4*path_speed+3+spd)rotkneerightx=smooth_angle(rotkneerightx,rotation_kneerightx,4*path_speed+3+spd)
rotkneerightz=smooth_angle(rotkneerightz,rotation_kneerightz,4*path_speed+3+spd)
rotkneelefty=smooth_angle(rotkneelefty,rotation_kneelefty,4*path_speed+3+spd)rotkneeleftx=smooth_angle(rotkneeleftx,rotation_kneeleftx,4*path_speed+3+spd)
rotkneeleftz=smooth_angle(rotkneeleftz,rotation_kneeleftz,4*path_speed+3+spd)
rotlegrighty=smooth_angle(rotlegrighty,rotation_legrighty,4*path_speed+3+spd)rotlegrightx=smooth_angle(rotlegrightx,rotation_legrightx,4*path_speed+3+spd)
rotlegrightz=smooth_angle(rotlegrightz,rotation_legrightz,4*path_speed+3+spd)
rotleglefty=smooth_angle(rotleglefty,rotation_leglefty,4*path_speed+3+spd)rotlegleftx=smooth_angle(rotlegleftx,rotation_legleftx,4*path_speed+3+spd)
rotlegleftz=smooth_angle(rotlegleftz,rotation_legleftz,4*path_speed+3+spd)
rotfootrighty=smooth_angle(rotfootrighty,rotation_footrighty,4*path_speed+3+spd)rotfootrightx=smooth_angle(rotfootrightx,rotation_footrightx,4*path_speed+3+spd)
rotfootrightz=smooth_angle(rotfootrightz,rotation_footrightz,4*path_speed+3+spd)
rotfootlefty=smooth_angle(rotfootlefty,rotation_footlefty,4*path_speed+3+spd)rotfootleftx=smooth_angle(rotfootleftx,rotation_footleftx,4*path_speed+3+spd)
rotfootleftz=smooth_angle(rotfootleftz,rotation_footleftz,4*path_speed+3+spd)
if pause>0 pause-=1
if path_speed=0 and dead=0 and time_attack=0 and reload=0 and pause=0
{time_animation+=1 if time_animation>300 time_animation=0 spd=0
if time_animation<25
{rotation_bodyy=0 rotation_bodyx=0 rotation_bodyz=0
rotation_headx=0 rotation_heady=0 rotation_headz=0
rotation_pelvisx=0 rotation_pelvisy=0 rotation_pelvisz=0
rotation_shoulderrightx=0 rotation_shoulderrighty=0 rotation_shoulderrightz=0
rotation_shoulderleftx=0 rotation_shoulderlefty=0 rotation_shoulderleftz=0
rotation_handrightx=0 rotation_handrighty=0 rotation_handrightz=0
rotation_handleftx=0 rotation_handlefty=0 rotation_handleftz=0
rotation_brushrightx=0 rotation_brushrighty=0 rotation_brushrightz=-90
rotation_brushleftx=0 rotation_brushlefty=0 rotation_brushleftz=90
rotation_kneerightx=0 rotation_kneerighty=0 rotation_kneerightz=0
rotation_kneeleftx=0 rotation_kneelefty=0 rotation_kneeleftz=0
rotation_legrightx=0 rotation_legrighty=0 rotation_legrightz=0
rotation_legleftx=0 rotation_leglefty=0 rotation_legleftz=0
rotation_footrightx=0 rotation_footrighty=0 rotation_footrightz=0
rotation_footleftx=0 rotation_footlefty=0 rotation_footleftz=0
rotation_swordx=-90 rotation_swordy=0 rotation_swordz=0
rotation_gunx=0 rotation_guny=-90 rotation_gunz=-90}
if time_animation=100
{rotation_bodyy=0 rotation_bodyx=20 rotation_bodyz=0
rotation_headx=0 rotation_heady=0 rotation_headz=30
rotation_pelvisx=-20 rotation_pelvisy=0 rotation_pelvisz=0
rotation_shoulderrightx=-30 rotation_shoulderrighty=30 rotation_shoulderrightz=0
rotation_shoulderleftx=30 rotation_shoulderlefty=30 rotation_shoulderleftz=0
rotation_handrightx=-30 rotation_handrighty=30 rotation_handrightz=0
rotation_handleftx=30 rotation_handlefty=30 rotation_handleftz=0
rotation_brushrightx=0 rotation_brushrighty=0 rotation_brushrightz=-90
rotation_brushleftx=0 rotation_brushlefty=0 rotation_brushleftz=90
rotation_kneerightx=-20 rotation_kneerighty=20 rotation_kneerightz=0
rotation_kneeleftx=20 rotation_kneelefty=20 rotation_kneeleftz=0
rotation_legrightx=20 rotation_legrighty=-20 rotation_legrightz=0
rotation_legleftx=-20 rotation_leglefty=-20 rotation_legleftz=0
rotation_footrightx=0 rotation_footrighty=0 rotation_footrightz=0
rotation_footleftx=0 rotation_footlefty=0 rotation_footleftz=0
rotation_swordx=-90 rotation_swordy=0 rotation_swordz=0
rotation_gunx=0 rotation_guny=-90 rotation_gunz=-90 if irandom(1)=0 pause=60}
if time_animation=200
{rotation_bodyy=0 rotation_bodyx=-20 rotation_bodyz=0
rotation_headx=0 rotation_heady=0 rotation_headz=-30
rotation_pelvisx=20 rotation_pelvisy=0 rotation_pelvisz=0
rotation_shoulderrightx=10 rotation_shoulderrighty=10 rotation_shoulderrightz=0
rotation_shoulderleftx=10 rotation_shoulderlefty=10 rotation_shoulderleftz=0
rotation_handrightx=10 rotation_handrighty=10 rotation_handrightz=0
rotation_handleftx=10 rotation_handlefty=10 rotation_handleftz=0
rotation_brushrightx=0 rotation_brushrighty=0 rotation_brushrightz=-90
rotation_brushleftx=0 rotation_brushlefty=0 rotation_brushleftz=90
rotation_kneerightx=-20 rotation_kneerighty=20 rotation_kneerightz=0
rotation_kneeleftx=20 rotation_kneelefty=20 rotation_kneeleftz=0
rotation_legrightx=20 rotation_legrighty=-20 rotation_legrightz=0
rotation_legleftx=-20 rotation_leglefty=-20 rotation_legleftz=0
rotation_footrightx=0 rotation_footrighty=0 rotation_footrightz=0
rotation_footleftx=0 rotation_footlefty=0 rotation_footleftz=0
rotation_swordx=-90 rotation_swordy=0 rotation_swordz=0
rotation_gunx=0 rotation_guny=-90 rotation_gunz=-90 if irandom(1)=0 pause=60}}
if path_speed!=0 and dead=0 and time_attack=0 and reload=0
{time_animation+=1 if time_animation>16 time_animation=0 spd=10
if time_animation<8
{rotation_bodyy=-30 rotation_bodyx=0 rotation_bodyz=0
rotation_headx=0 rotation_heady=0 rotation_headz=-10
rotation_pelvisx=0 rotation_pelvisy=30 rotation_pelvisz=0
rotation_shoulderrightx=-30 rotation_shoulderrighty=-45 rotation_shoulderrightz=0
rotation_shoulderleftx=30 rotation_shoulderlefty=45 rotation_shoulderleftz=0
rotation_handrightx=0 rotation_handrighty=0 rotation_handrightz=0
rotation_handleftx=0 rotation_handlefty=0 rotation_handleftz=0
rotation_brushrightx=0 rotation_brushrighty=0 rotation_brushrightz=-90
rotation_brushleftx=0 rotation_brushlefty=0 rotation_brushleftz=90
rotation_kneerightx=0 rotation_kneerighty=-45 rotation_kneerightz=0
rotation_kneeleftx=0 rotation_kneelefty=45 rotation_kneeleftz=0
rotation_legrightx=0 rotation_legrighty=-30 rotation_legrightz=0
rotation_legleftx=0 rotation_leglefty=0 rotation_legleftz=0
rotation_footrightx=0 rotation_footrighty=0 rotation_footrightz=0
rotation_footleftx=0 rotation_footlefty=0 rotation_footleftz=0
rotation_swordx=-90 rotation_swordy=0 rotation_swordz=0
rotation_gunx=0 rotation_guny=-90 rotation_gunz=-90}
if time_animation>=8
{rotation_bodyy=30 rotation_bodyx=0 rotation_bodyz=0
rotation_headx=0 rotation_heady=0 rotation_headz=10
rotation_pelvisx=0 rotation_pelvisy=-30 rotation_pelvisz=0
rotation_shoulderrightx=-30 rotation_shoulderrighty=45 rotation_shoulderrightz=0
rotation_shoulderleftx=30 rotation_shoulderlefty=-45 rotation_shoulderleftz=0
rotation_handrightx=0 rotation_handrighty=0 rotation_handrightz=0
rotation_handleftx=0 rotation_handlefty=0 rotation_handleftz=0
rotation_brushrightx=0 rotation_brushrighty=0 rotation_brushrightz=-90
rotation_brushleftx=0 rotation_brushlefty=0 rotation_brushleftz=90
rotation_kneerightx=0 rotation_kneerighty=45 rotation_kneerightz=0
rotation_kneeleftx=0 rotation_kneelefty=-45 rotation_kneeleftz=0
rotation_legrightx=0 rotation_legrighty=0 rotation_legrightz=0
rotation_legleftx=0 rotation_leglefty=-30 rotation_legleftz=0
rotation_footrightx=0 rotation_footrighty=0 rotation_footrightz=0
rotation_footleftx=0 rotation_footlefty=0 rotation_footleftz=0
rotation_swordx=-90 rotation_swordy=0 rotation_swordz=0
rotation_gunx=0 rotation_guny=-90 rotation_gunz=-90}}
draw code:

Code:
d3d_transform_set_identity()
d3d_transform_add_scaling(0.1,0.1,0.1)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_translation(0,0,-8.75)
d3d_transform_add_rotation_z(direction2)
d3d_transform_add_translation(x,y,z)
if choise=1{if team=obj_control.player1_team{if control=1 d3d_model_draw(global.md_circle,0,0,0,background_get_texture(tex_choise_lime))
if control=0 d3d_model_draw(global.md_circle,0,0,0,background_get_texture(tex_choise_blue))}
if team!=obj_control.player1_team d3d_model_draw(global.md_circle,0,0,0,background_get_texture(tex_choise_red))}
d3d_transform_set_identity()
d3d_transform_add_rotation_x(-45)
d3d_transform_add_translation(0,0,16)
d3d_transform_add_rotation_z(obj_cam.direction-90)
d3d_transform_add_translation(x,y,z)
if choise=1 or hpp>0{if hp<=50 d3d_draw_block(-5,-1,0,-5+hp/15,1,0,background_get_texture(tex_live4),1,1)
if hp>50 and hp<=100 d3d_draw_block(-5,-1,0,-5+hp/15,1,0,background_get_texture(tex_live3),1,1)
if hp>100 d3d_draw_block(-5,-1,0,-5+hp/15,1,0,background_get_texture(tex_live2),1,1)
d3d_draw_block(-5,-1,0,5,1,0,background_get_texture(tex_live1),1,1)}
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_body,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotheady)
d3d_transform_add_rotation_x(rotheadx)
d3d_transform_add_rotation_z(rotheadz)
d3d_transform_add_translation(0,0,2)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_head,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotpelvisy)
d3d_transform_add_rotation_x(rotpelvisx)
d3d_transform_add_rotation_z(rotpelvisz)
d3d_transform_add_translation(0,0,-1.2)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_pelvis,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotshoulderrighty)
d3d_transform_add_rotation_x(rotshoulderrightx)
d3d_transform_add_rotation_z(rotshoulderrightz)
d3d_transform_add_translation(0,2.8,1)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_shoulder,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotshoulderlefty)
d3d_transform_add_rotation_x(rotshoulderleftx)
d3d_transform_add_rotation_z(rotshoulderleftz)
d3d_transform_add_translation(0,-2.8,1)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_shoulder,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rothandrighty)
d3d_transform_add_rotation_x(rothandrightx)
d3d_transform_add_rotation_z(rothandrightz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotshoulderrighty)
d3d_transform_add_rotation_x(rotshoulderrightx)
d3d_transform_add_rotation_z(rotshoulderrightz)
d3d_transform_add_translation(0,2.8,1)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_hand,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rothandlefty)
d3d_transform_add_rotation_x(rothandleftx)
d3d_transform_add_rotation_z(rothandleftz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotshoulderlefty)
d3d_transform_add_rotation_x(rotshoulderleftx)
d3d_transform_add_rotation_z(rotshoulderleftz)
d3d_transform_add_translation(0,-2.8,1)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_hand,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotbrushrighty)
d3d_transform_add_rotation_x(rotbrushrightx)
d3d_transform_add_rotation_z(rotbrushrightz)
d3d_transform_add_translation(0,0,-1.5)
d3d_transform_add_rotation_y(rothandrighty)
d3d_transform_add_rotation_x(rothandrightx)
d3d_transform_add_rotation_z(rothandrightz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotshoulderrighty)
d3d_transform_add_rotation_x(rotshoulderrightx)
d3d_transform_add_rotation_z(rotshoulderrightz)
d3d_transform_add_translation(0,2.8,1)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_brush_right,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotbrushlefty)
d3d_transform_add_rotation_x(rotbrushleftx)
d3d_transform_add_rotation_z(rotbrushleftz)
d3d_transform_add_translation(0,0,-1.5)
d3d_transform_add_rotation_y(rothandlefty)
d3d_transform_add_rotation_x(rothandleftx)
d3d_transform_add_rotation_z(rothandleftz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotshoulderlefty)
d3d_transform_add_rotation_x(rotshoulderleftx)
d3d_transform_add_rotation_z(rotshoulderleftz)
d3d_transform_add_translation(0,-2.8,1)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_brush_left,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotswordy)
d3d_transform_add_rotation_x(rotswordx)
d3d_transform_add_rotation_z(rotswordz)
d3d_transform_add_translation(-0.35,0,-1.5)
d3d_transform_add_rotation_y(rotbrushrighty)
d3d_transform_add_rotation_x(rotbrushrightx)
d3d_transform_add_rotation_z(rotbrushrightz)
d3d_transform_add_translation(0,0,-1.5)
d3d_transform_add_rotation_y(rothandrighty)
d3d_transform_add_rotation_x(rothandrightx)
d3d_transform_add_rotation_z(rothandrightz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotshoulderrighty)
d3d_transform_add_rotation_x(rotshoulderrightx)
d3d_transform_add_rotation_z(rotshoulderrightz)
d3d_transform_add_translation(0,2.8,1)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_sword,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotguny)
d3d_transform_add_rotation_x(rotgunx)
d3d_transform_add_rotation_z(rotgunz)
d3d_transform_add_translation(-0.35,0,-2)
d3d_transform_add_rotation_y(rotbrushlefty)
d3d_transform_add_rotation_x(rotbrushleftx)
d3d_transform_add_rotation_z(rotbrushleftz)
d3d_transform_add_translation(0,0,-1.5)
d3d_transform_add_rotation_y(rothandlefty)
d3d_transform_add_rotation_x(rothandleftx)
d3d_transform_add_rotation_z(rothandleftz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotshoulderlefty)
d3d_transform_add_rotation_x(rotshoulderleftx)
d3d_transform_add_rotation_z(rotshoulderleftz)
d3d_transform_add_translation(0,-2.8,1)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_gun,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotkneerighty)
d3d_transform_add_rotation_x(rotkneerightx)
d3d_transform_add_rotation_z(rotkneerightz)
d3d_transform_add_translation(0,1,-2.6)
d3d_transform_add_rotation_y(rotpelvisy)
d3d_transform_add_rotation_x(rotpelvisx)
d3d_transform_add_rotation_z(rotpelvisz)
d3d_transform_add_translation(0,0,-1.2)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_knee,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotkneelefty)
d3d_transform_add_rotation_x(rotkneeleftx)
d3d_transform_add_rotation_z(rotkneeleftz)
d3d_transform_add_translation(0,-1,-2.6)
d3d_transform_add_rotation_y(rotpelvisy)
d3d_transform_add_rotation_x(rotpelvisx)
d3d_transform_add_rotation_z(rotpelvisz)
d3d_transform_add_translation(0,0,-1.2)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_knee,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotlegrighty)
d3d_transform_add_rotation_x(rotlegrightx)
d3d_transform_add_rotation_z(rotlegrightz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotkneerighty)
d3d_transform_add_rotation_x(rotkneerightx)
d3d_transform_add_rotation_z(rotkneerightz)
d3d_transform_add_translation(0,1,-2.6)
d3d_transform_add_rotation_y(rotpelvisy)
d3d_transform_add_rotation_x(rotpelvisx)
d3d_transform_add_rotation_z(rotpelvisz)
d3d_transform_add_translation(0,0,-1.2)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_leg,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotleglefty)
d3d_transform_add_rotation_x(rotlegleftx)
d3d_transform_add_rotation_z(rotlegleftz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotkneelefty)
d3d_transform_add_rotation_x(rotkneeleftx)
d3d_transform_add_rotation_z(rotkneeleftz)
d3d_transform_add_translation(0,-1,-2.6)
d3d_transform_add_rotation_y(rotpelvisy)
d3d_transform_add_rotation_x(rotpelvisx)
d3d_transform_add_rotation_z(rotpelvisz)
d3d_transform_add_translation(0,0,-1.2)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_leg,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotfootrighty)
d3d_transform_add_rotation_x(rotfootrightx)
d3d_transform_add_rotation_z(rotfootrightz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotlegrighty)
d3d_transform_add_rotation_x(rotlegrightx)
d3d_transform_add_rotation_z(rotlegrightz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotkneerighty)
d3d_transform_add_rotation_x(rotkneerightx)
d3d_transform_add_rotation_z(rotkneerightz)
d3d_transform_add_translation(0,1,-2.6)
d3d_transform_add_rotation_y(rotpelvisy)
d3d_transform_add_rotation_x(rotpelvisx)
d3d_transform_add_rotation_z(rotpelvisz)
d3d_transform_add_translation(0,0,-1.2)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_foot,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
d3d_transform_add_scaling(2,2,2)
d3d_transform_add_rotation_x(-90)
d3d_transform_add_rotation_y(rotfootlefty)
d3d_transform_add_rotation_x(rotfootleftx)
d3d_transform_add_rotation_z(rotfootleftz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotleglefty)
d3d_transform_add_rotation_x(rotlegleftx)
d3d_transform_add_rotation_z(rotlegleftz)
d3d_transform_add_translation(0,0,-2)
d3d_transform_add_rotation_y(rotkneelefty)
d3d_transform_add_rotation_x(rotkneeleftx)
d3d_transform_add_rotation_z(rotkneeleftz)
d3d_transform_add_translation(0,-1,-2.6)
d3d_transform_add_rotation_y(rotpelvisy)
d3d_transform_add_rotation_x(rotpelvisx)
d3d_transform_add_rotation_z(rotpelvisz)
d3d_transform_add_translation(0,0,-1.2)
d3d_transform_add_rotation_y(rotbodyy)
d3d_transform_add_rotation_x(rotbodyx)
d3d_transform_add_rotation_z(direction2+rotbodyz)
d3d_transform_add_translation(x,y,z)
d3d_model_draw(global.md_gnome_invaders_foot,0,0,0,background_get_texture(tex_vid))
d3d_transform_set_identity()
 

kburkhart84

Firehammer Games
You really need to do better with formatting your code. Split things up to only have one statement per line. And you can also cache things like the result of background_get_texture(tex_vid) into a variable and just send that do your drawing functions. Making your code better formatted will make it easier both for you to write and read and for anyone helping you.

As far as I can tell, it looks like you are drawing piece by piece the models. Like your character is split into pieces and you manually position each one and draw them separately. This is a quite old way to do it, and as you can see it takes a lot of code for the simplest things.

The more modern way to do this is with skeletal animation. However, it requires your model to be made up with a skeleton, typically done in modelling software like Blender. Then, you need to be able to read the model and skeleton animation information into Gamemaker, and make a shader that can draw the model as animated over time. There are examples of this in the forums here if you look for it. Most are using GMS2 at this point so you are at a disadvantage there.
 
G

Guest User

Guest
Means other way as I understand it to me can not find. Well, such a large code should probably strain the CPU and GPU very much, right?
Especially if there are a lot of such heroes in the room.
 
Last edited by a moderator:

kburkhart84

Firehammer Games
Means other way as I understand it to me can not find.
You aren't looking very hard then. Look in the forum here, in the "Works in Progress" section. Bet you can also do searches with Google to find it. The problem isn't whether it has been done, rather whether you will be able to apply the concepts to your project, even if you did have the right version.

Well, such a large code should probably strain the processor and video card very much, right?
In general, the code you are using will be less performant because you are having to do everything little by little. It is likely fast enough to be fine though unless you are drawings lots of things like this. Today's GPUs are designed to do things in large batches though, which is why you want a shader that does skeletal animation, since you can just throw all the geometry at once to the GPU and the same thing that draws it also handles animating the skeleton and vertices.
 
G

Guest User

Guest
How many of these things are we talking about?
Dozens, less than ten, hundreds?
 

kburkhart84

Firehammer Games
How many of these things are we talking about?
Dozens, less than ten, hundreds?
It depends on your processor and GPU, I don't have an actual number, you would need to test it and figure it out. I can guess that you might get a hundred before seeing slow down, but on older hardware you might only be able to get 20.
 
Why are you blaming GMS for this? You can easily optimize the hell out of what you want and get it running at a smooth frame rate with better results just by switching over to shaders and writing your own pathing system.
 
G

Guest User

Guest
Can you optimisation the function mp_grid_path and path_start? Then can be normal use in game a lot of heroes, who go in?
 
Yes, either by lightening the load on the grid or by using your own system. Even in other games and engines with better graphics and more intrinsic systems, there still is a lot of optimization to get all those detailed characters running their AI simultaneously.
 
G

Guest User

Guest
Can you somehow create one object for each squad, and only it will follow the path, and all squad members will move towards it through mp_potential_step, bypassing all solid objects?
 
Last edited by a moderator:
Top