// initialize jwplayer var playerInstance = jwplayer('player');// player dom elements var playerContainerEl = document.querySelector('.player-container');// returns video player position from top of document function getElementOffsetTop(el) { var boundingClientRect = el.getBoundingClientRect(); var bodyEl = document.body; var docEl = document.documentElement; var scrollTop = window.pageYOffset || docEl.scrollTop || bodyEl.scrollTop; var clientTop = docEl.clientTop || bodyEl.clientTop || 0; return Math.round(boundingClientRect.top + scrollTop - clientTop); }// returns the current y scroll position function getScrollTop() { var docEl = document.documentElement; return (window.pageYOffset || docEl.scrollTop) - (docEl.clientTop || 0); }// configure jwplayer instance playerInstance.setup({ autostart: true, playlist: 'https://cdn.jwplayer.com/v2/playlists/mYdavspX', primary: 'html5', setFullscreen: true, width: '100%' });// when jwplayer instance is ready playerInstance.on('ready', function() { var config = playerInstance.getConfig(); var utils = playerInstance.utils; // get height of player element var playerHeight = config.containerHeight; // flag determining whether close has been clicked var closed = true; // CHANGED // flag determing whether player is playing var playing = false; // ADDED // eventhandler for when close button is being pressed document.getElementsByClassName('icon-close')[0].addEventListener('click', () => { closed = true; onScrollViewHandler(); }); playerInstance.on('play', function() { closed = false; playing = true; // ADDED }).on('pause', function () { playing = false; // ADDED }).on('adPlay', function() { closed = false; // ADDED playing = true; // ADDED }).on('adPause', function() { playing = false; // ADDED });// get player element position from top of document var playerOffsetTop = getElementOffsetTop(playerContainerEl);// set player container to match height of actual video element playerContainerEl.style.height = playerHeight + 'px';// below we handle window scroll event without killing performance function onScrollViewHandler() { var minimized = getScrollTop() >= playerOffsetTop;if (closed && minimized) { minimized = false; jwplayer().pause(); playing = false; // ADDED } else if (!minimized && !playing) { closed = true; // ADDED } utils.toggleClass(playerContainerEl, 'player-minimize', minimized); // update the player's size so the controls are adjusted playerInstance.resize(); }// namespace for whether or not we are waiting for setTimeout() to finish var isScrollTimeout = false;// window onscroll event handler window.onscroll = function() { // skip if we're waiting on a scroll update timeout to finish if (isScrollTimeout) return; // flag that a new timeout will begin isScrollTimeout = true; // otherwise, call scroll event view handler onScrollViewHandler(); // set new timeout setTimeout(function() { // reset timeout flag to false (no longer waiting) isScrollTimeout = false; }, 80); };});

The Activision Blog’s series of articles describing the new engine upgrades for Call of Duty: Modern Warfare continues today with a look at the new features brought to the game with the brand new engine. As mentioned back in May, the new engine been in the works for over 5 years and this year’s game is the first to fully use it.

Every weapon has almost a 3D like sound with the weapon interacting with the environment in the game.

“You’re hearing the weapon fire, but you’re also hearing the shell eject from the weapon.” For Modern Warfare, the sound of each individual shell, traveling in 3D space, as it moves through the air, is also audible, “before it actually impacts on the ground, using a physics system for all of this.” The weapons also have a weighty feel to them. Nestle a weapon stock to your chest, and there’s a familiar kick back: “We made sure you felt something akin to a nice thump to the chest.”

Infinity Ward’s Audio Team actually went to a desert with 90 microphones to capture the audio of each weapon in Call of Duty: Modern Warfare. Weapons in Call of Duty: Modern Warfare interact with the surroundings while playing the game. So based upon where you are on the map, there might be different sounds as the noise travels through the terrain of the environment.

“We recorded all of our weapons, out in the desert and all kinds of other locations. We used about 90 different microphones to capture each shot.” Groups of microphones provided different audio functionality, too: “That’s for all kinds of perspectives. Twenty of those are for the player perspective alone. Using all of that detail, we were able to capture different perspectives; those from when you’re at the hip, and those when you’re aiming down sight.”

Weapon sounds also interact with the environment. “This is super important to us, Stephen says; “we couldn’t make the game without the sounds being relevant to the place, whether that’s Piccadilly Circus, the desert, the mountains or wherever.” The team employed a number of new systems to add environmental effects to weapon audio: “The first is reverb and slap delay DSP [digital signal processing] system. The second is an atmospheric layer that is contextual and plays along with every weapon shot. The third is a weapon reflection system.” With the audio existing in 3D space, expect variations in sound depending on how and where you’re listening to each weapon fire.

They have also made improvements to how the audio travels back when it hits the environment with big improvements to ensure that weapons in this game sound like it’s a real weapon being used outside of the game.

Every time you shoot a gun, the sound travels out into the world, and the game knows where the sound will interact with the environments and plays a specific sound at those locations.” All of this is contextual. Whether you’re up next to a building, down in front of a car, or inside a subway tunnel, the reflected sound of each weapon has an appropriate audio effect.

“Having sound behave realistically is super-important to us, so as those sounds go out into the environment and bounce back to us, they do so with authenticity and clarity, at the speed of sound, and as close to how you’d hear it occur in reality. There is natural delay and decay to every weapon noise.The sound gives you a big, deep, booming echo in larger expanses of scenery, while the same weapon becomes slightly more muffled, far less reverberating, and with less echo in more confined environments.”

“We didn’t want to stop there, so we decided to do the same for all our explosions. These are just some of the pieces of the puzzle that we’ve all been trying to put together reimagining what Modern Warfare is to us, grounding you into our whole new world. And giving you a whole lot of fun.”

Call of Duty: Modern Warfare is available on October 25. The studio will reveal a lot of new details on the Multiplayer Mode during an event on August 1. Stay tuned.

SOURCE: Activision

comments below