Page 20 of 33 FirstFirst ... 1016171819202122232430 ... LastLast
Results 191 to 200 of 326

Thread: Game Developers Thread

  1. #191
    Devilish Member Inksprout's Avatar
    Join Date
    Nov 2011
    Posts
    756
    Yeah you need to understand the target market and what they will enjoy, but consumers are relying on you to think of things they will enjoy that they haven't experienced yet. You can't just say the consumers liked the last game so we'll just make something the same. Its the game designers job to think of something new that consumers will like. Its also really hard to think like a consumer once you start learning about how to design and make games anyway. You can't help think about whats behind the gameplay.

  2. #192
    Fenn
    Guest
    I can see that. I'll reconsider and revise my philosophy on the matter a bit.

    Tips on programming enemy AI? I need them to be able to move around a relatively simple map in 2D, avoid obstacles, identify and seek targets, and attack while trying to avoid being attacked.

  3. #193
    Ruler of the Seventh Empire GunZet's Avatar
    Join Date
    Jan 2011
    Location
    Preparing the laser beam, we're gonna use it tonight.
    Posts
    11,880
    If you're using GM, I could help with that. Otherwise I have no idea.

  4. #194
    Fenn
    Guest
    Quote Originally Posted by GunZet View Post
    If you're using GM, I could help with that. Otherwise I have no idea.
    Yep, GML Pro/Normal, or whatever the best version is.

  5. #195
    Ruler of the Seventh Empire GunZet's Avatar
    Join Date
    Jan 2011
    Location
    Preparing the laser beam, we're gonna use it tonight.
    Posts
    11,880
    Alright, well basically what you want to do when it comes to GML, is either put the code directly in the enemies themselves, or make scripts. And use lots of variables...I haven't coded GML for a while now so I'll just take a bit of AI code from my frozen project.

    Create Event
    life=5
    if instance_exists(obj_turret_parent)
    turret=instance_nearest(x,y,obj_turret_parent)
    alarm[0]=choose(20,40,60)
    do_=choose(1,2,3)
    canshoot=true
    canshoot2=false
    alph=0
    on_fire=0


    Step Event
    direction=image_angle
    if life<1 instance_destroy()
    //do:1=target the base only do:2=target turrets do:3=go away
    if instance_exists(obj_turret_parent)
    {
    turret=instance_nearest(x,y,obj_turret_parent)
    point=instance_nearest(x,y,object19)
    if do_=3
    {
    scr_grad_turn(point,2)
    }

    if do_=2
    {
    scr_grad_turn(turret,5)
    if canshoot=true and distance_to_object(turret)<350
    {
    canshoot=false
    canshoot2=true
    alarm[2]=15
    bul=instance_create(x+lengthdir_x(20,image_angle),y+lengthdir_y(20,image_angle),obj_enemy_bullet)
    bul.move1=turret.x
    bul.move2=turret.y
    bul.direction=random(10)+image_angle-5
    if canshoot2=true and distance_to_object(turret)<350
    {
    canshoot2=false
    alarm[1]=15
    bul=instance_create(x+lengthdir_x(20,image_angle),y+lengthdir_y(20,image_angle),obj_enemy_bullet2)
    bul.move1=turret.x
    bul.move2=turret.y
    bul.direction=random(10)+image_angle-5}}}

    if do_=1
    {
    scr_grad_turn(object8,5)
    if canshoot=true and distance_to_object(object8)<350
    {
    canshoot=false
    canshoot2=true
    alarm[2]=15
    bul=instance_create(x+lengthdir_x(20,image_angle),y+lengthdir_y(20,image_angle),obj_enemy_bullet)
    bul.move1=turret.x
    bul.move2=turret.y
    bul.direction=random(10)+image_angle-5
    if canshoot2=true and distance_to_object(turret)<350
    {
    canshoot2=false
    alarm[1]=15
    bul=instance_create(x+lengthdir_x(20,image_angle),y+lengthdir_y(20,image_angle),obj_enemy_bullet2)
    bul.move1=turret.x
    bul.move2=turret.y
    bul.direction=random(10)+image_angle-5}}}
    }


    Same Step Event
    if do_=1 and speed>1
    speed-=.2
    if do_=1 and speed<1
    speed+=.2

    if instance_exists(obj_turret_parent)
    {
    if do_=2 and speed>2 and distance_to_object(turret)>120
    speed-=.2
    if do_=2 and speed<2 and distance_to_object(turret)>120
    speed+=.2
    //this code causes the enemy to fly away when too close
    if do_=2 and distance_to_object(turret)<90
    do_=3
    }

    if do_=3 and speed>8
    speed-=.2
    if do_=3 and speed<8
    speed+=.2

    if alph>0
    alph-=.2
    if alph<0 alph=0

    if on_fire=1
    {
    if life<=0 instance_destroy()
    scr_particle_fire3()
    life-=.5
    }


    Alarm0 Event
    do_=choose(1,2,3)
    alarm[0]=choose(40,60,80)


    Basically, it gives the illusion of AI. Ugh, you know what. I'll just try my hand at coding a simple example for you, lol. And Pro is always what you should work with.

  6. #196
    Fenn
    Guest
    This was helpful, that was a very clear code. The only difficulty that remains is giving it some illusion or semblance of smarticles. You covered some of that in your code.

    It's really just object avoidance I'm stuck on. Like: you have a square between you and your target. Do you turn right or left to get around it faster? When/Where do you start turning? How close do you get to the object before turning? What if another object gets in the way?

    I'm not expecting to find a simple solution to this. At the moment I'm just gonna aim for reliable avoidance, even if it isn't efficient.

  7. #197
    Ruler of the Seventh Empire GunZet's Avatar
    Join Date
    Jan 2011
    Location
    Preparing the laser beam, we're gonna use it tonight.
    Posts
    11,880
    Basically what you wanna do, is give your enemies a set of actions it can take based on the conditions.
    For example:
    Too close to shoot an explosive weapon without damage? Try to run to nearest cover to shoot, or let's say it knows the killing range, so it only backs up a little bit, then shoots.
    Or maybe it's almost dead anyway, so it goes into a suicidal mode and shoots anyways, killing itself and probably you with it. Etc. etc. It's much easier for when you're making a TDS, but thinking of AI like this usually works better than using a grid method and data stacks. It's easier for you to control.

    Only thing that takes a while is coding each of those actions separately.
    Last edited by GunZet; 11-22-2011 at 02:46 PM.

  8. #198
    Fenn
    Guest
    Quote Originally Posted by GunZet View Post
    Basically what you wanna do, is give your enemies a set of actions it can take based on the conditions.
    For example:
    Too close to shoot an explosive weapon without damage? Try to run to nearest cover to shoot, or let's say it knows the killing range, so it only backs up a little bit, then shoots.
    Or maybe it's almost dead anyway, so it goes into a suicidal mode and shoots anyways, killing itself and probably you with it. Etc. etc. It's much easier for when you're making a TDS, but thinking of AI like this usually works better than using a grid method and data stacks. It's easier for you to control.

    Only thing that takes a while is coding each of those actions separately.
    I am making a TDS, what luck! So I set variables, and check them, and depending on the result change the actions of the AI?

  9. #199
    Does anyone now how to work with the Program Blender?

  10. #200
    Lord of Death jubeh's Avatar
    Join Date
    Dec 2010
    Location
    Space
    Posts
    12,707
    Yeah bro just put all those programs in there and put the lid on so they dont splash on you

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •