Stencyl 3.4.0 is now out. Get it now!

Hopping Dueling Game Prototype

merrak

  • *
  • Posts: 1632
I felt like taking a break from larger projects and playing around with a few concepts and ideas I had. One was a sort of duel/fight game--similar to the Balloon Fight games.

It's a simple game--try to jump on all the enemies. But they'll try to jump on you!

I'm mostly interested in seeing how cruel and cunning I can make the AI. I'm using two extensions: Artificial Intelligence Tools and Physics Tools

The AI is fairly simple right now. The balls hop around at random, until you get too close. Then they'll try to jump on your head. Given some more time, I think I can get them to work together as a team :P

I uploaded a small demo. 8)

<a href="http://static.stencyl.com/games/33712-0.swf" target="_blank" class="new_win">http://static.stencyl.com/games/33712-0.swf</a>

tigerteeth

  • Posts: 734
"I've... I've seen things, man...."

tigerteeth

  • Posts: 734
But seriously, fun game. I did all three levels.  I'm curious about how complicated AI is, expecially as it requires an extension. How different is it from:

If distance between self and Player is less than (x)
After (Equation here) seconds
Push self towards (Equation here) with force (Equation here)

If you did that and got the equations right, and had a few random integers to make things interesting, would that be the same?

Nikkita31

  • Posts: 129
Yo Merrak.

This is really awesome! I hope you can create more interesting AI extensions in the future ... and tutorials as well. @ , @

regards,
Renegadegames

merrak

  • *
  • Posts: 1632
"I've... I've seen things, man...."

Now... can you beat all three levels without losing any lives at all  8)

The AI on the black balls isn't very complex. They're opportunists. Once you get within a range (about eight tiles), they'll  attempt a jump.

Once I have another chance to work on this, I'll add a "hunter" ball that will find a path to the player. This is where the fun begins  8) The AI extension provides what is basically a map of the level, and the ability to look for paths (A* pathfinding). If I add two "hunter balls", they can mark the paths they find and make sure they don't copy each other's route. Basically, they talk to each other... and will attempt to flank the player.

Another tactic may be to crowd one side of the player, and drive the player to the opportunistic black balls that are waiting to pounce. I haven't quite decided what all to throw in--just interested in experimenting with what's possible.

AI tutorials (or some tutorials in general) would be fun to do. It's an interesting and very deep topic. Unfortunately, these qualities mean it's hard to make something like an extension. AI is very specific to your game. I'm having a hard time imagining what an extension would consist of, other than very general tools (like A*)

merrak

  • *
  • Posts: 1632
I added levels 4 and 5, which introduce the "hunter" red ball. It seems to work pretty well. If you go to Level 4 and just sit and wait for them, they do hunt you down. However, they seem to be pretty easy to defeat... probably because their moves are predictable.

Level 5 mixes black balls and red balls, and that seems to be a lot harder. The black balls are less predictable. I also haven't gotten the red balls to talk to each other yet, so they could take the same path.

I left the graph display in, which reveals how the red balls "think". The red balls look for the best path to the node closest to the player. Getting the red balls to talk to each other will just be a matter of adjusting the costs of the edges in the graph. By raising the costs of the edges the first red ball takes, the second red ball will be encouraged to look for another route. This ought to encourage them to attack from different directions.

ceosol

  • *
  • Posts: 2146
This is pretty awesome. Although I think part of the difficulty stems from the balls having pixel perfect controls (they can move to the exact spot that they want to move to). The player is relying on the platformer mechanics that can almost never give you pixel-perfect jumps/motions/positions.

The Dead6hot AI was constrained in the same ways a player was. When the computer wanted to stop jumping, it still had to wait 0.5 seconds to regain motion control. It also has multiple "personalities" where sometimes it runs away instead of being aggressive.

SadiQ

  • Posts: 1738
The easiness in level 4 comes mostly from the design of the level. I never played this game, started at level 4 and beat it in 2 tries. The rest of those levels are too much for me thou.
I personally would have preferred a smaller jump height and maybe the ability to double jump.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

merrak

  • *
  • Posts: 1632
This is pretty awesome. Although I think part of the difficulty stems from the balls having pixel perfect controls (they can move to the exact spot that they want to move to). The player is relying on the platformer mechanics that can almost never give you pixel-perfect jumps/motions/positions.

The Dead6hot AI was constrained in the same ways a player was. When the computer wanted to stop jumping, it still had to wait 0.5 seconds to regain motion control. It also has multiple "personalities" where sometimes it runs away instead of being aggressive.

So far the AI has the same constraints as the player (e.g. both can only jump when standing on the ground), but the player's controls are pretty simple. The multiple personalities aspect sounds really interesting. My current focus is just getting the AI to maneuver through the level correctly. The balls still do some things they shouldn't--such as jump into the ceiling.

The easiness in level 4 comes mostly from the design of the level. I never played this game, started at level 4 and beat it in 2 tries. The rest of those levels are too much for me thou.
I personally would have preferred a smaller jump height and maybe the ability to double jump.

I put a double jump feature into my own working version (not the playable demo that I posted here). It seems to make the game a little easier, and is starting to remind me of a sort of Flash version of Smash Bros. Maybe I should open up the edges and let the balls be knocked off the stage.

ceosol

  • *
  • Posts: 2146
So far the AI has the same constraints as the player (e.g. both can only jump when standing on the ground), but the player's controls are pretty simple. The multiple personalities aspect sounds really interesting. My current focus is just getting the AI to maneuver through the level correctly. The balls still do some things they shouldn't--such as jump into the ceiling.

Yeah, jumping with tiles is tough on AI. The computer reads the x,y of tile "actors" as the top left corner of the left-top-most tile of a cluster. So detecting a ledge that the actor cannot jump under, you have to orient the detection to the left-most tile (counting all tiles touching as one actor instead of individual tiles). If you have seen or played Dead6hot, I took out ledge jumps from the boards with AI because I didn't feel like dealing with all of the possible scenarios. :)

merrak

  • *
  • Posts: 1632
I think I have ledge detection worked out pretty well--it's just handling the jumps themselves that is tricky. In the scene designer, I manually flag which ledges can be reached from others.

The routine that executes a jump first computes the velocity and angle needed to reach a desired position, then uses the arc raycast (in the physics extension) to check for collision with a tile. This check only looks for collisions along a path of width 1px, so I think the boundary boxes were clipping the tiles. Adding a margin of error seems to have helped.

Another issue is the player moves very fast. A smarter AI should compute where the player might be in the seconds that follow.

I'm thinking of giving both the player and opponents the ability to do evasive maneuvers. This could potentially make the game very hard--but I can also put in some attribute that controls how often the AI makes a mistake.

ceosol

  • *
  • Posts: 2146
Great solution to those two problems. I think adding in the "mistake" would create a much more realistic AI.

merrak

  • *
  • Posts: 1632
I added new opponents, new player abilities, and a few new levels!

White balls are "dumb", and just bounce randomly.
Orange balls are smarter than red balls. They hunt, and also have the ability to dodge. They can only dodge by rolling away.
Yellow balls are the smartest. They can change direction in mid-air, just like the player can.

The balls now have limited collective intelligence. They'll communicate and work out a very basic strategy to get the player (YOU!). It's not yet very sophisticated.

You also now have the ability to duck + slide. Hold DOWN to duck, and DOWN+DIR to slide to safety. You can also double-jump.

Level progression is now automatic. Once you clear a level, you'll move to the next one. You can still start at any level you wish (1-9), but you can only warp to a new level by restarting (press R).

« Last Edit: March 20, 2016, 09:47:56 pm by merrak »

tigerteeth

  • Posts: 734
Smash bros is one of my favourite ever games. Making something like that in stencyl would be amazing.

merrak

  • *
  • Posts: 1632
Smash bros is one of my favourite ever games. Making something like that in stencyl would be amazing.

It's probably doable. I found a web version of Smash Bros. online.

I think I've gotten about as far with this game as I'm going to get for a while. It's been fun to work on, but I have some free time and I want to take advantage of it to play around with some more prototypes and new ideas.

This is now a complete, working "shell" for a game. I can always come back to this and make it a real game--maybe the next time a Stencyl jam comes around.