terra incognita A broad view of Microsoft Office


27
Jul/10
0

How it’s Made: Tower Defense - a Game in Excel 2010

This post is syndicated from Microsoft Excel 2010.

image

 

This blog post is brought to you by Karen Cheng a Program Manager on the Excel team.

 

 

In today's post, we'll show you how the arcade game Tower Defense was created in an Excel spreadsheet (see a video of the game being played here).  In this game, creeps move toward your castle. You must defend it by placing towers which shoot at the creeps. The more creeps you kill, the more money you get to buy and upgrade your towers.

To play, you'll need -

· To download the game here.

· To install Excel 2010, hot off the press last week. You can get a free trial here. The games use features that are new to Excel 2010, so they won't work in older versions.

When you open the file to play, don't forget to enable the macros. Also, if you get a circular reference warning, you need to enable iterative calc by setting “Enable iterative Calculation” in advanced options under File -> Options -> Formulas -> Enable Iterative Calculations.

clip_image001

Instructions and General Gameplay

After selecting your level and difficulty and clicking Play, the game begins.

Creeps - Creeps come in "waves" of four. Each wave, they get stronger - They require stronger bullets to kill (strength), move faster (speed), and reward you with more cash once killed (worth). These stats are under the Creeps part of the menu.

clip_image003

Towers - To buy a tower, click on one of the towers on the right and then click on the map to place it. Towers come in two varieties - Basic and Advanced. Advanced towers are basically supercharged versions of the basic towers that shoot stronger bullets (Strength), faster bullets (Speed), and bullets that travel farther (Range). Clicking on a tower will show you these stats. Since a tower can only fire one bullet at a time, hitting the creeps at a closer range lets the tower shoot more bullets before the creep gets too far away. Range is shown by a heat map around the tower.

clip_image005

When you earn enough cash, you can upgrade your towers, which will increase their stats. Upgraded towers are represented by blue shading.

clip_image007

Lives - If a creep reaches your castle (which is represented by the flag), you lose a life. You get three lives.

The Graphics Engine

Play the game and you'll notice the animation of the creeps and bullets. You wouldn't be able to achieve this level of smooth animation if each cell simply represented a pixel, as in Missile Command. So how was this done?

Creeps and Bullets

The secret lies in a transparent scatter chart (two charts, technically, but that's more detail than we'll get into) that lays on top of the game screen. The creeps and bullets are points on the scatter plot, which constantly recalculates and refreshes. The bullets are represented by one series on the chart (the Xs) and the creeps are represented by a second series (the red diamonds).

The X-Y coordinates of the creeps and bullets are calculated via linear interpolation based on a number of factors (the map path, the location of the castle, and game's clock).

I won't go specifically into what each of these columns mean, but here's a peek into some of the stats used to calculate the position of the creeps. They are on the hidden worksheet, Calc.

clip_image009

Map Path, Towers, and Castles

The map path, towers, and castles are all drawn on the grid with conditional formatting. Below I've overlaid an image of the numbers behind the cells with the game area. Below  you can see that -1 represents the map path, -23 is a basic tower with two upgrades, etc. These numbers are constantly being recalculated as you play the game.

clip_image010

clip_image011

The conditional formatting rules behind the grid

In Excel 2010, we've expanded your capability to create intricate and complex rules by allowing formula-based conditional formatting to reference other worksheets. Behind each cell is a formula that looks something like this:

=IF(Calc!B263<>0,Calc!B263,IF(AND('Fixed Data'!AE2=Calc!$D$6,'Fixed Data'!AE16=Calc!$C$5),0,('Fixed Data'!AE2-Calc!$D$46)^2+('Fixed Data'!AE16-Calc!$D$45)^2))

While we won't go into what every piece of that formula does, we do want to draw attention to the references to two hidden worksheets, Fixed Data and Calc - cross-sheet references made possible in Excel 2010. If you're curious, unhide the sheets and check out the formulas behind the cells. The ones that generate the heat map of tower strength on mouse hover are the most interesting. Finally putting that Pythagorean Theorem you learned back in grade school to good use!

Bells and Whistles

Sparklines

When you play the game, you'll notice an animated line at the bottom, which displays the frame rate of the game. This is done with sparklines, a new feature in Excel 2010 that allows you to embed mini charts in a cell.

clip_image012

While sparklines weren't exactly designed to be animated, they can be animated with some clever spreadsheet engineering. The sparkline is based on a data range (Calc worksheet, C56:C85) which is constantly recalculated, creating the illusion of movement.

Slicers

Did you notice that when you chose the level and difficulty at the beginning of the game, you didn't have to go to a dropdown to do it? Instead you clicked on buttons in slicers, a new feature in Excel 2010 that allows you to quickly and visually interact with your data.

Oh, and of course - no game would be legitimate without being available in multiple languages.

clip_image013

A final note

One cool thing about this spreadsheet is how little macros were used. For the most part, macros are only being used to start/stop the game and keep track of mouse movements and clicks. Everything else is pure Excel: the calculation engine, conditional formatting, and two new features to Excel 2010 - sparklines and slicers.

15
Jun/10
0

Chrome, Hotmail, and Office 2010

This post is syndicated from Microsoft Office Web Apps.

Office 2010 goes public today! A lot of the work we did in Office Web Apps is a part of the Office 2010 release and we are really excited. Last year I wrote about some of the ways Office Web Apps and Office 2010 complement each other.

When we announced our browser support we heard from many of you that we left out Chrome. A big part of supporting a browser is spending the time to properly test our apps in that browser and then fixing any issues we encounter. We’re pleased to announce that we’ve tested Office Web Apps in Chrome and have fixed several issues. If you love Chrome, we want you to use Office Web Apps in Chrome. If you find issues that we missed, use the feedback links in the web apps to tell us about the issues.

Office Web Apps are also becoming a part of Hotmail! Over the next few months more and more Hotmail users will be able to view supported Office file attachments using Office Web Apps. It will also be easy to move attachments into SkyDrive.

Nick Simons
Program Manager, Office Web Apps

7
Jun/10
0

Office Web Apps Now Available on Windows Live

This post is syndicated from Microsoft Excel 2010.

We are excited to announce that today Office Web Apps are available on Windows Live. The initial release is available to Windows Live customers in the USA, Canada, Great Britain and Ireland with support for English, Spanish (USA) and French (Canada). More languages and locales will be added over the coming months.

This release includes Word, PowerPoint, Excel and OneNote. The ability to edit Word documents and open OneNote notebooks is included. Not only do we want you to try these web apps, we also really want to hear what you think. Please use the feedback links in the web apps.

We’ll have more to share early next week when Office 2010 is released to consumers, including how Office 2010 + SkyDrive + Office Web Apps give you a great experience across the PC, phone and browser.

Check out Office Web Apps on Window Live and read the Windows Live Announcement.

Nick Simons
Program Manager, Office Web Apps

7
Jun/10
0

Office Web Apps Now Available on Windows Live

This post is syndicated from Microsoft Office Web Apps.

We are excited to announce that today Office Web Apps are available on Windows Live. The initial release is available to Windows Live customers in the USA, Canada, Great Britain and Ireland with support for English, Spanish (USA) and French (Canada). More languages and locales will be added over the coming months.

This release includes Word, PowerPoint, Excel and OneNote. The ability to edit Word documents and open OneNote notebooks is included. Not only do we want you to try these web apps, we also really want to hear what you think. Please use the feedback links in the web apps.

We’ll have more to share early next week when Office 2010 is released to consumers, including how Office 2010 + SkyDrive + Office Web Apps give you a great experience across the PC, phone and browser.

Check out Office Web Apps on Windows Live and read the Windows Live Announcement.

Nick Simons
Program Manager, Office Web Apps

30
Apr/10
0

Facebook + Office = (new Office comic)

This post is syndicated from Office Comics.

Today's Office comic was inspired by Docs for Facebook and the ability in Facebook to set your status to "single," "married," or "it's complicated."

If you haven't heard of Docs, it's an app for Facebook (built on top of the Office 2010 web apps!) that lets you create and share Office documents with your Facebook friends--without ever leaving your browser. For a more thoughtful discussion of Docs by one of our VPs, check out "Cloud creates new opportunities for Office: thoughts on Docs for Facebook." The app is still in Beta, so if you want to try it out, you need to sign up.

Semi-random tip: In Office 2007 (and Office 2010), you can prevent changes to the final version of a document by using the Mark as Final command.

-- David Salaguinto
To learn more about Office, visit
Office.com.

24
Mar/10
0

Using Office Web Apps to Create New Files

This post is syndicated from Microsoft Office Web Apps.

Office Web Apps can be installed as part of a SharePoint deployment. Also, Office Web Apps will be available on Windows Live SkyDrive. One difference between Office Web Apps in these two environments is how you create new files.

Creating Files on SkyDrive

On SkyDrive you will be able to create a new document, workbook, presentation or OneNote notebook using the Office Web Apps. The UI looks like this…

clip_image001

When you create a new file using this UI the file will open in the appropriate Office Web App. SkyDrive uses a simple blank template to create these new files.

Of course you can also upload files to SkyDrive and edit them in Office Web Apps. And if you have Office 2010, you will be able to save files from applications such as Word and PowerPoint directly to SkyDrive.

Creating Files on SharePoint

In SharePoint, if you have Office installed on your machine, the new file experience will always use the appropriate Office desktop client. It will not use Office Web Apps. However, if you don’t have Office on your desktop, SharePoint will use the appropriate Office Web App (if it is available) to create a new file.

Office Web Apps can only create new files based on Office Open XML file formats (e.g., .docx or .xlsx) and the OneNote 2010 file format. When Office Web Apps create new Word, PowerPoint and Excel files, the template must be compatible with the web app. All the templates that ship with SharePoint are compatible with Office Web Apps. The OneNote Web App is a bit different – it will always create a blank OneNote 2010 notebook.

I want to say a little bit more about customizing the new file experience in SharePoint. Please note that this applies to the Office desktop clients as well as Office Web Apps.

The default SharePoint UI for creating new files in a document library looks like this…

clip_image002

By default you will be offered the ability to create a new Word document. This document is based on a blank default Word template. However, this UI is customizable.

When you create a new document library, you are presented with the option of selecting a document template. These templates include the file types that are supported by Office Web apps. That UI looks like this…

clip_image003

The templates that you choose in this UI are still the default blank templates; however, in the Advanced Settings of a document library you can change the documents template to be just about any file you want. For example, you can use a template that contains custom fonts, boilerplate text, or a company logo. The UI to select a custom template looks like this…

clip_image004

By default, each document library only supports a single template. In many cases that’s all that you will need and you can stop now.

Still reading? Okay. If you want to create both PowerPoint and Word files in the same document library, for example, you will need to associate multiple templates with that library.

SharePoint allows you to associate multiple templates with a document library using a feature called Content Types. If you followed the jump, you saw that Content Types do a lot more than simply allow multiple templates in the same document library. But right now I am only going to talk about that.

To use Content Types you will need to…

  1. Create a content type
  2. Turn on Content Types in your document library
  3. Add your custom content type to your document library

Now here’s how to do this.

To begin you will need to create a content type for each type of file you want. To do this, go to Site Settings and select Site Content Types. Click Create. Give your content type a name (such as My Word Document). Set the Parent Content Type to Document from the list of Document Content Types. On the Advanced Settings page for the content type, select the template you want to use.

Once this is done turn on Content Types in your document library. You can do this in Document Library Settings>Advanced Settings.

Now return to Document Library Settings. In the Content Types section select Add from existing site content types. From here you should be able to select your custom content type.

If you want to set up your whole SharePoint site to use the same set of content types in every new documents library, you can create a document library template (not the same as the templates we have been talking about so far) and set that as the default for new document libraries. At this point we are entering the realm of custom XML and possibly even code. But if you are administering a large SharePoint site, it may be worth entering that realm.

Nick Simons
Program Manager, Office Web Apps

24
Mar/10
0

Using Office Web Apps to Create New Files

This post is syndicated from Microsoft Office Web Apps.

Office Web Apps can be installed as part of a SharePoint deployment. Also, Office Web Apps will be available on Windows Live SkyDrive. One difference between Office Web Apps in these two environments is how you create new files.

Creating Files on SkyDrive

On SkyDrive you will be able to create a new document, workbook, presentation or OneNote notebook using the Office Web Apps. The UI looks like this…

clip_image001

When you create a new file using this UI the file will open in the appropriate Office Web App. SkyDrive uses a simple blank template to create these new files.

Of course you can also upload files to SkyDrive and edit them in Office Web Apps. And if you have Office 2010, you will be able to save files from applications such as Word and PowerPoint directly to SkyDrive.

Creating Files on SharePoint

In SharePoint, if you have Office installed on your machine, the new file experience will always use the appropriate Office desktop client. It will not use Office Web Apps. However, if you don’t have Office on your desktop, SharePoint will use the appropriate Office Web App (if it is available) to create a new file.

Office Web Apps can only create new files based on Office Open XML file formats (e.g., .docx or .xlsx) and the OneNote 2010 file format. When Office Web Apps create new Word, PowerPoint and Excel files, the template must be compatible with the web app. All the templates that ship with SharePoint are compatible with Office Web Apps. The OneNote Web App is a bit different – it will always create a blank OneNote 2010 notebook.

I want to say a little bit more about customizing the new file experience in SharePoint. Please note that this applies to the Office desktop clients as well as Office Web Apps.

The default SharePoint UI for creating new files in a document library looks like this…

clip_image002

By default you will be offered the ability to create a new Word document. This document is based on a blank default Word template. However, this UI is customizable.

When you create a new document library, you are presented with the option of selecting a document template. These templates include the file types that are supported by Office Web apps. That UI looks like this…

clip_image003

The templates that you choose in this UI are still the default blank templates; however, in the Advanced Settings of a document library you can change the documents template to be just about any file you want. For example, you can use a template that contains custom fonts, boilerplate text, or a company logo. The UI to select a custom template looks like this…

clip_image004

By default, each document library only supports a single template. In many cases that’s all that you will need and you can stop now.

Still reading? Okay. If you want to create both PowerPoint and Word files in the same document library, for example, you will need to associate multiple templates with that library.

SharePoint allows you to associate multiple templates with a document library using a feature called Content Types. If you followed the jump, you saw that Content Types do a lot more than simply allow multiple templates in the same document library. But right now I am only going to talk about that.

To use Content Types you will need to…

  1. Create a content type
  2. Turn on Content Types in your document library
  3. Add your custom content type to your document library

Now here’s how to do this.

To begin you will need to create a content type for each type of file you want. To do this, go to Site Settings and select Site Content Types. Click Create. Give your content type a name (such as My Word Document). Set the Parent Content Type to Document from the list of Document Content Types. On the Advanced Settings page for the content type, select the template you want to use.

Once this is done turn on Content Types in your document library. You can do this in Document Library Settings>Advanced Settings.

Now return to Document Library Settings. In the Content Types section select Add from existing site content types. From here you should be able to select your custom content type.

If you want to set up your whole SharePoint site to use the same set of content types in every new documents library, you can create a document library template (not the same as the templates we have been talking about so far) and set that as the default for new document libraries. At this point we are entering the realm of custom XML and possibly even code. But if you are administering a large SharePoint site, it may be worth entering that realm.

Nick Simons
Program Manager, Office Web Apps

8
Mar/10
0

Beta testing + Happiness = (Office comic)

This post is syndicated from Office Comics.

Today’s Office comic was inspired by the news that we are on schedule to release Office 2010 to manufacturing (RTM) in April, and that businesses can upgrade to Office 2010 on  May 12.
                                                                                         
Semi-random tip:  Starting on March 5, if you buy Office 2007, you can upgrade to Office 2010 for free.

-- David Salaguinto
To learn more about Office, visit
Office.com.