235 Slices
  Title Author Publisher Format Buy Remix
Medium 9780596007300

28. Trees That Grow

Andrew Davison O'Reilly Media ePub

The last two chapters have been about creating landscapes: the fractal terrain in Chapter 26 was empty, but the Terragen-generated landscape in Chapter 27 was decorated with 3D models and ground cover (2D images that always face the user). This mix of models and images is enough in most situations but still lacking in one area: the scenery doesn't change. For example, the trees don't sway in the wind, and the sagebrush doesn't tumble.

As the title of this chapter suggests, this chapter focuses on making trees grow. Each tree starts from a tiny sampling, then young green shoots turn brown, grow, branch, and sprout leaves. However, the underlying aim is to describe a rule-based approach to animation, which can be applied to many kinds of 3D shapes. This approach has the following characteristics:

Each rule is a Java if-then statement. If all the conditions of a rule evaluate to true, then the rule's actions are carried out.

I'm not using a rule-based language such as Prolog, or a Java rules engine such as JESS. There's no need to step beyond standard Java.

See All Chapters
Medium 9781449314941

5. Merchants and Trading

Peter Tyson O'Reilly Media ePub

Trade caravans from neighboring friendly civilizations will arrive throughout the year, offering you useful goods and happily taking just about anything you dont want off your hands. Trading is an excellent way to get your hands on animals for training and breeding, exotic goods, weapons and armor, and emergency food and drink rations. Supporting your trade empire is easykeep your Craftsdwarfs Workshop churning out rock crafts, and pretty soon you will be exporting your tacky ethnic trinkets to middle-class hovels across your world.

Inevitably, you will eventually get a message at the bottom of your screen (remember, you can view all alerts by pressing a) informing you that a merchant caravan has arrived. The camera will switch to the caravans location, and if you wish, you may watch the merchants and their goods move in towards your Trade Depot. Once they arrive, you will receive a message about the merchants unloading their goods and the Trade Depot will start to look quite busy.

At this point, it is advisable to press q (Set Building Tasks) on the Trade Depot and then review the options. We want goods moved to the Trade Depot so we can trade them to the merchants, and we want our broker to be there to conduct the trade negotiations. There should be a name under Broker, which is probably also your expedition leader. If not, press n for Nobles and Administrators from the main menu, scroll down to Broker, and press enter. The first dwarf in the list should be your expedition leader (the dwarf you gave the leadership skills to in Chapter2), so press enter to set them as the broker.

See All Chapters
Medium 9781449360504

2. Getting Started with Visual Studio

Jesse Freeman O'Reilly Media ePub

When it comes to getting an HTML5 game up and running on Windows 8, I use the term porting lightly. Unlike other languages, you do not have to endure the difficult process of truly porting over your code. Windows 8 was designed to make HTML5-based apps run and perform like native ones written in C# or C++. In most cases you simply need to copy your code over to a Visual Studio project, include the files, and hit compile to see your game running. Let’s talk a little bit about which games will work and which ones won’t on Windows 8.

As a rule of thumb, if the game runs in IE10 then you are set. For extra insurance, you can double check your game in the Windows 8 version of IE10 to discover any minor issues that may arise. For the most part, the two browsers run identically. You can also do the same testing on Windows RT to see what performance would be like on ARM devices.

Outside of testing your game in IE10, completely Canvas-based games will generally be the easiest to port. This is true of any HTML5 game you are trying to run on different platforms, as Canvas is self-contained and consistently implemented across each of the major browsers at this point. Also, it’s important to note that Canvas is hardware accelerated in IE10, and you will see similar performance boosts that you would have gotten in WebKit-based browsers that support hardware-accelerated Canvas, such as Chrome.

See All Chapters
Medium 9781449314941

A. Afterword: Farther

Peter Tyson O'Reilly Media ePub

I hope you have enjoyed reading this book, and that it has kindled a love for this unique and marvelous game. There are few games as ambitious as Dwarf Fortress, and few developers as dedicated and single-minded as Tarn and Zach Adams. We are lucky to be able to play in the worlds they help us create.

The joy of Dwarf Fortress lies in the games remarkable depth and the stories that unfold from the interactions between its many elements. From world and history generation through to the individual personalities of your dwarves, each component of Dwarf Fortress involves us in amazing stories making each fortress experience a unique one.

By now, I hope you too have a few stories to share with your confused and somewhat concerned friends and family. When they get tired of your story about the time Urist McCrazydwarf pulled your End the World lever, why not join the wider Dwarf Fortress communityon the Dwarf Fortress forums (http://www.bay12forums.com/smf/), reddit (http://www.reddit.com/r/dwarffortress/), Twitter, and the many blogs and tumblr sitesand share your tales, questions, and ideas? You will find the Dwarf Fortress community to be full of fun, helpful people just as enthusiastic about this game.

See All Chapters
Medium 9780596101435

4. Games

C. K., III Sample O'Reilly Media ePub

The PSP is a gaming machine, first and foremost. The hacks collected in this chapter show you how to do a few things that Sony never intended you to do when they first released the PSP.

Share one UMD disk between multiple PSPs in an ad hoc multiplayer WiFi game.

You’ve just bought a brand new PSP and so has your best friend. You are both eager to play head-to-head, using the PSP’s wireless gaming capabilities. Unfortunately, you and your friend have differing tastes in games and, as a result, you don’t have two copies of any one game between the both of you. Before you run out to rent or buy a duplicate game from your combined lists, try this little method to trick your PlayStation Portables into thinking that you have two copies of your game.

Shortly after the North American release of the PSP, several different sites and online forums began simultaneously reporting that people could play multiplayer ad hoc games among multiple Playstation Portables using only one UMD disk. Here’s the basic procedure:

See All Chapters
Medium 9780892728060

Have you bunked in these cozy cabins?

Andrew Vietze Down East Books ePub

When the snow settles gently on this central Maine village, the population drops to about half of what it is during the summer. Maybe even less than that. Sporting camps like these make little boarded-up ghost villages, and the fishermen who come to troll for salmon are probably dropping lines for tarpon somewhere sunny. The family camps on the shore of this long lake are likewise closed for the season, and tourists disappear like Judge Crater, the New York Supreme Court associate justice who had a summer home around here and mysteriously vanished one day in the 1930s, becoming one of the biggest unsolved mysteries in U.S. history. These twelve camps are on a tiny island surrounded by communities with European names, underneath the shadow of “The Mountain” and just around the corner from Elizabeth Arden Road. They were constructed in the late 1920s by a local gentleman who actually built the island on which they sit, hand-filling an acre of water. Finding guests to fill the camps was never a problem. People have been summering in this area since before the turn of the century. A 1981 movie, set here but filmed in New Hampshire, introduced the nation to this land of lakes. Nowadays, kayak and canoe outfitters do a brisk business here, and in more recent years a golf course opened that has been rated one of “America’s Greatest Public Courses” by Golf Digest and continues to draw big crowds. Just not in January. See page 99 to learn the location of this wintry scene.

See All Chapters
Medium 9780596007300

18. 3D Sprites

Andrew Davison O'Reilly Media ePub

In this chapter, I'll develop a Sprite3D class, which can be subclassed to create different kinds of sprites. The user's sprite (a robot) and a chasing sprite (a hand) are shown in action in Figure 18-1 sharing the checkerboard with some scenery (a palm tree and castle) and obstacles (the red poles).

Figure18-1.3D sprites in action

Features illustrated by the Tour3D application include:

The sprites are controlled by Behavior subclasses.

A simple third-person camera automatically adjusts the user's viewpoint as the user's sprite moves around the scene. The camera can be zoomed in and out by keyboard controls.

The scene contains obstacles that a sprite can't pass through. (They're represented by cylinders in Figure 18-1.) Sprites are prevented from moving off the checkered floor.

Collision detection between a sprite and the obstacles is implemented by bounds checking.

A "tour" text file loaded at start time contains obstacle and scenery information. The scenery models (e.g., the castle and the palm tree in this example) are loaded with PropManager objects.

See All Chapters
Medium 9780253014993

6. Avastars: The Encoding of Fame within Sport Digital Games

Thomas P Oates Indiana University Press ePub

Steven Conway

LIONEL MESSI HAS DEVELOPED WELL DURING HIS TIME AS Surreal Madrid’s star striker. He has an overall rating of 98, with an attack and shot accuracy of 99, dribble accuracy and dribble speed of 98, and explosive power of 97. Allied to this are eleven special abilities, such as “incisive run,” “long-range drive,” and “roulette skills” (this refers not to the casino game, but to the skill of pirouetting over a soccer ball to avoid an opponent’s incoming challenge). He has evolved into the definitive “game changer,” as we say in common managerial parlance. My other striker, the 1961 iteration of Brazil’s Pelé, has a host of attributes in the high ’90s with eighteen special abilities. The latest boot technology from Adidas’s Predator range accentuates my strikers’ already extraordinary proficiency; I chose the Predator for its high shot power and swerve ratings over the adiZero’s high acceleration and top speed. After much careful tinkering with my squad’s formation and tactics, I take to the pitch, prematch nerves building in the tunnel. Following a sublime performance, we have annihilated FC Barcelona 4–0 in the semifinal of the Champions League. The intense rivalry between the clubs is well documented by the press, and I am informed postmatch that Surreal Madrid’s loyal fan base is distinctly pleased with the result; we are now an S (super) grade in popularity. This is particularly gratifying news for my scouts, who know that this rating may finally be the key to attracting Cristiano Ronaldo to put pen to paper for Surreal Madrid.

See All Chapters
Medium 9780596007300

15. A 3D Checkerboard: Checkers3D

Andrew Davison O'Reilly Media ePub

This chapter describes Checkers3D with a Java 3D example that creates a scene consisting of a dark green and blue tiled surface with labels along the x- and z-axes, a blue background, and a floating sphere lit from two different directions. The user (viewer) can travel through the scene by moving the mouse.

The lefthand screenshot in Figure 15-1 shows the initial view; the picture on the right shows the scene after the user has moved around a bit.

Figure15-1.Initial view, and later

Checkers3D illustrates many of the common, and sometimes tricky, aspects of programming with Java 3D. For example, the 3D scene is displayed using the Java 3D Canvas3D class, which must be integrated with Java's Swing components. All Java 3D applications require a scene graph, and Checkers3D shows how to add basic shapes, lighting (ambient and directional), and a background. The scene graph diagram acts as a visual form of documentation, and a textual version of its information can be generated easily, with the help of Daniel Selman's Java3dTree package. (I'll supply details at the end of this chapter).

See All Chapters
Medium 9780596007300

3. Worms in Windows and Applets

Andrew Davison O'Reilly Media ePub

In this chapter, I test the threaded animation loop of Chapter 2 inside a windowed application and an applet. To simplify comparisons between the approaches, the programs are all variants of the same WormChase game. In Chapter 4, I will continue the comparisons, concentrating on several kinds of full-screen applications.

Figure 3-1 shows the windowed WormChase application on the left and the applet version on the right.

Figure3-1.WormChase in a JFrame and JApplet

The aim of the game is to click the cursor on the red head of the rapidly moving worm. If the player misses the worm's head, then a blue box is added to the canvas (unless the worm's black body was clicked upon).

The worm must go around the boxes in its path, so the boxes may make the worm easier to catch. When the worm moves off the top edge of the window it appears at the bottom, and vice versa. When it travels past the left or right edge, it appears at the opposite side. The worm gradually gets longer until it reaches a maximum length, which it maintains for the rest of the game.

See All Chapters
Medium 9780596101374

14. Publishing and Exporting

E. A. Vander Veer O'Reilly Media ePub

When you've finished creating an animation in Flash, you'll want to do one of two things with it: You'll want to either publish it, which means packaging it in a form your audience can play using the Flash Player they've installed on their computers; or you'll want to export it, which means packaging it in a form you can edit using another graphics or animation program (such as Adobe Illustrator or Macromedia/ Adobe Fireworks).

Publishing means something different in Flash (where it means "creating an executable Flash file") from what it means in the larger world of Web development (where it means "transferring files to a Web server").

In this chapter, you'll learn how to do both.

Using Flash's publishing settings (Figure 14-1), you'll see how to tell Flash to publish your animation as part of a Web page, and as a standalone projector. You'll also see how to export the artwork in your animation as editable image files. But before you publish or export, you need to learn how to optimize your animation (reduce your animation's file size) so that it runs as quickly and efficiently as possiblea real concern if you're planning to publish your animation on the Web (see the box on Section 14.1).

See All Chapters
Medium 9780596007782

2. Non-iPod Hardware

Hadley Stern O'Reilly Media ePub

You can access your playlists, pause and play music, and much more, all from your Palm Pilot or other web-enabled handheld device.

If you have AirPort Express set up in your home Stream Music with AirPort Express [Hack #26] , you have probably noticed one catch in the whole wireless-music deal: in order to change songs, you have to schlep to wherever your host iTunes machine is. Not very convenient, is it? This hack will turn your wireless, handheld, web-capable device into an iTunes remote, allowing you to control iTunes from anywhere in the house.

So, how is this magic possible? webRemote (http://www.deadendsw.com/Products/webRemote.html; $\1), a piece of software that you install on the machine that runs iTunes, is a server package that acts as an intermediary between your web-enabled device and iTunes. It allows you to control iTunes from any web browser and, for the purposes of this hack, from a wireless PDA.

See All Chapters
Medium 9780596009427

7. The Bullpen

Joseph Adler O'Reilly Media ePub

Test your skills at picking winning players by managing your own fantasy team.

In the late 1960s, a set of professors at Harvard University (led by sociologist William Ganson) invented a new game based on baseball statistics. Each manager made up his own team of baseball players. The manager with the best team won. They ranked the teams based on the individual players statisticsbatting averages, runs batted in, and strikeouts.

One of the professors, Bob Sklar, moved on to the University of Michigan and passed the game on to one of his students there, a writer named Daniel Okrent. Okrent introduced this game to a set of his writer friends at a restaurant called La Rotisserie Francaise in Manhattan in 1980, and modern Rotisserie baseball was born. (Incidentally, Okrent wrote the article in Sports Illustrated that introduced Bill James to a wide audience. He also wrote one of my favorite books about baseball: Nine Innings [Houghton Mifflin], about a single game between the Milwaukee Brewers and the Baltimore Orioles on June 10, 1982.)

See All Chapters
Medium 9780596009175

5. Playing with Early Personal Computers

Chris Kohler O'Reilly Media ePub

Get your old system up and running again.

There are old Apple ][ systems, from the original Apple ][ to the last Apple IIgs ROM 3, lurking in attics, closets, basements, and the occasional store all over the world. I kept my old Franklin Ace 1000 (an Apple ][+ clone) in my parents attic for a decade or so, and found the hardware worked just fine when I turned it on. Ive since acquired an Apple //e and two IIgs computers, and an Apple IIe card for a Macintosh LC. Theres lots of Apple ][ stuff out there, though Apple discontinued the IIgs in 1991, and the IIe emulator card in 1993. Searching on eBay today brings up 212 items for the string Apple II. (Apple ][ doesnt work well as an eBay search string, as the ][ seems to get ignored.)

Apple changed its mind repeatedly about how to spell 2. They went from ][ and ][+ to //e and //c, then to the IIgs and the IIe compatibility card. Ive tried to keep them all straight, but its a strange challenge.

Making an Apple ][ system work requires a few key ingredients: an Apple ][ (or compatible) of some kind, a disk drive that works with that computer (unless you have a model that supports tape cassettes and have a lot of patience), a monitor (a TV is fine), and some functioning floppy disks. Sadly, disks can demagnetize over time, and I discovered to my sorrow that many of my more than one hundred old disks no longer worked. The ingredients you need vary slightly by computer:

See All Chapters
Medium 9780596007300

19. Animated 3D Sprites

Andrew Davison O'Reilly Media ePub

This chapter and the next deal with sprite animation. The Sprite3D class of Chapter 18 possesses a rudimentary kind of animation, allowing the entire sprite to be moved over the XY plan and rotated around the y-axis. The kind of animation we'll be discussing here allows parts of the figure to move; for example, to have a robot wave its arms, jump, or turn its head.

There are three common animation approaches:

Keyframe animation

Figure articulation

Figure articulation with skinning

Keyframe animation is similar to the technique used in the 2D Sprite class from Chapter 11. However, instead of using a sequence of 2D images, a sequence of 3D models is used. Each model is represented by the same figure but is positioned slightly differently; rapid switching between the models creates the illusion of sprite movement. Poses can be organized into an animation sequence, so, for example, walking is represented by a sequence of different leg positions. A sequence is typically triggered by the user pressing a key (e.g., the down arrow, to move the sprite forward) or by other external events. A simple keyframe animation system is developed in this chapter.

See All Chapters

Load more