Page 3 of 4

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Tue Jan 24, 2012 5:28 pm
by Hblade
Blender 3D :3

Finishing touches:
FINAL 1.png



Complete:
Final 4.png

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Tue Jan 24, 2012 8:15 pm
by Fojam
adding them in right now

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Wed Jan 25, 2012 2:20 am
by Hblade
Thanks xD

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Wed Jan 25, 2012 6:15 pm
by Hblade
awesome :D

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Thu Jan 26, 2012 12:06 am
by Fojam
I updated both the executable and the source. the links are in the first post.

@Hblade i added your stage

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Thu Jan 26, 2012 2:45 am
by Hblade
awesome! :D

Wow! I love the flood effect :D The water :) :) that was awesome. You charge it up and err'thang xD

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Thu Jan 26, 2012 7:25 am
by happyjustbecause
Just want to say I love the animations for this game, this is shaping up to be a pretty cool game. I don't have an iPhone (or any phone at the moment), but I like how this plays. The stages are also nicely made, and there are several other compliments I can make, but you get the idea. :D

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Thu Jan 26, 2012 4:19 pm
by Fojam
Thanks :D

Edit: i have just begun programming the AI. i am using a timer system to do this. its incredibly difficult and i would appreciate if some others with a little more experience in this could help.

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Fri Jan 27, 2012 1:25 am
by Fojam
Heres what I have of the AI code so far. its set on a timer

Code: Select all
Actor*enemy1=getclone2(player1Name, 0);
Actor*self=getclone2(player2Name, 0);
int enemy1x;
int enemy1y;


enemy1x=enemy1->x;
enemy1y=enemy1->y;


if(enemy1x>x)
{
    char stand_right[50];
    playerdir=2;
    if((moveLeft==0)&&(moveRight==0)&&(attacksHolder==-1))
    {
        sprintf(stand_right, "%s_stand_right", player2AnimName);
        ChangeAnimation("Event Actor", stand_right, NO_CHANGE);
    }
}


if(enemy1x<x)
{
    char stand_left[50];
    playerdir=2;
    if((moveLeft==0)&&(moveRight==0)&&(attacksHolder==-1))
    {
        sprintf(stand_left, "%s_stand_left", player2AnimName);
        ChangeAnimation("Event Actor", stand_left, NO_CHANGE);
    }
}


if(abs(enemy1x-x)>=40)
{
    if((enemy1y-y)>40)
    {
        cpu_marioUp();
        switch(playerdir)
        {
            case 1:
            moveLeft=1;
            break;
 
            case 2:
            moveRight=1;
            break;
        }
    }
    if((enemy1y-y)<40)
    {
        switch(playerdir)
        {
            case 1:
            moveLeft=1;
            break;
 
            case 2:
            moveRight=1;
            break;
        }
    }
}

if(abs(enemy1x-x)>40)
{
    if((enemy1y-y)>40)
    {
        cpu_marioUp();
        switch(playerdir)
        {
            case 1:
            moveLeft=1;
            break;
 
            case 2:
            moveRight=1;
            break;
        }
    }
    if((enemy1y-y)<40)
    {
        //attack randomizer
    }
}

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Fri Jan 27, 2012 1:50 am
by skydereign
From your code, I'm assuming you are only taking into account the player and a single enemy. Because of this, you only need to use one Actor*, that is linked to the player. I would also advise, though this might be too late, to have all of your actor's have the same name animations. So if you had a mario and kirby actors, they both have a stand_right, they both have a run_right, and so on. Since all characters have pretty much all the same moves (with different movesets), you shouldn't have to worry about prefixing the name of the actor to the name of the animation. And since you are using sprintf like that, that just goes to show that you shouldn't do it, since the animation names will always be in the same format. Never anywhere do you specify "mario_stand_right" because mario is held in a variable, so just name it "stand_right" and skip the string operations.

Now you are using a lock system, which prevents certain actions via an if statement and variables. This can get very hard to manage very quickly, as you can come up with many many locks. You should really stick to one or two variables that will determine what the actor is going to do next. You are using a lot of if statements to determine if the actor is one direction, then another direction, then if the actor is close. You can use the distance function to determine if the player is within attack range.
Code: Select all
Actor* player = getclone2(player1Name, 0);
if(distance(x,y, player->x, player->y)<40)
{
    // attack the player
    // you can set the direction, and then change the animation to your random attack
}


Every condition you end up using to determine what the enemy should do should be very clear. For instance, the player is within range to attack. The player is about to hit the actor, the actor is about to fall off the edge, and so on. If you can clearly identify what an actor should do given the conditions it is placed in, then all you need to do is write the code. The trick is to actually spell out all of the cases you want the actor to act in. There are a lot of conditions that change what the enemy should do, so I suggest that you use the state method. That way you can identify every possible case, with a convenient switch statement. It may be a lot of code, but most people would agree it will make far more sense than trying to do something similar with just if statements. And the use of the state variable would allow you to change how the enemy reacts given what it is doing.

For example: the player is within hitting range of the actor (this means the player can hit the enemy as well). If you were on the ground, you could either go for an attack, or dodge, but if you were in the air, you would be more likely to attack as your quickest option. And since different characters will react differently depending on their specialties, this will allow you to enumerate the differences.

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Fri Jan 27, 2012 2:36 pm
by Fojam
Hmm i get most of what your saying, but i already have too many places in the code where the mario_ prefix is used, so that would take a whole day to fix. But i see what you are saying about using distance and switch, but how do use switch for > and < conditions?
And whats the best way to keep the computer player from chasing you off the stage when you fall off or to jump over objects in his way?

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Fri Jan 27, 2012 2:47 pm
by schnellboot
Fojam wrote:but i already have too many places in the code where the mario_ prefix is used, so that would take a whole day to fix.

I think it would be worth it

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Fri Jan 27, 2012 6:06 pm
by skydereign
There are two ways to do it, and in this case using if isn't a bad thing... but if you really didn't want to, you can do this.
Code: Select all
int distance(x, y, player.x, player.y); // note I'm not using the Actor* so you'll have to change that
int dir = (player.x>x)-(player.x<x);

switch(dir)
{
    case -1: // player is the the left
    break;

    case 0: // player's x == x
    break;

    case 1:
    break;
}

And so you know, using if for ranges is okay. It's just I would contain them within the if, that way you know exactly what it should be doing when you want it to. Otherwise all if statements, of which there would be a lot, could trigger as the timer event is processed. The switch statement will contain those cases. And do as you wish about the names, removing the mario is cleaner, especially since you were using string operations for it.

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Fri Jan 27, 2012 9:14 pm
by Fojam
ill probably clean up the names later. I have days where i will try to optimize different parts of the code.

and how do i keep him from following your character off of the edge?

Re: Super Smash Bros. for iPhone (WIP) (other help appreciat

PostPosted: Fri Jan 27, 2012 9:34 pm
by Hblade
My guess would be use some sort of distance script and have 2 invisible actors around each edge.