Archive

Archive for November, 2013

Lab[3] = Make Some Noise

November 19, 2013 9 comments

Note: If you tried this lab on or before 8/29/2013, there was an error in the original code. Please download the code again.

Objective

  • Run the Jaalaga starting code on a device
  • Pick different sounds
  • Update the credits screen if you use different sounds

What You Will Need

Lab Version

  • Version 0.3

Prerequisite

In Lab[0] we setup a development environment. Our development environment at this point includes several software tools, the AndEngine source code and our Android or Kindle Device. Among the code was a project with a wide variety of AndEngine examples. You should have reached a point where you ran these examples on your device. If you did not reach this point you should get Lab[0] working before tackling this lab because it requires a working AndEngine setup.

Introduction

In this lab we take what we accomplished in lab[2] and add some excitement with some sounds. Audio is an important element to a game because it can is another way to convey to the player what is going on in the game world. Tense music and sound effects can add an extra level of challenge to any game. In the interest of keeping these labs shorts, we will focus our audio efforts on replacing existing sounds.

Steps

Run the Starting Code for Lab 3

First you will need to get the starting code from Git Hub at the link described above. Add this project to your working setup from Lab[0]. Note, if you changed the graphics in the previous labs, you can update just the “src” folder and the “assets/sounds” folder.  Compile and run the code. You should now hear sounds when a missile is fired or when a missile collides with an enemy. If you are happy with the sounds, you are done!

Update the Sounds

The source code for this lab and future labs will be marked with comments that have TODO at the beginning. This lab has x such comments

Original Sounds

The player missile fire sound is a creative commons attribution sound. Therefore the sound shows up in the credits. Here is the original sound: http://www.freesound.org/people/bubaproducer/sounds/151022/ This file is saved as playerFire.mp3 and is stored in /assets/sound/

The collision sound is another creative commons attribution sound. It is also listed on the credits scene. The original sound can be found here: http://www.freesound.org/people/Robinhood76/sounds/187647/  This file is saved as enemyExplosion.mp3 and is stored in /assets/sound/

Replace Sounds

If you want to use different sounds, replace the mp3 files mentioned above to a file with a different sound. Make sure they are fairly short because the audio pool is a small, finite size. If you load a sound that is too big to fit into memory, AndEngine will simply not play the sound.

Update the Credits

See the new file JaalagaCredits.java for code that displays the credits screen. When using sound from FreeSound.org, or any source, you should comply with the license terms. Attribute means give the author credit. Non-commercial means you can’t use the sound if you intend to publish an app for profit. Honoring license terms is the right thing to do as a content creator. If you can’t or don’t want to comply with the license terms, simply don’t use the work.

Lab[2] = Make it Collide

November 12, 2013 Leave a comment

Objective

  • Run the Jaalaga starting code on a device
  • Detect collisions between missiles and enemies
  • Establish good values for the ship’s speed and missile speed with the expanded game loop
  • Pick better sprites for the enemy ships

What You Will Need

Lab Version

  • Version 0.5

Prerequisite

In Lab[0] we setup a development environment. Our development environment at this point includes several software tools, the AndEngine source code and our Android or Kindle Device. Among the code was a project with a wide variety of AndEngine examples. You should have reached a point where you ran these examples on your device. If you did not reach this point you should get Lab[0] working before tackling this lab because it requires a working AndEngine setup.

Introduction

In this lab we move beyond what we learned in Lab[1]. A new red button has been added that causes ‘missiles’ to fire from the player’s ship to the newly added enemies. Some basic collision detection has already been added to the code restricting the ships movement to the camera bounds. What is missing right now is the collision detection between the player’s missiles and the enemy ships.

The image below displays the type of thing you should see when first running the code for this lab.

Screenshot_2013-11-11-00-00-08

Steps

Run the Starting Code for Lab 2

First you will need to get the starting code from Git Hub at the link described above. Add this project to your working setup from Lab[0]. Note, if you changed the ship sprite by finishing the last lab, you can update just the “src” folder and the “AndroidManifest.xml” file.  Compile and run the code and you should see something like the screen above.

Examine TODO Items

The source code for this lab and future labs will be marked with comments that have TODO at the beginning. This lab has six such comments

lab_2_todo

Collision Detection for Missiles and Enemy Ships

First, as be sure that you have tried to shoot a ship. What happens? A less than interesting  event happens as the graphic for the missile travels right over the enemy sprite. For this part of the lab will actually try to write some code. Step by step instructions will be given, so don’t panic.

The general algorithm, or approach to solving a problem, we will implement is as follows:

For each missile, iterate over every enemy ship and determine if a collision has occurred. When a collision has occurred, remove both the missile and enemy from the screen.

The procedure above is represented in the flow chart below. Note that this flow also includes hiding rockets that have left the screen. The code you need to add to accomplish this flow is provided below.

lab_2_procedure

lab_2_code

You should add the code above to your project and run the game to see that missile impacts now cause the enemy ships to disappear. Some notes on the code above:

  • A “for loop” is a way to do things in a repeated fashion. It is of the form “for( initial value; condition; end of loop action)”. The normal practice is for loops to count upwards, but this loop is a specific scenario where we may need to remove items and we don’t want to lose our place.
    1. We set the variable j to the last item in the enemies list
    2. We check to see if j is greater than or equal to zero. In other words we check to see that if we have more enemies.
    3. If we still have an enemy, we we execute all instructions in the loop, else we exit
    4. At the end of the loop we reduce the value of j so we can access the next enemy
    5. Return to step 2
  • The recycle call in theory should return the object used for the missile to the pool to be reused. This is because making too many objects can slow down your program as “garbage” builds up and must be cleaned up. That is the theory, but in reality there is a bug in the RocketPool right now that means that the recycling/reuse is not happening. Expect this to be fixed in the next lab.
  • You effectively “remove” something from the screen by hiding it and turning off updates.

Change Ship and Missile Speed

At this point, you may be saying, “I already did that in lab 1!” The need to repeat the exercise is three fold.

  1. The code changed in a fairly dramatic fashion. We could have had a lesson on using a difference tool, but I figured you did not have the time or interest.
  2. The game loop has now grown and the old values may no longer work well.
  3. Repetition strengthens neural pathways

Change Sprites

Something as simple as MS Paint can be used to change graphics. You can also use more advanced image editing software like GIMP (http://www.gimp.org/)

  • /assets/gfx/button01.png (Width: 512 px, Height: 64 px)
    • Normal and pressed graphic
  • /assets/gfx/menu/logo.png (Width: 240 px, Height: 240 px)
  • /assets/gfx/game/ship.png (Width: 64 px, Height 64 px)
  • /assets/gfx/game/enemy1.png (Width: 32px, Height: 32px)
  • /assets/gfx/game/enemy2.png (Width: 32px, Height: 32px)
  • /assets/gfx/game/enemy3.png (Width: 32px, Height: 32px)
  • /assets/gfx/game/playerRocket.png (Width: 5px, Height: 15px)

HGTTG[6] = Chapters 31 – 35

November 12, 2013 Leave a comment

Comprehension Questions

  • Chapter 31

    • What are the names of the mice?
    • What is the structure of the question encoded in?
    • What was outside the door?
  • Chapter 32

    • What question did the mice come up with in place of the real question?
    • Who is after Zaphod?
    • What is the Kill-O-Zap gun?
  • Chapter 33

    • What happened to the police that were shooting at Ford and company?
  • Chapter 34

    • How fast is R17?
    • ho was outside of the police ship?
    • What happened to the police ship?
  • Chapter 35

    • Where is everyone heading?

Discussion

  • Survival, Inquiry, Sophistication. Does the human experience follow this pattern?

HGTTG[5] = Chapters 26 – 30

November 12, 2013 Leave a comment

Comprehension Questions

  • Chapter 26

    • What do you think the Sens-O-Tape record?
  • Chapter 27

    • What is the answer to life, the universe and everything?
  • Chapter 28
    • What will the replacement computer be?
  • Chapter 29

    • What did Ford, Trillian and Zaphod wake up on?
    • What happened when Ford and Zaphod were kids??
    • Who will see the three when the catalog ended?
  • Chapter 30

    • Who is Arthur sent to see?

Discussion

  • How is the recording Artur watched like augmented reality?
  • “Once you know what the question actually is, you’ll know what the answer means”. How does understanding the problem help you?
  • Th planet catalog immersed people into the world being advertised. What is the state of virtual reality technology?

HGTTG[4] = Chapters 21 – 25

November 11, 2013 Leave a comment

Comprehension Questions

  • Chapter 21

    • How many suns does Magrathea have?
    • How does Marvin feel about Earth’s beauty?
    • Who did Arthur meet?
  • Chapter 22

    • Is everyone on Magrathea dead?
    • What does Magrathea make?
    • What happens to Marvin?
    • Who is Slartibartfast?
  • Chapter 23

    • What happened to the dolphins?
    • What message did the doplins have for man?
  • Chapter 24

    • How fast was the air car moving?
    • What new personality did the ship take on?
    • What is the hyper space gateway like?
    • Where did Arthur and Slartibartfast travel to?
    • What special planet were the Magratheans making?
    • Who was furious at the Earth’s destruction?
    • Who has been experimenting on the people of earth?
    • How are mice explained?
  • Chapter 25

    • What was the computer like that was built to determine the meaning of the universe?
    • What answer are the programmers asking the computer to determine?
    • Who were the philosophers?
    • What concerns did the philosophers have?
    • What was Deep Thought’s response to their concerns?

Discussion

  • How is the Hitchhikers Guide to the Galaxy device like Wikipedia?
  • What is the “air car” like?
  • What type of voice interaction do we have with computers today?
  • What is the best (fastest, lowest power, etc.) computer we have today? What about 10 years ago? 20 years ago?
  • A competing super computer was called “Googleplex Star Thinker”, did Google exist when the book was written?

HGTTG[3] = Chapters 16 – 20

November 11, 2013 Leave a comment

Comprehension Questions

  • Chapter 16

    • What planet is the ship orbiting?
    • What did Magratheans manufacture in the past?
    • How is the planet defended?
  • Chapter 17
    • What is the Nutri-Matic
    • What is the recorded message telling the the visitors to do?
    • What were the controls like to manually control the ship?
    • What did Arthur do in response to the pending missile attack?
  • Chapter 18
    • What type of crazy things happened when the improbability drive was turned on again?
    • What happened to the missiles?
  • Chapter 19
    • What escaped from Trillian’s cabin?
    • What new personality did the ship take on?
  • Chapter 20

    • How did the passengers of the Heart of Gold gain access to the inside of the planet?
    • What type of things are in the ship’s medical bay?
    • What happened to Zaphod’s brain?
    • What initials were left for Zaphod to see?
    • What happened when the shutter closed?

Discussion

  • “The fact may safely be made the subject of suspense since it is of no significance whatsoever” As humans do we sometimes over dramatize things that don’t really matter?
  • Does anything like the Nutri-Matic exist today? What would it take to invest a device as elaborate as described in the book?
  • In the comical fall of the missile turned, whale it is mentioned that the whale was busy naming things. What type of terms have been invented during the 21st century?
  • What role does our subconscious mind play in problem solving? What role do dreams play in the human experience?

Technology Development Demo

November 6, 2013 Leave a comment

The Technology Development mentor class will end with a demo to local technology professionals.

The demo consists of three parts:

  • Service Project
  • The Hitchhiker’s Guide to the Galaxy
  • The Jaalaga Game or Khan Academy

Each group is expected to introduce all members of the group. Each Individual should share their name and grade to help the visiting professionals understand the type of questions to ask. The professionals will be instructed to ask more questions of the older students. All information should be communicated using some type of visual aid.

Service Project

Each individual should briefly describe their act of service that “uses technology to improve and uplift those around you”. Information on each project should be included in the visual aid.

The Hitchhiker’s Guide to the Galaxy

As a group select one futuristic technology that is described in the book. For this single technology

  • Discuss how the book describes the technology
  • Discuss how similar technology appears in real life today

The discussion on the futuristic technology should be included in your visual aid.

The Jaalaga Game or Khan Academy

For the demo you have the option of working on the Android game or working through the Computer Science material at Khan Academy. The Android game is good because you can easily show your friends, family and future employers what you are working on. Khan Academy is good because the learning occurs in a more guided fashion and you only need a web browser to do the exercises. The demo element for each path has a slightly different demo approach.

The game route requires that you demonstrate on a device how far your group got with the Jaalaga game. Describe some of the things you learned and some of the things you had trouble with. Describe the contributions of each group member to the Game. Include this information in your visual aid.

The Khan Academy route involves explaining some of the code you wrote during the exercises. You should explain how your program(s) function, what they produced and any challenges faced while learning the material. Include this information in your visual aid.

Each group will receive feedback from the professionals on elements of their demo. Overall the demo will be a great opportunity to show what you have done and and network with active professionals in the technology field.

Tools of the Trade: Text Editors

November 1, 2013 Leave a comment

In this segment of Tools of the Trade, we will discuss the work horse of the software professional, the text editor. Every operating system comes with one or more options for for editing plain text. Plain text is different than rich text in the sense that the plain text files store just the text information on disk and do not store extra information such as formatting.

As with many other tools used by software professionals, text editors often invoke strong feelings akin to religious debates regarding which editor is best. This article does not seek to promote one solution over another, but it does seek to point out what a full featured text editor can do for you.

The first and most important rule when it comes to text editors is to heed the advice of the programming classic The Pragmatic Programmer:

Use a Single Editor Well

Features that you will grow to cherish:

  • Syntax highlighting – Add variation to what you see on your screen
  • Color schemes – Reduce eyestrain by switching to a color scheme that eases eye strain
  • A Variety of Search and Replace Options – Spend some time reworking a legacy code base or absorbing a large code base
  • Display Line Numbers – Code is already hard enough to describe to others, line numbers are invaluable when discussing technical details with others
  • Show White Space and Non Printable Characters – You don’t recognize how wonderful this is until you have to debug a carriage return line feed issue.
  • Support for Multiple Character Encodings – One thing you find out real quick when working with plain text is it is not always so plain and different operating systems and languages can throw a wrench in your plans.

With any tool, whether it be physical or software, it is important to try a few offerings and see what fits your work style and budget best. Keep in mind that plain text is perhaps as old as computing and there are a dizzying array of options for text editing.

Categories: Tools of the Trade

A Balanced Approach to Technology

November 1, 2013 Leave a comment

The technology development course does not have graded work, what it has instead is an all inclusive demo at the end of the course to select members of the technology industry. It is expected that students will put their best foot forward to work hard, achieve as much as they can and show their work to the world.

The technology development course has three main elements funneling into the final demo. The three elements are the service project, classic and game creation.

technology-development-course

The goal in all of this approach achieve a balance for our future technologist. All too often emphasis is placed on grinding on the specifics of a particular technology. While this type of practice and learning has value in some contexts, it neglects the need to develop more facets of the growing technologist. People that have an inclination for technology will always  find ways to naturally grow and thrive in this arena. It is the other subjects such as the liberal arts and the acquisition of soft skills such as communication and debate that go neglected.

The scholars that take technology development are told that programming and other technical skills are things that grow in importance to society and the economy when they are paired with knowledge from other disciplines. The model described above can actually be generalized to mean

Success = Character + Learning + Skills

success-in-life

Lab[1] = Make it Move

November 1, 2013 Leave a comment

11/8 Update: Significant rework since last revision

Objective

  • Run the Jaalaga starting code on a device
  • Restrict the ships movement to only left and right movement
  • Find a ship speed that that is good for the game
  • Replace the ship sprite with a better graphic

What You Will Need

Lab Version

  • Version 0.5

Prerequisite

In Lab[0] we setup a development environment. Our development environment at this point includes several software tools, the AndEngine source code and our Android or Kindle Device. Among the code was a project with a wide variety of AndEngine examples. You should have reached a point where you ran these examples on your device. If you did not reach this point you should get Lab[0] working before tackling this lab because it requires a working AndEngine setup.

Introduction

In this lab we will start to build our game. As we discussed in class, we will be building a game that is similar to the arcade classic Galaga. We can’t use the same name so we will just call our game “Jaalaga”. In Jaalaga you will be piloting a space ship and trying to eliminate the hostile aliens. You ship is fixed to the bottom row of the screen. Your ship can move left and right and can fire two shots at any time. Enemies move in formation and periodically break formation to dive at your ship. All ships are destroyed when they are hit by a missile or collide with another ship. In this lab we will focus of the movement of just the player’s ship.

The images below display the two screens we will see:

Screenshot_2013-11-08-02-26-11    Screenshot_2013-11-08-02-25-50

Steps

Run the Starting Code for the Game

First you will need to get the starting code from Git Hub at the link described above. Add this project to your working setup from Lab[0].  Compile and run the code and you should see the screens above.

Examine TODO Items

The source code for this lab and future labs will be marked with comments that have TODO at the beginning. This lab has three such comments

lab_1_todo

  • JaalagaResourceManager.java (Line 208)
  • ManagedGameScene.java (Line 122)
  • ManagedGameScene.java (Line 56)

After reading the comments, make changes to the code based on each TODO item. You may have to look up help on AndEngine functions to change the right thing. Feel free to make a guess and verify if your assumptions were correct. When you have completed the three TODO items you have completed Lab[1].