Blog : 2D Engine in the Making (Part III)

In his final EHM 2D blog, Risto Remes discusses how he tackled the challenge of making the 2D engine look realistic.

Risto Remes

So, now we had two teams playing simple hockey games, pokechecking, passing, skating and shooting. It was time to link some real player data into the engine to see how things would turn out. The 2D engine was designed right from the start to work as a stand-alone part of the game, both for the ease of debugging, but also for other practical reasons. Now we needed to link the new 2D engine with the main game database, in order to test the AI with real life players and their skills. After the linkup was done, the first ever game with real player data was played out between Rangers and Calgary. The first goal was scored by Steve Rucchin (note that the database used had the current rosters back then), not a pretty goal but still the first ever 2D goal scored in the engine with real player data. Calgary won the game 3-1 in the end though. At the same time as real data was linked to the engine, the engine was linked to the screens in the main game so games could be played out in 2D from within the game. Identifying players by the way they moved in 2D became a hobby for me for some time and it was nice to see the small but speedy Petr Prucha bounce around the rink, getting bumped off the puck every once in a while, only to relentlessly chase up again. Now we were in business.

Once the 2D was linked to the main game so that any game could be simulated in full 2D, we naturally needed to work on the system to store the 2D games within the saved game and offer the user the chance to review the games later on with the 2D view. The new system stores the information from the simulated 2D games along with the basic statistics of each game and this will allow the user to go back to review the highlights of the games by clicking on goals or penalties to see a 2D replay of what happened there. Also, the play-by-play commentary is stored and when reviewing the game, the play-by-play list is hyperlinked so you can go and see a short 2D replay of any action related to the commentary in the game recap. Developing this side of the 2D was the most technical time with not much hockey specific issues involved at all, but next up was the never-ending process of adding the little details, tweaking and tuning, testing and re-tuning. And that’s where the real fun begins….

Replays are born

The real fun with the 2D development comes from the small details you can either code right in, or things that can happen without you specifically coding that way, just because of the nature of the engine. Because the engine is based on purely physically modeling the puck and the players moving about freely and not on any pre-determined paths or bounces, it means anything can happen inside the rink. And when anything can happen, it usually means anything will happen. And that’s when you need to just test and test and re-test, to catch all those things that can happen and make sure the engine can handle those situations. Because if it can happen, it will…sooner or later. For example, right after the AI code for pulling the goalie for an extra attacker during a delayed penalty was coded in, something that can happen in real life, took place in the 2D. A team pulled their goalie and kept possession in the offensive zone as the other team was called for a delayed penalty. A forward sent a tricky pass back to the blueline across the ice from the corner, where the unfortunate defenseman had the puck roll over his stick and head back towards their own end. So the pass naturally just had to be aimed at the right angle and s the puck headed straight for the gaping empty net…and in. Or how about a player going in on a breakaway only to be hooked from behind, losing control of the puck right at the last minute, turning around and smacking the guy who hooked him, straight in the face as retaliation ? Should the ref give a penalty shot, 2 mins for both, or what ? Or when some sneaky player agitated another into a fight, but jumped back to his bench right when the other guy dropped his gloves. Or when two guys tried to get a piece of the same guy in a fight. These are just a few of the weird things that did happen during the development and had to be handled by the engine along the way. Oh, and around this time, we also started to improve the looks of the 2D as well and got some proper rink graphics in.

New rink graphic

Some personal favourites when it comes to some interesting plays going on in the 2D include a shot from the blueline that hit a screening forward in the head, taking a deflection and going in, but the forward who got credited with the goal also injured himself when that puck hit him. Or the one play off the offensive zone faceoff, when the puck was played back to the blueline, the defenseman took a shot which went over the net, hit the plexi glass, bounced back towards the top of the net and yes, while the goalie was trying to see where it had gone, hit him in the back of his arm and trickled in. And for those who love to see some of the players doing a little dance and getting some haymakers in, it will be much more fun this time around as you can actually see the guys chase each other, circle around and come together to exchange some constructive criticism of each other. Not to mention if a brawl should break out, when players all over the ice are pairing up and the goalies start heading for each other. Oh, and something not so rare, but fun to witness every time I’ve seen it happen, a penaltykiller blocking a shot from the blueline, racing past the defenseman to catch the puck and going in all alone to score a beauty of a shorthanded goal. Remember to have some wheels on the PK just in case an opportunity like this raises its head…

Look 1

Look 2

Look 3

Look 4

This has been only a quick look into the development of the 2D engine. Tons of blood, sweat and tears have gone into the making of it, and there is still a lot of work to do for the future, to fine tune things and add more little details that will make the plays even more alive. The best way to get a good feel about the 2D engine, will be to download the demo come release time and have a look around yourself. Just remember to keep your voice down if you’re in a crowded office when that tick-tack-toe passing move ends up with a one-time slapshot ringing in off-the far post ;)

Talk about this in the forums

Added by Marc Duffy on 09/20/2006 10:52

Read the latest forum posts