Learn to Code - Build a Game

Learn to Code - Build a Game

TalkIT January 2016 Newsletter

 

Contents

Learn to Code

How to Create the Game

Architecture First

Basic Project Setup

Can You Solve This Coding Problem?

Other Bits

Learn to Code - Build a Game

Welcome to the latest news from TalkIT. This issue is about learning to code by creating a game application. TalkIT have published an online game tutorial using Java. The tutorial is the conclusion of our Java online course. It provides an opportunity to consolidate the skills covered in the course. Take a look at our Java Course. The first tutorial is a free trial.

By focusing on building the game, you learn the rules and grammar of the programming language as a by-product. Creating a game is fun. You get an interesting result.

 To make learning easier the tutorial includes videos, solution downloads and lots of code snippets. This is the video that gets you started.

Be warned building the whole game can take more than 10 hours. It includes some advanced skills.

How to Create the Game

The game, Dungeon of Doom, allows players to move around a dungeon collecting points.

  1. The idea of the game:
    • Players are spawned in a darkened dungeon
    • They can only see so much of the map and the rest is dark and not visible
    • The aim is to collect a certain amount of gold laying in the map
    • Then make it to the exit before another player or without dying
    • You can pick-up items that can help you along the way such as lanterns and swords
    • It is a turn based game, meaning you have to be strategic
  2. The components of the game:
    • Multi-player
    • Chat System
    • Graphical UI
  3. The game has many parts but is easily extensible. You can fight in the game and kill opponents. You can run an AI bot on and off-line which I have partially implemented. This will allow you to test your skills but have support.
  4. The Rules of the game:
    • Each player starts off with 6 APs (Action Points) which dictates how many things they can do in one turn (this can change depending on items they hold).

 To read more about the game see the online tutorial.

 Architecture First

When creating any complex application it is a good idea to first think about its architecture. From experience, I can say it is best to invest time at working on the initial design. This avoids refactoring most of your code to add a new feature.

 The game uses the Model View Controller (MVC) architecture.

 The components of the MVC are:

  • Model: manages business logic classes and data access
  • View: renders model objects with client-slide intelligence
  • Controller: Handles incoming requests then chooses a view to render

Some of the benefits of using MVC are that MVC encourages separation of presentation and application logic. The model classes hold the application logic. These are reusable and consistent.

 The game has many similar items that the users can pickup. Hence it would be useful to employ inheritance for game items. Best to create an item base class. Specific items will then inherit from this but modify it to their needs. This will save re-writing code and will also help with maintenance and upgrades.

 With the above in mind I have created a diagram that should help explain the structure. We want keep classes as separated and self-contained as possible. Also use inter-class communication only when it is needed.

Read the whole blog.

 Thanks to Steven Paske for creating the game and writing the tutorial

Thanks to Andy Olsen for Java snippet

Photos www.freedigitalphotos.net/

David Ringsell MCPD 2016 ?

要查看或添加评论,请登录

David Ringsell的更多文章

  • 5 Top Web Development Trends

    5 Top Web Development Trends

    What to watch in the web world this year? If you want to know more take at look at our blog on the 5 Top Languages in…

  • How to Secure Your Data?

    How to Secure Your Data?

    Welcome to the latest news from TalkIT. This issue looks at designing a database security plan.

  • What are the top 5 programming languages for 2017?

    What are the top 5 programming languages for 2017?

    Welcome to the latest news from TalkIT. What are the top 5 programming languages for 2017? This follows on from the…

    2 条评论
  • What makes a good course?

    What makes a good course?

    What makes a good course? How to learn effectively? Why do courses fail? Welcome to the latest news from TalkIT. This…

  • How to reach the audience for your services?

    How to reach the audience for your services?

    Welcome to the latest news from TalkIT. This month’s is about digital marketing.

  • How can TalkIT help you become more employable?

    How can TalkIT help you become more employable?

    TalkIT April 2016 Newsletter How can TalkIT help you become more employable? Welcome to the latest issue from TalkIT…

  • Latest news from TalkIT

    Latest news from TalkIT

    Welcome to the latest news from TalkIT. November has been a busy month for us.

  • Women in Coding

    Women in Coding

    TalkIT February 2016 Newsletter Welcome to the latest news from TalkIT. This issue explores the theme of women in…

社区洞察

其他会员也浏览了