FPS Problems (There Are Many) Need Help
#1
Posted 16 September 2012 - 11:48 PM
#2
Posted 17 September 2012 - 12:42 AM
#3
Posted 17 September 2012 - 01:34 AM
Current Problems
Screen animations don't play. 7
Turret guns fire animations don't play. 7
No sound for hitting a turret gun. (easy fix, no internet) 1
No friction in backwards movement. 10 (might not be fixable)
Bullet holes don't show up. 6
Friendly NPCs shooting animation doesn't play. 7
Crouching can be smoother. 4
When you call one penguin and then go near another one, it follows you too, then when you stop them, they all stop and no longer move. 7
Projectiles don't change Z when player does. (not sure if player changes Z either) 10
Floors are acting funny. All except snow floor. 10
Achievement system works, but displaying the achievements doesn't. 8
Vehicles are dispayed funny. 10
Exploded bodies are small. 7
Scrolling acts funny 8
1=Small Problem/Easily Fixed, 10=Major Problem/Hole in Game Engine
#4
Posted 17 September 2012 - 10:51 PM
#5
Posted 18 September 2012 - 11:43 AM
I get the impression that you're dealing with a huge engine even you don't know how or why it works, if it even does. Why'd you think anyone here would want to dig through such engine if you don't?
Pick one problem at a time and post the relevant pieces of code, then you're much likely to gain answers.
#6
Posted 18 September 2012 - 10:34 PM
@Tepi As I said above, most if not all of these bugs are ones that I either couldn't fix at all or that I couldn't come up with a way to fix them. About the engine, about 98% of the engine is my own coding. This engine was built off of an engine I found entitled "Fps 6.1" which was an extension to the original FPS tutorial. I understand all of it that I coded and almost all of what I didn't. As for the relevant codes for individual problems, I had thought about doing that but I figured putting up the engine would be easier, but as you wish.
Screen Animations Problem
Sprite: sprite_needle_anim Solid: false Visible: true Depth: -100 Persistent: false Parent: par_gun Mask: <same as sprite> Create Event: for all gun1: destroy the instance for all gun2: destroy the instance for all gun3: destroy the instance for all knife: destroy the instance for all gun4: destroy the instance for all gun5: destroy the instance for all overlay: destroy the instance for all obj_crowbar: destroy the instance for all obj_wrench: destroy the instance for all gun6: destroy the instance for all gun7: destroy the instance for all gun8: destroy the instance for all pistol: destroy the instance execute code: image_speed = 0.4; image_index = 0; Other Event: Animation End: destroy the instance Draw Event: execute code: d3d_set_projection_ortho(0,0,640,480,0); d3d_set_hidden(false); d3d_set_lighting(false); draw_sprite_ext(sprite_needle_anim,0,206,480-256,2,2,0,c_white,1); draw_set_halign(fa_center) draw_set_alpha(0.4); draw_set_alpha(1); d3d_set_hidden(true); d3d_set_lighting(true);
Turret Gun Problems
Sprite: spr_turret
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent: obj_monster_basic
Mask: <same as sprite>
Create Event:
set variable image_speed to 0.3
set variable image_index to floor(random(4))
execute code:
z1=21
z2=0
mhealth=12
fire=0
if expression distance_to_object(obj_player)<210 is true
if fire is equal to 0
set Alarm 0 to 5
set variable fire to 1
Destroy Event:
execute code:
instance_create(x,y,obj_monster3_dead);
instance_create(x-5,y,chaingunclip);
global.turretskilled+=1
Alarm Event for alarm 0:
execute code:
sprite_index=spr_turret_shoot
set Alarm 1 to 5
Alarm Event for alarm 1:
execute code:
t=instance_create(x,y,bul3)
t.z=self.z1
instance_create(x+random(5),y+random(5),bullet)
sound_play(snd_shot3)
if expression distance_to_object(obj_player)<210 is true
set Alarm 0 to 1
Step Event:
if expression distance_to_object(obj_player)<210 is true
if fire is equal to 0
set Alarm 0 to choose(1,2,3,4,5)
set variable fire to 1
else
if expression distance_to_object(ally_parent)<210 is true
if fire is equal to 0
set Alarm 0 to choose(1,2,3,4,5)
set variable fire to 1
if mhealth is smaller than 1
destroy the instance
Begin Step Event:
execute code:
if (point_distance(x,y,global.camx,global.camy) > 210)
{ speed = 0 and image_speed=0; exit; }
Collision Event with object obj_barrel_exp:
destroy the instance
Other Event: Animation End:
if sprite_index is equal to spr_turret_shoot
set the sprite to spr_turret with subimage 0 and speed 0
set Alarm 0 to choose(1,2,3,4,5)
Draw Event:
execute code:
{
if (point_distance(x,y,global.camx,global.camy) > 240) exit;
var tex;
tex = sprite_get_texture(sprite_index,image_index);
d3d_draw_wall(x-6*global.camsin,y-6*global.camcos,z1,
x+6*global.camsin,y+6*global.camcos,z2,tex,1,1);
}Backwards Friction Problem (Could be something wrong with the engine I built off of, this is parallel to the code for forwards movement)
{
var maxspeed;
maxspeed = 2.5;
if keyboard_check(vk_shift)
{
if chaingunequip=true
{
maxspeed = 3
}
else
if intank=true
{
maxspeed = 1.0
}
else
if onbike=true
{
maxspeed = 10
}
else
if useturret=true
{
exit
}
else
maxspeed = 6
}
else
if chaingunequip=true
{
maxspeed = 1.5
}
else
if intank=true
{
maxspeed = 0.5
}
else
if onbike=true
{
maxspeed = 8
}
else
if useturret=true
{
exit
}
if (speed > -maxspeed )
{
speed = min(-maxspeed ,speed+0.4);
}
}Bullet Holes Problem (this is one of those problems/features that I didn't know how to code it, so I did something simple)
Information about object: obj_bullethole_vert
Sprite: spr_wall1_vert
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: sprite176
Create Event:
execute code:
{
x1 = x;
x2 = x;
y1 = y-.25;
y2 = y+.25;
z1 = par_bullet.z-.5
z2 = par_bullet.z+.5
//par_bullet is the parent of all moving bullets that come from weapons
tex = background_get_texture(tex_bullethole);
}
Draw Event:
execute code:
{
if (point_distance(x,y,global.camx,global.camy) > 340) exit;
d3d_draw_wall(x1,y1,z1,x2,y2,z2,tex,1,1);
}
Information about object: obj_bullethole_hor
Sprite: spr_wall1_hor
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: sprite175
Create Event:
execute code:
{
x1 = x-.25;
x2 = x+.25;
y1 = y;
y2 = y;
z1 = par_bullet.z-.5
z2 = par_bullet.z+.5
tex = background_get_texture(tex_bullethole);
}
Draw Event:
execute code:
{
if (point_distance(x,y,global.camx,global.camy) > 340) exit;
d3d_draw_wall(x1,y1,z1,x2,y2,z2,tex,1,1);
}Friendly NPC Problem
Information about object: obj_penguin
Sprite: spr_monster
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent: ally_parent
Mask: <same as sprite>
Create Event:
set variable image_speed to 0.3
set variable image_index to floor(random(4))
execute code:
z1=24
z2=3
go=0
ahealth=10
fire=0
follow=false
set the sprite to spr_penguin_walk with subimage -1 and speed 0.3
if expression distance_to_object(obj_monster_basic)<210 is true
if fire is equal to 0
set Alarm 0 to choose(15,24,30,37,46)
set variable fire to 1
Destroy Event:
execute code:
instance_create(x,y,obj_penguin_dead);
instance_create(x-5,y,smgclip);
play sound snd_penguindie; looping: false
Alarm Event for alarm 0:
execute code:
go=1
sprite_index=spr_penguin_shoot
set Alarm 1 to 5
Alarm Event for alarm 1:
execute code:
t=instance_create(x,y,obj_penguin_bullet)
t.z=self.z1
instance_create(x+random(5),y+random(5),bullet)
sound_play(snd_shot)
Step Event:
if expression distance_to_object(obj_monster_basic)<210 is true
if fire is equal to 0
set Alarm 0 to choose(15,24,30,37,46)
set variable fire to 1
if ahealth is smaller than 1
destroy the instance
Begin Step Event:
execute code:
if follow=true
{
move_towards_point(global.camx,global.camy,1.4);
}
else
if go=0
{
if (point_distance(x,y,obj_monster_basic.x,obj_monster_basic.y) > 210)
{ speed = 0 and image_speed=0; exit; }
if (collision_line(x,y,obj_monster_basic.x,obj_monster_basic.y,obj_wall_basic,false,false))
{ speed = 0 and image_speed=0; exit; }
if (point_distance(x,y,obj_monster_basic.x,obj_monster_basic.y) < 12)
{
speed = 0;
exit;
}
move_towards_point(obj_monster_basic.x,obj_monster_basic.y,1.4);
}
else
if go=1
{
speed=0
}
Collision Event with object obj_barrel_exp:
destroy the instance
Other Event: Animation End:
if sprite_index is equal to spr_penguin_shoot
execute code:
go=0
set the sprite to spr_penguin_walk with subimage -1 and speed 0.3
set Alarm 0 to choose(15,24,30,37,46)
Draw Event:
execute code:
{
if (point_distance(x,y,global.camx,global.camy) > 240) exit;
var tex;
tex = sprite_get_texture(sprite_index,image_speed);
d3d_draw_wall(x-12*global.camsin,y-12*global.camcos,19,
x+12*global.camsin,y+12*global.camcos,-2,tex,1,1);
}Crouching Problem (not so much a problem, but it's annoying and I'm not sure how to implement it)
if keyboard_check(vk_control) then height=4; else height=15
Penguin NPC Following Problem
if distance_to_object(instance_nearest(x,y,obj_penguin))<24
{
//Code needs work
if (instance_nearest(x,y,obj_penguin))obj_penguin.follow=false
{
with (instance_nearest(x,y,obj_penguin))obj_penguin.follow=true
}
if (instance_nearest(x,y,obj_penguin))obj_penguin.follow=true
{
with (instance_nearest(x,y,obj_penguin))obj_penguin.follow=false
}The penguin NPCs behave according to their variable "follow". As I said above, all penguins react when you try to command just one. They also don't behave normally (their supposed to attack enemies) if you set them back to normal (meaning they don't follow you).Player Z Problems
I just found out while looking through the code that I found a solution, I just haven't done it yet. My bad.
Floor Problem
I think that this is a problem with Game Maker. It's a normal script that works with one floor, but all the other floors are switched with different textures, some of them that don't even really exist. I'm not sure what's wrong.
Achievement Display Problem
if gotachievement=true
{
d3d_set_projection_ortho(0,0,640,480,0);
d3d_set_hidden(false);
d3d_set_lighting(false) ;
draw_sprite(spr_achievement,image_index,x,y);
draw_sprite(spr_ach_killhuman,image_index,14,16);
draw_text_color(x+80,8,"Achievement Unlocked",c_black,c_black,c_black,c_black,1);
draw_text_color(x+80,y+16+string_height("Achievement Unlocked"),string(gs) + "G - " + string(an),c_black,c_black,c_black,c_black,1);
draw_set_halign(fa_center)
draw_set_alpha(0.4);
draw_set_alpha(1);
d3d_set_hidden(true);
d3d_set_lighting(true) ;
alarm[0]=25
}
else
exitVehicle Problem
This one is like the floor problem. Not sure what causes it, but they come out as big red boxes.
Small Exploded Body Problem
Not sure about this one either. I have two different results for an enemy dying, controlled by variables. When an enemy is killed by an explosive, it creates a set of gibs in preset distances around (hoping to change that soon) and the body part is small.
Scrolling Problem
I have a system that allows you to change weapons by scrolling the mouse wheel, but sometimes it jumps around randomly for some reason.
Mouse Event for Mouse Wheel Up:
if global.haveknife is equal to true
create instance of object knife at position (0,0)
set variable chaingunequip to false
else
if global.havegun9 is equal to true
create instance of object gun8 at position (0,0)
set variable chaingunequip to false
else
if global.havegun8 is equal to true
create instance of object gun7 at position (0,0)
set variable chaingunequip to false
else
if global.havegun7 is equal to true
create instance of object gun6 at position (0,0)
set variable chaingunequip to false
else
if global.havegun6 is equal to true
create instance of object gun4 at position (0,0)
set variable chaingunequip to true
if global.havegun5 is equal to true
create instance of object gun3 at position (0,0)
set variable chaingunequip to false
else
if global.havegun4 is equal to true
create instance of object gun5 at position (0,0)
set variable chaingunequip to false
else
if global.havegun3 is equal to true
create instance of object gun1 at position (0,0)
set variable chaingunequip to false
else
if global.havegun2 is equal to true
create instance of object gun2 at position (0,0)
set variable chaingunequip to false
else
exit this event
Mouse Event for Mouse Wheel Down:
if global.havegun2 is equal to true
create instance of object gun2 at position (0,0)
set variable chaingunequip to false
else
if global.havegun3 is equal to true
create instance of object gun1 at position (0,0)
set variable chaingunequip to false
else
if global.havegun4 is equal to true
create instance of object gun5 at position (0,0)
set variable chaingunequip to false
else
if global.havegun5 is equal to true
create instance of object gun3 at position (0,0)
set variable chaingunequip to false
else
if global.havegun6 is equal to true
create instance of object gun4 at position (0,0)
set variable chaingunequip to true
else
if global.havegun7 is equal to true
create instance of object gun6 at position (0,0)
set variable chaingunequip to false
else
if global.havegun8 is equal to true
create instance of object gun7 at position (0,0)
set variable chaingunequip to false
else
if global.havegun9 is equal to true
create instance of object gun8 at position (0,0)
set variable chaingunequip to false
else
if global.haveknife is equal to true
create instance of object knife at position (0,0)
set variable chaingunequip to false
else
exit this event
And that's it. If I can get any help, that would really be great.
#7
Posted 19 September 2012 - 05:17 PM
#8
Posted 19 September 2012 - 09:23 PM
Uh, wrong place for this, but I'll be kind and PM you what little advice I haveI'm aking a first person shooter, and I need advice. I have only made simple games so far, and I want to make something better. if you have any advice, please let me know.
#9
Posted 21 November 2012 - 08:24 PM
#10
Posted 23 November 2012 - 06:34 PM
but from the code i glanced at, you need to get better at writing and structuring your code. big projects really need it. small projects you can screw off and be redundant.
this code for example
if distance_to_object(instance_nearest(x,y,obj_penguin))<24
{
if (instance_nearest(x,y,obj_penguin))obj_penguin.follow=false
{
with (instance_nearest(x,y,obj_penguin))obj_penguin.follow=true
}
if (instance_nearest(x,y,obj_penguin))obj_penguin.follow=true
{
with (instance_nearest(x,y,obj_penguin))obj_penguin.follow=false
}
}can be shortened. all the other code can be shortened and made easier to work with too.
with instance_nearest(x,y,obj_penduin)
{
if distance_to_object(other)<24 follow=!follow
}
#11
Posted 03 December 2012 - 10:57 PM
Oh, and if anyone knows a good, easy to use model making program that would be great to know also.
I can recommend model creater v5. It has served me (and others) very well for GM purposes.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











