Scorched “Earf” XESS A Term Project Submitted In Partial Fulfillment Of W4840 Embedded Systems Design Spring 2005 Jeremy Chou Michael Brian Sumulong Dennis M. Chua {jc2465, mbs2114, dc2036}@columbia.eduW4840 Embedded Systems Design SP05 Scorched “Earf” XESS Page 2 of 64 Introduction......................................................................................................................... 3 Game Interface.................................................................................................................... 4 Summary of Project Development ...................................................................................... 5 Scorched “Earf” XESS Components .................................................................................. 6 Game Logic..................................................................................................................... 6 Video Controller ............................................................................................................. 8 Character Font Controller ............................................................................................... 8 Memory Controller ....................................................................................................... 10 Sprite Generation .......................................................................................................... 10 Gradient Background.................................................................................................... 12 Terrain Generation........................................................................................................ 13 Lessons Learned & Advice for Future Students ............................................................... 16 Jeremy Chou ................................................................................................................. 16 Michael Sumulong........................................................................................................ 16 Dennis M. Chua ............................................................................................................ 17 Relevant Source Code....................................................................................................... 19 Appendix ........................................................................................................................... 59W4840 Embedded Systems Design SP05 Scorched “Earf” XESS Page 3 of 64 Introduction Scorched Earth is a DOS console game belonging to the artillery game genre. It is a turn-based game for two players in which each controls a tank and attempts to destroy the other with ballistic projectiles. By setting the firing angle and the initial velocity of the projectile, the players alternately launch artillery at each other. Random weather, plus the irregular terrain of the game field adds challenge to the game. In this project, we took what we learned in W4840 to implement Scorched Earth on the XESS XSB-300E board. Working over a month and a half, we developed and tested VHDL and C code to manipulate the VGA display component of the board. Being a small team of three, we accomplished a fair amount of coding, testing and debugging on the XESS board. This report documents our experience and explains how we worked to make this project a success. Links to Prof. Stephen Edward’s W4840 Embedded Systems Design Spring 2005 class: http://www1.cs.columbia.edu/~sedwards/classes/2005/4840/index.html Links to the Scorched Earth DOS game: http://www.mobygames.com/game/shots/gameId,402/ http://www.abandonia.com/game.php?ID=70 http://www.classicgaming.com/rotw/scorch.shtml http://www.download-free-games.com/war_game_download/scorched_Earth.htmW4840 Embedded Systems Design SP05 Scorched “Earf” XESS Page 4 of 64 Game Interface Controls for the Red Tank Press A to increase angle Press D to decrease angle Press W to increase power Press S to decrease power Controls for the Blue Tank Press L to increase angle Press J to decrease angle Press I to increase power Press K to decrease power Press SPACEBAR to fire cannonball Press TAB to turn wind factor ON/OFFW4840 Embedded Systems Design SP05 Scorched “Earf” XESS Page 5 of 64 Summary of Project Development The development of the project was split into two distinct phases. In the initial phase, we developed a prototype of the game based mainly on software, using lab 5 - 2004 as a base for our code. Lab 5 - 2004 had all the elements to develop a prototype game relatively quickly. It included components such as a video buffer and an SRAM memory controller. The video buffer allowed us to control the color of every single pixel through software. The SRAM memory controller enabled us to develop large C programs without worrying about the constraints of the limited BRAM available. Eventually, we merged part of lab 2 - 2005 code into the lab 5 code to get text to display on the screen. We completed the initial phase by demonstrating the prototype game play during our 75% demo. The second phase required us to develop almost all graphics in hardware while keeping the game logic and calculations in software. We initially used lab 2 - 2005 as a base for our code but later realized that the compiled C code would not fit on the 4096 bits of BRAM that was available to us. This was due to the use of floating point numbers in some of our calculations. We had to make a decision between not using floating point numbers or finding a larger memory space for our program and we chose the latter. Lab 5 - 2004 already had the functionality to allow the program to be stored in the SRAM and therefore seemed to be the more feasible choice as 4KB of memory gives us very little elbow room. There was a slight problem with the number of BRAMs being used initially in lab 5 - 2005 as we kept getting over the 16 BRAM limit. After talking to Marcio and Prof. Edwards, we found out that there is an instruction cache used by the Microblaze processor to speed up execution. This cache took up 5 BRAMS and we immediately disabled them by going into the .mhs file. This roadblock was surpassed and we were able to put in the terrain data, sprite bitmaps, font bitmaps, and character buffer in the free BRAMs.W4840 Embedded Systems Design SP05 Scorched “Earf” XESS Page 6 of 64 Scorched “Earf” XESS Components Game Logic Main Program LoopW4840 Embedded Systems
View Full Document