Monthly Archives: October 2018

Wireless USB AC D-Link It Runs in the 2.4 GHz and 5GHz

Jakarta – To facilitate a wireless connection with your device, the D-Link introduces the Wireless Dual Band Mini USB AC Adapter DWA-171. It is shaped AC adapter Wireless mini and can operate Dual Band. The device is intended for the novice user can operate at a frequency of 2.4 GHz (up to 150Mbps) or 5GHz (up to 433Mbps). With these two options, you can freely switch device that works on both the frequency.

Seagate claims the use of these products is as easy as installing the device in your PC and press the WPS button. Then the device can be directly connected without the need for updates and additional adapter. D-Link DWA-171 uses AC frequency which is a new network of IEEE standards. This new network architecture has a higher data rate and greater reliability.

This new standard was launched to address the challenges of our time, with more and more users use mobile devices that in fact definitely use the wireless wave. Therefore, the problem of wave interference, become an increasingly important issue. Therefore, more and more wireless devices are running on the same wavelength, the greater interferensinya. This interference makes the response rate (response rate) the lower the device. In addition, a variety of applications used also requested greater bandwidth. It would require a device that can deliver greater the bandwidth.

Adapter with USB 2.0 interface is also compatible with all Wireless N products from the previous generation, you’ve had. DWA-171 Wireless USB Adapter ACDual Band Mini will be available in stores and distribution partners in the third quarter of 2013. This device also supports encryption WEP/WPA/WPA2.

Electronics Gadgets For Idiots Four G Technology

For somebody who’s a techie, 4G is something you ought to already be familiar with. However, if you’re not one of those who’s fond of electronic gadgets, you should know that there’s more to 4G than meets the eye.

4G is commonly referred to as beyond 3G, a fourth generation wireless technology equipped with a more comprehensive and secured Internet Protocol. It is well-known to provide users with higher speed and better quality anytime, anywhere. It’s packed with better features compared to its predecessors.

Contrary to what others may suppose, 4G is not limited to mobile phones alone but also in computers. If you’re someone who’s fond of watching videos online, you’ll find that 4G provides high definition videos regardless of your whereabouts. You can surf the World Wide Web faster using any web-enabled devices you have by connecting them to the 4G modem. You can chat with your friends faster, hear their voices clearer and monitor their cams with no pauses and disruptions. You can also share pictures and videos without too much hassle. In case you’re going out, you can still use your mobile to surf the net with 4G mobile technology.

So why is 4G highly regarded than 3G or other types of mobile phone network? We are living in a high-tech world where additional technological innovations are discovered almost everyday. 4G happens to be one of the most advanced and recent mobile phone networks in today’s age. It is the network of choice by many since it is very accessible. It also has a very high data rate amounting to 100 Mbps and a very extensive bandwidth capacity which added networks fail to provide.

There are pitfalls though. The main one is that as a cutting edge technology there is likely to be very few places that actually have a 4G network in position.

Chances are it is used first in highly urbanized areas before it spreads out to rural areas. To remedy this problem, various companies set 4G hotspot areas where users can go to and use it free of charge. In some cases, there are computers which aren’t applicable with 4G since it’s engineered for Windows.

Today, almost all kinds of cell phones are suitable for 4G. Nevertheless, many techies believe that smart phones are the best because of their quality digital cameras. Others use T-mobile and iPhones which are likewise 4G compatible devices. Another concern will be the price. You can have these gadgets with or without 4G contract. A device with a 4G contract is cheaper with price starting at 199 to 299 US Dollars while those without a contract can cost you 599 to 699 US Dollars.

Switching to 4G is a good option you can make especially if you’re someone who’s into the latest technological craze and doesn’t want to be left behind. With so many features it offers, 4G is certain to change the way you look at technology.

Renting a House for Students

If you are a student who goes for learning abroad, then the primary things that you will need to concern for yourself is finding houses for rent. Your living accommodations will make a big impact on your education, and you need to make sure that you take the time to find the best housing for your needs.

If you’re fortunate enough to live at home with your parents during your education, that’s great. However, for those who are striking out on their own, choosing a rental house is going to be important. You can find your options in many different ways, depending on what you want and need.

Some people search for house on rent by first searching for flat mates. If you can’t afford to pay the full price for a rental, it’s often easier to find other people seeking mates or a house to live in. In this case, you can often pair up or find a couple of flat mates and then go forward to find a house together.

Many students stay at university and college hostels during their first year. This is a great way to first familiarize yourself with the education facility you are studying at. It also makes new friends whom you can group together with to find a rental house during your second and subsequent years.

After all, it’s much easier to know what you can afford when you have your flat mates already picked out. Alternatively, you can also find a house that you can live in that is already occupied by people looking for another flat mate.

If you’re searching for a house of your own or houses to rent with others, you will need to make sure that you consider a few things besides the cost of the home. What you can afford is very important; but it is not the only deciding factor. You should also consider the location to your education facility, nearby public transport if you don’t have your own vehicle.

Some houses will rent by the week or month while others will want to let them for a year at a time. Additionally, it is a good idea to draft a budget before you commit to a particular place. Also think about how much money you will need for food each week. This financial exercise will give you a good estimate of what you can afford. You should also consider the other expenses so that you can estimate your expenditures beforehand.

About author: The Author Sumit Gurg is a prominent real estate guru and offers guidance to people looking for house on rent as well as writes for a variety of real estate magazine and publications.

Thinking About A Profession In Video Game Testing

Game Tester job openings are abundant currently, because the fact that gaming market is thriving. Testers are necessary to perfect the video games that are being produced by each video game company. The good thing is this offers you an opportunity to try out a career inside gaming, the dream job for lots of individuals.

The main obligation of a game tester is usually to document any discrepancies within the particular video game; glitches, bugs, crashing… Etc. Though a number of defects are generally easy to find, a few require a good analytic eye. For this reason, testers have to have adequate practical knowledge in computing. Large games possess more testers, so each individual tester should check to see if a glitch has already been previously documented. Regression testing will be when a tester confirms that, once some sort of bug has been announced fixed, it doesn’t come back.

Do you have to be an experienced game player to be a tester? No. You should be competent to handle challenging video games, but the wide-ranging mentality associated with amateur and beginning gamers is actually valuable when testing. Both skilled and unskilled gamers have got benefits in this industry.

Video game testing has served to coin the particular phrase, ‘burn out’. This really is whenever gamers grow to be too sick of actively playing games to carry on. Believe it or not, such a thing happens. The reason being that though it consists of playing games video game testing is still a job which involves work along with energy.

The game industry, like any other, is a series of company ladders. Game testing will be the first rung. That is not to imply that testing isn’t a proper job simply that lots of people have the aspirations of moving over and above this specific step. The best periods to watch out for a video game tester jobs is actually late summer time or autumn whenever the actual companies are rushing to get video games out.

Pay for this kind of work is not incredibly excessive. Pay on an hourly basis is normally around $10-$13 an hour. A survey stated that the actual average yearly earnings came up to $39,063. Naturally the further you go with this particular work, the more likely you will be better paid. Experienced testers might make upwards to $70,000 a year. From time to time bonuses are offered for each bug found by a tester.

Game testing is an extremely specialized career choice and in very high demand. Because of this if you stick to it, there exists a excellent likelihood you will go far within this field. Game testing job opportunities do not usually require a college diploma but demand a good analytic as well as thoughtful eye.

Spanish Professor Wins Third Graduate XXI Education Contest

Jorge Gallardo won the prize for his proposal to reintegrate young victims of violence into society.

Madrid, Spain, May 30, 2013 – Jorge Gallardo won the prize for his proposal to reintegrate young victims of violence into society.

Spanish university professor Jorge Gallardo was the outright winner of the third GRADUATE XXI contest, an Inter-American Development Bank (BID) initiative designed to prevent children dropping out of school in Latin America. Gallardo, who has a doctorate in Communication Sciences and is a professor at the Camilo Jos Cela University (UCJC) in Madrid, won the award for his proposal for socially reintegrating young people who have suffered from violence.

His project, entitled -Good memories mark the start of a new path-, won the majority of users’ votes on the programme’s website. -My idea involves expressing negative and positive memories, and posting the positive ones on a blog where they can be shared with other education centres all over the world, because this is the wonderful thing about the Internet and its global reach-, said Gallardo.

The international body said that, although access to education in Latin America has improved considerably over recent years, almost half of all Latin American students do not finish secondary school. Gador Manzano, head of the GRADUATE XXI project, said that initiatives such as this one -give all sectors of society a voice and the chance to actively participate in efforts to combat the school dropout problem and make a good-quality education possible for all-.

The objective of GRADUATE XXI is to involve Latin American citizens in improving the educational system and to increase the numbers completing secondary school education in the region.

Press Contact: Marca Espana Media Relations Marca Espana Serrano Galvache, 26 28033 Madrid, Espana. 512-212-1139

International Travelers See New Look At Atlantas Airport

International travelers flying into and out of Atlantas Hartsfield-Jackson International Airport will now see a brand new look. The Maynard H. Jackson International Terminal, which opened in May 2012, puts a new face on international travel at the worlds busiest airport. The new facility will help meet the demands of increased oversees travel in the coming decades.
The first thing passengers flying out of Atlanta will notice is the new entrance to the airport. Passengers will access the new international terminal from the east side of the airport, off I-75 at Exit 239. The main terminal, which now handles only domestic flights, is still accessed from the original airport entrance off I-85. The international terminal has its own parking on that side of the airport. A free 24 hour shuttle will provide transportation between the two terminals.

Eight airlines will operate international flights out of the new facility. Those airlines are Air Canada, Air France, AirTran/Southwest, British Airways, Delta, KLM Royal Dutch, Korean Air, and Lufthansa. Atlantas airport now has 40 international gates, 12 in the new Concourse F and 28 in the existing Concourse E. Passengers are now able to fly to nearly 80 destinations in 50 countries. Following the completion of their merger, AirTran/Southwest is expected to add new routes to the Caribbean and Mexico. Other airlines are expected to add additional routes to Asia and South America.

The new terminal has an attractive design, with a sweeping roofline and soaring glass windows. The facility is LEED-certified. Passengers will notice several spectacular pieces of art, as the city requires that 1% of capital construction costs be dedicated to public art. Travelers will have a variety of dining options in the new international terminal. Choices will include sit down restaurants, a tapas bar, a gourmet market, quick food options, bars, and a Starbucks. Retail shopping outlets will include Clutch, Brookstone, The Body Shop, Touch Table, Simply Books, and Tommy Hilfiger. Business services, personal services, and Wi-Fi are also available.

There are separate security checkpoints for arriving and departing passengers. Atlanta bound travelers who are returning home will find they are no longer required to re-check their bags after clearing customs and immigration. They will be able to keep their bags and exit the airport.
Some ground transportation options, including taxis, will be available at the new terminal. A shuttle will take travelers to the rental car center. Hotel and offsite parking shuttles will pick up and drop off at the international terminal. Travelers taking the MARTA transportation will need to take the shuttle to the main terminal.

How Venetian Blinds Can Control The Light Coming Into A Room

Venetian blinds not only look great, but they help to control the light and ambiance of a room as well. In fact, no other kind of window blinds can compare with their ability to either let in light or block it out. For example, curtains can be blown around during windy weather which creates plenty of moments where light is unwelcomed but let in anyway. These types of blinds can be used in any room from the kitchen and bathroom, to the bedroom and family room.

Youll find them in a number of different colours, and some even have their own slightly unique style compared to others on the market. The way venetian blinds work to help control the light in each room is by manually turning the blinds to a particular spot that helps direct the sun light where you want it to go. For instance if you want to keep the light totally out of the room you will want to direct the blinds all the way upward so that the light simply rests on the blinds or on the wall above the blinds.

During the morning its always nice to direct the blinds slightly down so that the sunshine can be enjoyed without it blaring in and creating squinty eyes during breakfast. You will find that slightly changing the position of your blinds can create an entirely different kind of lighting in the room. Its kind of like owning one of those dimmer lights that adjust to your preference.

When choosing your venetian blinds you will want to keep a few things in mind. The first is the colour. Blinds come in a variety of colours and tints such as light and dark woods, white, and even black. The colour you choose can impact the affects of your lighting so keep that in mind before choosing what option is going to be best for your home overall.

Size is another consideration as there is nothing worse than ending up with blinds that barely fit your windows. This creates room for light to shine through the sides of the blinds which can get pretty frustrating once in awhile. If anything, make sure the blinds are slightly bigger than your windows to make sure that you get maximum coverage.

Another thing that should be thought about is quality. While youll find lots of great deals out there, they arent really deals at all if the blinds fall apart in a matter of a few short months. If you shop in person test the blinds out yourself to see how they perform for you. If you are shopping online consider reading consumer reviews in order to make sure you know what to expect when investing in a specific set of venetian blinds. This can help you to avoid some costly mistakes.

Axioo Neon BNE, Notebook Starter with Tempting Spec

Toshiba name may not be as famous as Hewlett-Packard (HP), Dell, Asus, or other branded PC vendors. But for business aggressiveness, this local brand PC vendors do not want to lose. Especially in the beginner class notebook segment.

One product is the hero Axioo Neon BNE with D423N series that hypnotize prospective buyers through the oblique and speksifikasi price that is not less slick.

Perception of most people is, affordable notebooks have not considered ‘offal’ special. But sometimes many are forgotten, if not all notebook users requiring a high specification and prefer products that match the contents of the notebook bag.

Moreover, even the entry-level segment has the largest share of the notebook product than fill up flagship high-end class, because it is dominated by high school students to college students.

Try their luck in the entry level segment, to bring that Axioo Neon BNE carrying D423N series and cost Rp 3 million.

But even so, the material used and the results are neat finishing successfully make the product look quite elegant.

Although the present with a fairly cheap price, only Rp 3 million, it did not make D423N BNE Neon comes with a quality pickup. Toshiba presents the product in his cultivated elegance through material with a unique texture.

Interestingly, the unique texture that is present in the form of vertical strokes in a timber like the successful combined by Toshiba with matte dark brown color, making it look elegant Neon BNE D423N and by itself to eliminate the impression that the entry level is identical to the cap ‘the cheap’.

One of the unique features possessed Neon BNE D423N which may rarely found on other products is the battery circuit breaker. Using these buttons the user can easily decide that the charge may remain there even when the notebook is off.

Surely the presence of the button on the bottom of the notebook, battery life is embedded in Neon BNE D423N expected to be more durable.

Given the manifold unibodi Diusungnya body so it does not allow the user to replace the battery or other hardware upgrade without jailbreak it first.

In order to provide competent performance, Toshiba pinned fairly decent specs for the price offered.

Armed by a dual core AMD E1-1200 1.4 GHz clock speed combined with the Radeon HD 7310 graphics processor, ensuring Neon D423N BNE will present satisfactory performance.

The combination is supported by the use of 2 GB of DDR3 RAM. While in the storage sector, Neon BNE D423N had pinned a HDD with a capacity of 320 GB.

Toshiba is also not immune to pin a drive type DVD-RW, HDMI connector, and a webcam on a notebook that carries the 14-inch screen size.

The following specifications D423N Axioo Neon BNE:

– Processor AMD E1-1200 1.4 GHz
– 2 GB DDR3 RAM
– Radeon HD 7310 Graphics
– HDD 320 GB
– 14 inch wide screen
– Connection LAN, WiFi, and Bluetooth
– HD Audio
– HDMI connector
– Webcam, Card Reader, and USB slot x3

Types Of French Home Accessories

What makes your rooms attractive are not the materials used in making the house. There are small things that you can do to achieve big effects. You cannot change the building construction to get such effect. It will cost you a lot. The right yet money saving option for you to renovate your interior look are to use the French home accessories.

Home accessories from France especially serve the interior decoration purposes with their shapes, designs and colors. They can enable you to transform your home into something special. There are good French country style designs that will bring French touch in your room. All these accessories are well crafted and designed from day to day living experience and craving for beautification.

The boxes and storage equipments are good French home accessories. You can get metal or wooden boxes. Whichever type you select, the storage boxes will work out the miracle in your kitchen. The decorative metal boxes are exceptional items to keep in your kitchen. They offer luxury and aristocracy. You must not miss them, as they are durable and affordable. The design, shape and color of these storage boxes are fine. You can even place them on your dressing table. They will add glamour to your kitchen.
The French candleholders are yet another example of best home decorating accessory. These are unlike regular candleholders. The holders form a lot of symbolism and style for the house. Choose good colors and designs that will match the rest of the accessories in the house. Most of them are made of metal with very attractive features that will bring the French mood inside your living room. In fact, this particular French accessory can become the ultimate illuminating equipment if there was no electricity. Moving on, you will also find good candle rinds and snuffers.
Clocks also form a fundamental part of our homes. They are the ultimate decorative accessories you need to have in your rooms. Not only do they serve the purpose of telling you the time, but they also add glamour and improve the ambience. The French clock designs are very attractive. It is ideal for any family. The retro styles and color of the clock will match with anything you include in the house. You can also opt for equally gorgeous mantle clocks. They can make a French statement in any room you put them.

The list of French home accessories is not complete without enamel wall plaques. No matter where you put them, they will look unique and appealing.

You do not need to be in France to have that great French touch. All you need to do is to go for these home accessories and you will achieve it. You can change your home and make it more valuable using the French home accessories.

Creating a 3D Game With Three.js and WebGL

Prerequisites

  • A browser with WebGL – this game has been tested on Chrome and Firefox. IE still doesn’t support WebGL, unless you’re using Windows 8.1 with IE11.
  • Three.js library available for download from the Three.js website
  • The Keyboard.js helper library I used for this project, created by Arthur Schreiber at No Karma. Download it from my GitHub repository
  • A basic understanding of what Three.js does. Read this super simple, super quick tutorial by Paul Lewis. It’s basically a short-hand version of this article.

Setup

Get a base index.html running

Step one when making a web-based game is to create the host index.html file. In our case, it only needs to be a very simple set of elements, so we can bundle the CSS styling too.

Import Keyboard.js and Three.js

Three.js is a library contained in just one JavaScript file, so we can grab the minified version from the website.

For Keyboard input, we will need to referencethe aforementioned JavaScript file in our index.html as well.

Create setup() and draw() functions

The setup() function will be the start point for the game code. The draw() function will be run every frame and will handle all the rendering and game logic.

In order to loop the draw() function, we simply utilise the requestAnimationFrame() function call, and pass ‘draw’ as the parameter. Remember, not all browsers natively support the call, and you might have to use Paul Irish’s shim to gain maximum compatibility. Also, it is important to realise that requestAnimationFrame() does not guarantee a fixed frame-rate, so you need to use time-deltas to calculate realistic physics. For a basic game like Pong, we don’t really care about that.

Basic World

Set up the Three.js world and camera

Three.js includes these important elements:

  • Scene
  • Renderer
  • Camera
  • Mesh
  • Light
  • Material

Cameras, Meshes, and Lights need to be added to the scene using the scene.add() function.

Attach a WebGL Three.js Renderer to the DIV

The renderer is attached to whichever HTML DOM element you wish to render the scene to, and a render() call is made each frame to the renderer in order to draw the Three.js scene.

Add a camera to the scene

Three.js has the option to create Perspective and Orthographic cameras. For most uses, Perspective camera is the best choice. We can change position and rotation information of the camera like any other object in the scene.

Draw a sphere and light it

Meshes must be paired with Materials in order to give them a defined look and feel. Meshes can be of many types, include primitives such as Cube, Sphere, Plane and Torus. Materials can have different characteristics depending on their type. The basic Material types include Lambert, Phong, and Basic.

  • Basic renders an unlit Mesh with no shadows or dark shading. A sphere will look like a circle if rendered with Basic.
  • Lambert is a simple diffuse-like lighting that creates shading on sides facing away from a light source. It gives a basic 3D look of surfaces that are matte (non-shiny and non-reflective)
  • Phong is used for achieving a plastic-like look and feel, with the ability to gain highlights that give a much shinier appearance to the Mesh.

Show off your sphere with a Point Light. This is the most basic light, with no direction or rotation. Make sure you tweak the light’s intensity and distance to get it looking good.

Add Game Objects

Draw playing area plane

The playing area will be a Three.js Mesh object of type Plane. Make sure the plane matches the play area, giving a small buffer gap to indicate where the paddles can and can’t go.

Draw paddles

The paddles will be Mesh objects of type Cube. Position each of the paddles on opposite sides of the play area.

1234567891011121314151617181920212223242526272829303132333435363738394041
// set up the paddle vars
paddleWidth = 10;
paddleHeight = 30;
paddleDepth = 10;
paddleQuality = 1;
// set up paddle 1
paddle1 = new THREE.Mesh(
new THREE.CubeGeometry(
paddleWidth,
paddleHeight,
paddleDepth,
paddleQuality,
paddleQuality,
paddleQuality),
paddle1Material);
// add the paddle to the scene
scene.add(paddle1);
// Set up the second paddle
paddle2 = new THREE.Mesh(
new THREE.CubeGeometry(
paddleWidth,
paddleHeight,
paddleDepth,
paddleQuality,
paddleQuality,
paddleQuality),
paddle2Material);
// Add the second paddle to the scene
scene.add(paddle2);
// set paddles on each side of the table
paddle1.position.x = -fieldWidth/2 + paddleWidth;
paddle2.position.x = fieldWidth/2 – paddleWidth;
// lift paddles over playing surface
paddle1.position.z = paddleDepth;
paddle2.position.z = paddleDepth;
view rawBNG_Pong_paddlecreateThis Gist brought to you by GitHub.

If you manipulate the camera positions, as seen in the screenshot, you can give a different perspective to the player.

Basic Logic

Ball movement

The ball will have an X-direction and a Y-direction that determines the movement per frame.

// ball’s x-direction, y-direction and speed per frame
var ballDirX = 1, ballDirY = 1, ballSpeed = 2;

The ball will move at a constant speed in the X-plane every frame. To this end, we will specify a ballSpeed variable that acts as a multiplier for the direction values.

// update ball position over time
ball.position.x += ballDirX * ballSpeed;
ball.position.y += ballDirY * ballSpeed;

We want the ball to have some unpredictable characteristics (e.g. when it gets sliced quite hard) so we will allow the Y-direction to go up to a maximum of ballSpeed * 2. You can tweak the values until you’re happy with how the ball behaves.

// limit ball’s y-speed to 2x the x-speed
// this is so the ball doesn’t speed from left to right super fast
// keeps game playable for humans
if (ballDirY > ballSpeed * 2)
{
ballDirY = ballSpeed * 2;
}
else if (ballDirY < -ballSpeed * 2)
{
ballDirY = -ballSpeed * 2;
}

Ball wall bounce logic

Simple collision detection logic is required to check if the ball is touching each of the side ‘walls’. Using a series of ‘if-else’ statements, we check the ball positions against the predetermined wall positions. In the case of a collision, we simply switch the Y-direction of the ball, creating a bounce effect.

// if ball goes off the top side (side of table)
if (ball.position.y <= -fieldHeight/2)
{
ballDirY = -ballDirY;
}
// if ball goes off the bottom side (side of table)
if (ball.position.y >= fieldHeight/2)
{
ballDirY = -ballDirY;
}

Later, we will edit some of this code in order to implement scoring when the ball passes a paddle.

Keyboard input for paddles

We will utilise a very effective short-cut in order to easily get keyboard input working in this game. Using the Keyboard.js file provided, we simply have to include the reference to it in the index.html file and we are set. Only one function call is required, the Key.isDown() call. Given a parameter, the library checks if that particular key is current being pressed, and returns a boolean value.

// move left
if (Key.isDown(Key.A))
{
// code to move paddle left
}

We use the ‘A’ and ‘D’ keys to move the paddle left and right, but you can edit the Keyboard.js with additional values if you want to use your own control scheme.

var Key = {
_pressed: {},
A: 65,
W: 87,
D: 68,
S: 83,
// add your required key code (ASCII) along with the name here
// for example:
SPACE: 32,
};

While dealing with keyboard input, it is also important to ensure that the input is never blindly updated in game. We have to check that the paddle isn’t made to move off the play area, and we do that with some ‘if-else’ statements as well.

// move left
if (Key.isDown(Key.A))
{
// if paddle is not touching the side of table
// we move
if (paddle1.position.y < fieldHeight * 0.45)
{
paddle1DirY = paddleSpeed * 0.5;
}
// else we don’t move and stretch the paddle
// to indicate we can’t move
else
{
paddle1DirY = 0;
paddle1.scale.z += (10 – paddle1.scale.z) * 0.2;
}
}

Note that we use a paddle direction variable, rather than simply applying a change to the position values. This will come in handy when programming the ball to ‘slice’ when hit at an angle with a fast-moving paddle.

Opponent logic

When you code a game of this calibre, it is of utmost importance that you create a vivid, lush environment with a host of emotional, highly-relatable characters that showcase this generation’s strides forward in technology. Instead, we will code a Pong A.I. that blindly follows the ball, because that is even better.

We can update the opponent difficulty by using a variable instead of introducing magic numbers. This variable will affect the ‘reaction rate’ of the opponent by increasing the Lerp (Linear-Interpolation) time.

When using a Lerp (Linear-Interpolation) function, we must ensure the opponent plays fairly by limiting their maximum travel speed. We do that with a few more if-else statements.

// in case the Lerp function produces a value above max paddle speed, we clamp it
if (Math.abs(paddle2DirY) <= paddleSpeed)
{
paddle2.position.y += paddle2DirY;
}
// if the lerp value is too high, we have to limit speed to paddleSpeed
else
{
// if paddle is lerping in +ve direction
if (paddle2DirY > paddleSpeed)
{
paddle2.position.y += paddleSpeed;
}
// if paddle is lerping in -ve direction
else if (paddle2DirY < -paddleSpeed)
{
paddle2.position.y -= paddleSpeed;
}
}
If want to extend immersion, you could also using the paddle.scale property to stretch the paddle when it can’t be moved. This indicates an issue to the player which they can then address immediately. In order to accomplish this, we must ensure the paddle always Lerps back to the default scale size.
// We lerp the scale back to 1
// this is done because we stretch the paddle at some points
// stretching is done when paddle touches side of table and when paddle hits ball
// by doing this here, we ensure paddle always comes back to default size
paddle2.scale.y += (1 – paddle2.scale.y) * 0.2;

Adding Gameplay

Making the ball reset after missing a paddle

To get the main scoring gameplay working, we need to first remove the ball’s ability to bonce off the paddle-facing walls. To do this, we remove the bounce code from the two corresponding if-else statements.

// if ball goes off the top side (side of table)
if (ball.position.y <= -fieldHeight/2)
{
ballDirY = -ballDirY;
}
// if ball goes off the bottom side (side of table)
if (ball.position.y >= fieldHeight/2)
{
ballDirY = -ballDirY;
}
//// ——————————— ////
CHANGED CODE
//// ——————————— ////
// if ball goes off the ‘left’ side (Player’s side)
if (ball.position.x <= -fieldWidth/2)
{
// CPU scores a point
// update scoreboard
// and reset ball
}
// if ball goes off the ‘right’ side (CPU’s side)
if (ball.position.x >= fieldWidth/2)
{
// player scores a point
// update scoreboard
// and reset ball
}

We can handle scoring in many different ways. For a simple game like this, we can simply increment the corresponding score count variable.

// if ball goes off the ‘left’ side (Player’s side)
if (ball.position.x <= -fieldWidth/2)
{
// CPU scores
score2++;
// update scoreboard HTML
document.getElementById(“scores”).innerHTML = score1 + “-” + score2;
// reset ball to center
resetBall(2);
// check if match over (someone scored maxScore points)
matchScoreCheck();
}

We can then update the HUD element in the DOM by setting its innerHTML value. Finally, we have to reset the ball once someone has scored. A simple function can be written to reset the ball, with a parameter indicating which paddle just lost (so we know which paddle to send the ball to next time).

// resets the ball’s position to the centre of the play area
// also sets the ball direction speed towards the last point winner
function resetBall(loser)
{
// position the ball in the center of the table
ball.position.x = 0;
ball.position.y = 0;
// if player lost the last point, we send the ball to opponent
if (loser == 1)
{
ballDirX = -1;
}
// else if opponent lost, we send ball to player
else
{
ballDirX = 1;
}
// set the ball to move +ve in y plane (towards left from the camera)
ballDirY = 1;
}

Making the ball bounce off paddles

Alright, this is it. The big one. Literally the biggest feature of this game. It’s time to get the paddles hitting the ball. In a simple Pong game, paddle-ball physics are nothing more than a couple of if-else statements. We check the X-position and Y-position of the ball against the paddle’s rectangular bounds, and if they intersect, we bounce the ball away.

// if ball is aligned with paddle1 on x plane
// remember the position is the CENTER of the object
// we only check between the front and the middle of the paddle (one-way collision)
if (ball.position.x <= paddle1.position.x + paddleWidth
&& ball.position.x >= paddle1.position.x)
{
// and if ball is aligned with paddle1 on y plane
if (ball.position.y <= paddle1.position.y + paddleHeight/2
&& ball.position.y >= paddle1.position.y – paddleHeight/2)
{
// ball is intersecting with the front half of the paddle
}
}

It’s also important to check the direction of the ball’s travel, as we only want to check collisions in one direction (the direction towards the opponent.)

// and if ball is travelling towards player (-ve direction)
if (ballDirX < 0)
{
// stretch the paddle to indicate a hit
paddle1.scale.y = 15;
// switch direction of ball travel to create bounce
ballDirX = -ballDirX;
// we impact ball angle when hitting it
// this is not realistic physics, just spices up the gameplay
// allows you to ‘slice’ the ball to beat the opponent
ballDirY -= paddle1DirY * 0.7;
}

We will also affect the ball’s lateral movement depending on the relative speed of the paddle when hitting the ball. This is particularly useful in introducing the biggest variable in Pong: the slice. Slicing the ball is often the only way to confuse and outmaneuver the opponent, so it is vital in this game.

Remember to duplicate the code, but update the values to match the opponent’s paddle. You can use this opportunity to gimp your opponent’s ability somewhat, by reducing the hitbox size or decreasing the slice amount. It’s what we would all do.

Here is the final paddle-ball collision function:

// Handles paddle collision logic
function paddlePhysics()
{
// PLAYER PADDLE LOGIC
// if ball is aligned with paddle1 on x plane
// remember the position is the CENTER of the object
// we only check between the front and the middle of the paddle (one-way collision)
if (ball.position.x <= paddle1.position.x + paddleWidth
&& ball.position.x >= paddle1.position.x)
{
// and if ball is aligned with paddle1 on y plane
if (ball.position.y <= paddle1.position.y + paddleHeight/2
&& ball.position.y >= paddle1.position.y – paddleHeight/2)
{
// and if ball is travelling towards player (-ve direction)
if (ballDirX < 0)
{
// stretch the paddle to indicate a hit
paddle1.scale.y = 15;
// switch direction of ball travel to create bounce
ballDirX = -ballDirX;
// we impact ball angle when hitting it
// this is not realistic physics, just spices up the gameplay
// allows you to ‘slice’ the ball to beat the opponent
ballDirY -= paddle1DirY * 0.7;
}
}
}
// OPPONENT PADDLE LOGIC
// if ball is aligned with paddle2 on x plane
// remember the position is the CENTER of the object
// we only check between the front and the middle of the paddle (one-way collision)
if (ball.position.x <= paddle2.position.x + paddleWidth
&& ball.position.x >= paddle2.position.x)
{
// and if ball is aligned with paddle2 on y plane
if (ball.position.y <= paddle2.position.y + paddleHeight/2
&& ball.position.y >= paddle2.position.y – paddleHeight/2)
{
// and if ball is travelling towards opponent (+ve direction)
if (ballDirX > 0)
{
// stretch the paddle to indicate a hit
paddle2.scale.y = 15;
// switch direction of ball travel to create bounce
ballDirX = -ballDirX;
// we impact ball angle when hitting it
// this is not realistic physics, just spices up the gameplay
// allows you to ‘slice’ the ball to beat the opponent
ballDirY -= paddle2DirY * 0.7;
}
}
}
}
view rawBNG_Pong_paddlecollCompleteThis Gist brought to you by GitHub.

Scoring

In Pong, it is usually simplest to have a maximum score value, such that a game is won when either player reaches that score. To that end, we can easily create a maxScore variable and set it at the start of the match.

We then create a function to check if either player has scored equal or higher than the maximum. This function should be called only when a score has been changed (i.e. when someone scores a point.)

// checks if either player or opponent has reached 7 points
function matchScoreCheck()
{
// if player has 7 points
if (score1 >= maxScore)
{
// stop the ball
ballSpeed = 0;
// write to the banner
document.getElementById(“scores”).innerHTML = “Player wins!”;
document.getElementById(“winnerBoard”).innerHTML = “Refresh to play again”;
}
// else if opponent has 7 points
else if (score2 >= maxScore)
{
// stop the ball
ballSpeed = 0;
// write to the banner
document.getElementById(“scores”).innerHTML = “CPU wins!”;
document.getElementById(“winnerBoard”).innerHTML = “Refresh to play again”;
}
}

After a match is deemed complete, it is simplest to just return the ball to the centre and stop any movement, so that play doesnt inadvertently continue.

Prettifying the Game

HUD

It’s important to give feedback to the player so they know what’s going on. For Pong, the least we can do is keep a scoreboard ticking over. Instead of trying to draw the HUD on the same layer as the game, we can use the other DOM elements to provide the required feedback.

It’s also good to indicate the maximum score as well, so we have another element for that which we will update at match start.

// update the board to reflect the max score for match win
document.getElementById(“winnerBoard”).innerHTML = “First to ” + maxScore + ” wins!”;

Shadows

Finally, it is time to make things look a tad more polished. Three.js has the awesome ability to create shadows for primitive objects (Cube, Plane, Sphere, etc.) so we can utilise that to make the game look nicer.

Shadows can’t be created with just a Point light, so we have to add a DirectionalLight or a SpotLight. A SpotLight shines a circular beam of light onto surfaces, which DirectionalLight simply shines a light in a certain direction with no regard to positioning.

We will use a SpotLight because it clearly indicates where the light originates from and shines towards.

We can update the SpotLight to follow the ball around to give a more dynamic look and feel to the game, whilst showcasing the hard work we just put into the lighting.

// we can easily notice shadows if we dynamically move lights during the game
spotLight.position.x = ball.position.x;
spotLight.position.y = ball.position.y;

To make an object in the scene cast or receive shadows, we simply set their .receiveShadow and .castShadow variables to true. For example,

paddle1 = new THREE.Mesh(
new THREE.CubeGeometry(paddleWidth, paddleHeight, paddleDepth, paddleQuality, paddleQuality, paddleQuality),
paddle1Material);
// add the sphere to the scene
scene.add(paddle1);
paddle1.receiveShadow = true;
paddle1.castShadow = true;

Conclusion

This is but a basic introduction to the power of Three.js, which should allow you to create a basic Pong clone.

Play the latest build of this game here: LATEST BUILD*

Find the latest code at its GitHub page*

You can still do quite a number of things to polish your game, such as

  • Create animations for the paddles and ball
  • Update the HUD to look prettier
  • Import complex objects created in Modeling packages, to design a more immersive environment
  • Move HUD elements inside the game view to allow for full-screen gaming
  • Mess around with complex shaders to create reflections and other cool effects