Click here to learn
about this Sponsor:
Home  |  News  |  Articles  |  Polls  |  Forum  |  Directory

Keywords: Match:
Tetris comes to .NET Micro Framework
Jan. 30, 2008

Microsoft field engineer Pavel Bansky has written a .NET Micro Framework version of the classic Tetris video game that's being hailed as "amazing." Created and tested using a ARM-based development kit, its source code is freely downloadable and can be run via an emulator, Bansky says.

(Click here for a larger view of Tetris for .NET MF)

In a blog posting, Windows Embedded software architect Microsoft software architect Mike Hall recalls his own creation last year of .NET MF Invaders, a .NET Micro Framework (.NET MF) version of Space Invaders he created as a demonstration of what can be done using the .NET MF 2.0 software development kit. Calling that game "relatively cool, [but] no bases, no mother ship," Hall now points readers to Blansky's "amazing implementation of Tetris."

Bansky writes on his own blog, "Tetris looks a bit old-fashioned on new computers with all the bells and whistles, but this led me to the idea of writing Tetris for .NET MF. It is a cool sample application and discovery of Windows Presentation Foundation (WPF) possibilities."

The code for the Tetris application (pictured above) has two namespaces, GameLogic and Presentation, according to Bansky. The GameLogic namespace, containing all classes for the core game, could be easily ported to .NET Compact Framework or the full .NET Framework, because the classes have no direct relation to .NET MF. The Presentation namespace, on the other hand, consists of WPF controls and windows that visualize the game and provide interaction with the user, he adds.

"The biggest glitch with writing Tetris was the fact that Micro Framework supports only one-dimensional arrays. Since Tetris is about a grid with falling blocks, the two dimensional arrays are quite essential," says Bansky. As explained on the blog posting, he got around this by writing a ByteMatrix class that manages to represent a two-dimensional byte array while storing values in a one-dimensional array internally.

Bansky quips, "I've never liked those games that forget the high score table." Since .NET MF has good support for object persistence, the Tetris game is designed to save high scores to flash memory, he adds.


Tetris for .NET MF
Source: Pavel Bansky
(click to play)

Tetris for .NET MF is shown in the video above running on EmbeddedFusion's Tahoe Development Kit, used to create and test the game, according to Bansky. The kit uses EmbeddedFusion's Meridian CPU module, which in turn is based on the Freescale i.MXS processor, an ARM920T derivative. It includes 8MB of RAM and 2MB of flash, along with the 2.7-inch LCD shown.

The development kit includes nine hardware buttons to the right of the screen, some of which are seen in use in the video. Six lines of source code in the Tetris game map the Up, Down, Left, Right, and Select buttons to specific pins on the Meridian CPU, but that is the game's only platform-specific option, Bansky says. Since it requires no additional hardware, the game can be run using the Tahoe emulator EmbeddedFusion makes available as part of its SDK, he adds.

"The gauntlet has been thrown," Mike Hall writes. "Can you do one better than Pavel and write a version of some other game? If you do, then post a video online somewhere and send me a link."

.NET Micro Framework

Microsoft first released .NET Micro Framework (.NET MF) in 2006, aiming the low-end OS at wireless remote controls, watches, and other cost-sensitive devices with constrained processor and memory resources. The .NET MF grew out of Microsoft's Smart Personal Objects Technology (SPOT) initiative, with embryonic versions variously dubbed .NET Embedded and TinyCLR.

According to Microsoft, .NET MF supports low-end embedded processors and doesn't require an MMU (memory management unit). A typical runtime image is only about 300 KB in size, the company says.

Microsoft released .NET MF version 2.0 in February 2007, and .NET MF 2.0, Service Pack 1 in September. However, these releases still did not include a native TCP/IP stack, which was listed as "coming soon." Therefore, networking a .NET MF device has required calling through to an underlying operating system with sockets support, according to the company.

Version 2.5 of .NET MF, which Microsoft has promised to release in "early 2008," will now offer a stack that is available even when running directly on the hardware. Device makers need only provide a driver for the network interface. This will result in a wider selection of network-capable hardware development platforms for developers to choose from, Microsoft says.

The company adds that the new version of .NET MF will also include client and server support for Web Services on Devices, also known as Device Profile for Web Services (DPWS). Already part of Windows Vista and Windows CE 6.0 Release 2, this "enables a USB-like level of plug-and-play for networked devices," in the company's words. DPWS-enabled devices on a network can discover one another, then invoke the functionality each device provides.

Further information

To read more about Tetris for .NET MF and obtain its source code, if desired, see Pavel Bansky's blog, here. To obtain the EmbeddedFusion SDK, including emulator, visit the company's website, here. To read Mike Hall's posting about the game, see his blog, here.



Related stories:


(Click here for further information)


7 Advantages of D2D Backup
For decades, tape has been the backup medium of choice. But, now, disk-to-disk (D2D) backup is gaining in favor. Learn why you should make the move in this whitepaper.

4 Legal Reasons to Control Internet Access
The Internet is obviously a valuable resource for many organizations. However, many are exposed to legal liability concerns because they fail to control Internet access. Learn if you're safe in this white paper.

Rapidly Resolve J2EE Application Problems
Whether you are in the process of building J2EE applications or have J2EE applications already running in production, you must ensure that they deliver the expected ROI. Learn how in this white paper.

Load Testing 2.0 for Web 2.0
There are many unknowns in stress testing Web 2.0 applications. Find out how to test the performance of Web 2.0 in this white paper.

Build Better Games Online
For the game infrastructure providers, life is complex. Making money from games has become more complicated. Why? Find out in this white paper.

Building a Virtual Infrastructure from Servers to Storage
This white paper discusses the virtual storage solutions that reduce cost, increase storage utilization, and address the challenges of backing up and restoring Server environments.

Gaining Faster Wireless Connections with WiMAX
Welcome to what is quickly becoming the hyperconnected world where anything that would benefit from being connected to the network will be connected. Learn more in this white paper.

Is Your Desktop a Security Threat?
The new wave of sophisticated crimeware not only targets specific companies, but also targets desktops and laptops as backdoor entryways into those business’ operations and resources. Learn how to stay safe in this white paper.

Increasing SAN Reliability by 100 Percent
Storage area networks (SAN) are a strong part of storage plans. Learn how to increase your reliability and uptime by 100 percent in this case study.

 


Got a HOT tip?   please tell us!
Free weekly newsletter
Enter your email...
Click here for a profile of each sponsor:
PLATINUM SPONSORS
(Become a sponsor)

ADVERTISEMENT
(Advertise here)


Check out the latest Windows-powered...

mobile phones!

other cool
gadgets

HOT TOPICS
Microsoft targets PNDs with new embedded OS
Microsoft tips .NET MF 3.0 highlights
Microsoft previews Windows Embedded Standard
Microsoft offers free Windows CE 6.0 textbook
Microsoft renames embedded operating systems
Microsoft unveils Windows Mobile 6.1
New Atom models target low-cost PCs
REFERENCE GUIDES
Windows Device Showcase
Intro to Windows Embedded
Intro to Shared Source
Real-time Windows Embedded
Windows Embedded books
Join our Windows Embedded discussion forums:
Windows XP Embedded
Windows CE
Windows Mobile


Windows Embedded developer newsgroups
Windows CE
XP Embedded
PocketPC
Smartphone

Microsoft's Windows Embedded resources
Embedded dev center
Mobile dev center
Windows CE tutorials
XP Embedded tutorials
Windows Embedded seminars
Windows Embedded application categories
3rd-party partners


BREAKING NEWS

• Upated JVM supports Windows CE
• Windows Mobile 6.1 phone has GPS
• Windows CE thin client hides in wall sockets
• Portable spectrum analyzer runs Windows CE
• VoIP client gains add-ons, API
• Windows Mobile phone has dual active SIMs
• Access gives away Windows Mobile utilities
• Intel's Atom powers mini-ITX board
• Microsoft revamps Windows Mobile website
• Low-cost phone bundles IM client
• Pico-ITX board bears twins
• Microsoft details finalists in student competition
• Intrinsyc revs Windows CE-based software platform
• $300 mini-laptop runs Windows CE
• Microsoft releases server virtualization technology


MOST POPULAR (last 90 days)
Windows Mobile 6 SDKs available for download
Guide to HTC's Windows Mobile smartphone platforms
Microsoft unveils Windows Mobile 6.1
HTC announces unlocked Windows Mobile 6.1 phone
UMPC squeezes in optical drive
Running Windows Mobile 6.1 on your desktop computer
Microsoft releases Windows XP Service Pack 3
Mobile Firefox gets speedup, design tweaks
MOST POPULAR (Classics from the vault)
The Windows Mobile Phones Showcase
Windows XP Embedded USB boot
Troubleshooting Windows XPe's blue screen "Stop 0x0000007B" error
Asus reveals $190 mini notebook
HTC adds GPS to Windows Mobile Touch line
Windows Mobile VPN client plays with Cisco
Guide to HTC's Windows Mobile smartphone platforms
Customizing Windows XP Embedded thin clients
The Windows Mobile Pocket PCs Showcase

Also visit our sister sites:


Sign up for WindowsForDevices.com's...

news feed

Home  |  News  |  Articles  |  Polls  |  Forum  |  Directory  |  About  |  Contact
 

Ziff Davis Enterprise Home | Contact Us | Advertise | Link to Us | Reprints | Magazine Subscriptions | Newsletters
Tech RSS Feeds | White Papers | ROI Calculators | Tech Podcasts | Tech Video | VARs | Channel News

Baseline | Careers | Channel Insider | CIO Insight | DesktopLinux | DeviceForge | DevSource | eSeminars |
eWEEK | Enterprise Network Security | LinuxDevices | Linux Watch | Microsoft Watch | Mid-market | Networking | PDF Zone |
Publish | Security IT Hub | Strategic Partner | Web Buyer's Guide | Windows for Devices

Developer Shed | Dev Shed | ASP Free | Dev Articles | Dev Hardware | SEO Chat | Tutorialized | Scripts |
Code Walkers | Web Hosters | Dev Mechanic | Dev Archives | igrep

Use of this site is governed by our Terms of Service and Privacy Policy. Except where otherwise specified, the contents of this site are copyright © 1999-2008 Ziff Davis Enterprise Holdings Inc. All Rights Reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis Enterprise is prohibited. Windows is a trademark or registered trademark of Microsoft Corporation in the United States and/or other countries and is used by WindowsForDevices under license from owner. All other marks are the property of their respective owners. WindowsForDevices is an independent publication not affiliated with Microsoft Corporation.