Mobile Devices Battleships Game

After getting full approval on my Mobile Battleships Game i will start work on making it. I will be updating my progress in the form of development diarys i aim to get the game completely finished with bluetooth play in 1 week. I have planned out the different phases each with milestones to hit. Keep checking back here as i will be updating on a daily basis.

Applied Game Development Week 8

With just one week to go until the alpha deadline we have been working nonstop to get all features in. After 3 or 4 weeks of going trying many different ways to get collision working with the artists bounding boxes Barry found out that it was his collision system that was at fault. He had based it off the Gamebryo sample that used a different collision system and this was the problem. He fixed collision so it now works with the artists bounding boxes. This week I worked again with Jamie to get a lap system working and a split lap time feature. The pickup system is also finished and working in game.

The biggest problem was getting the checkpoints working. We were using NiPoint3 to place the spheres to act as checkpoints. The first problem was where we placed the checkpoint was not where it actually was in coordinates. We finally figured it out it was the z and y was the wrong way round as y acted as the z for height. After this we got two checkpoints a start/end and a midpoint checkpoint due to time constraints we had to hard code it and use some simple maths to work out the ship colliding. This will be converted later on to work with the collision system and Nodes so the artists can place the pickups using Maya. This worked now and again but when I placed it in the new track for some reason it didn’t work we spent a few hours taking code out and working from a previous build that worked but we still have no idea why it wouldn’t collide with the midpoint check or how it fixed itself.

I worked a bit with Dom on solving the bullet deleting problem. Andy got sound implemented and we now have music playing. I also worked with Andy to set up the game to work in release mode this took longer than expected as the sound manager required lib files we hadn’t included in release. I added a frame rate to the HUD and when we got the new track in it was going at around 23 frames a second which was laggy and not acceptable. We think it’s to do with the ray trace down to work out hover it may be checking all polygons in the track. In release mode we were getting 100 frames a second which was impressive considering its 23 in debug. Dom has been working on a state manger and the replay system.

We have made some good progress this week it really helped getting the artists track in so we could see our game coming together. We also thought about USPs and came up with the idea of jumping and dodging. Making good use of Barry’s hovering code we will be making it a big part of the game. We came up with the idea of jumping to pickup powerups but at the same time you lose fuel for jumping. There will be bits on the track you need to jump over such as burnt out cars blocking half the track. At the start of the week I emailed around a document highlighting where we are at. It showed what was in the current build and what needed to be in the alpha build. I also addressed issues and concerns such as the AI, State based and the replay system. I will be doing the same for next week. We have worked well on getting everyones code together into builds we are on revision 106 and have gone through about 9 revision in the past week.

Applied Game Development Week 7

This week we got projectiles firing in game. This was great to see as we had a lot of troubles getting it to fire in the right direction. We have tiny XML working its loading profiles and weapon information in the form of unit testing. Barry got some basic AI working following nodes about the level. I spent most of Wednesday with the horrible task of merging two build together. I looked at SVNs merge function but it wouldn’t work properly. So i had to get an old build on one screen and the new build on the other and go line by line through the code looking for the differences. This shouldn’t have happened as we are meant to be working from the latest build in the weekly build folder I have stressed this to the team that this cannot happen again as it wastes too much time and sometimes doesn’t work. After last week’s talk about the level looking a bit primitive I got onto the artists and will have the new track hopefully loading in the next week. We are still stuck on the collision thing but the artists are going to sort it out for us.

Interactive 3D Graphics (DirectX) Week 7

This week I have been fixing my resource manager to work with meshes. To begin with I began passing in the mesh properties to the resource manager this was really inefficient and was a quick fix I didn’t like this way of doing it so I wrote a mesh class which would store the different properties of a mesh. Then for my resource manager I just needed to pass in a pointer to the mesh object.

This worked fine to begin with but I started getting memory leaks and problems with the lost and reset devices. I fixed the major problem of it crashing on lost device and got my memory leaks from 7 down to 2. The last two memory leaks took longer than I thought to track down. I ended up commenting out code and doing tests to see if they had gone. I found out by moving the window would cause the memory leaks to multiply by 2 this singled out the memory leak to being either the lost device or reset device. I eventually figured out it was because I was calculating and generating the bounding box every time the device would reset resulting in two new pointers. I moved these into the create method so they would only be called once and it fixed it.

Another big problem was minimizing the program would cause a crash which was caused by the mouse trying to acquire before the window had a focus. I tried rearranging my code but couldn’t get it work I found a forum where someone had the same problem and tried there solution which is to change the mouseCoopFlags from Foreground to Background this solved the problem. I made some other small fixes to my code and got rid of 5 warnings.
I have started to implement a bounding volume class which will help with collision and work with ray to box or sphere collision.

Interactive 3D Graphics (DirectX) Week 6

This week i got my Camera colliding with the terrain fixed. I have been having trouble with it for the past few weeks as it was nearly working and kept crashing. The problem was with the way i was working out my Get Height method the spacing was wrong and needed to be negated to turn the value into a positive. After changing these two lines it worked and i was able to simulate walking on the terrain.

As we are remaking “de blob” i have flattened my terrain out as i plan to put the streets and buildings in. I have been making a zombie class and a zombie state to get a zombie loaded into my game at the moment he just runs round in circles but i should be able to apply the camera get height to the zombie so he can collide and walk on the terrain. I have also made a ResourceManager class which will manage the textures and meshes loaded in. The advantages of using this is if i already have a texture loaded in i don’t need to waste memory by loading another copy in i can simply look in the std::map list for the texture name. At the moment it works fine for textures i am in the process or making it work for meshes as meshes work differently requiring a material to be stored. I have also made a WorldObjects class which lets me place zombies around my level it does this by taking the position and orientation and drawing it.

Console Development Semester 2 Week 6-7

For the past 2 weeks i have been preparing for the demo scene presentations. We were given the task to create a small demo in the language of C with restrictions to 4kb of  non-lib .data/.rodata. For this i wanted to recreate the game of life which i did in the first year in C# however i ended up creating a random graphics visualiser. I played about with the rand() function and got it drawing triangles, grid lines and stars all completely random. I then made the triangles 3D and got them rotating on different axis depending on the method called by the random number. The triangles also scale up and down and change colours at different times. Most of what i had created came from trial and error of trying to make the game of life. I will get some screen captures of my demo running and post them here. We showed off our creations and got marked in different categories. I came second for the best graphics which was great considering other people had some colourful demos. I also won the smallest file size with my demo being just half a kilobyte. After the demo scene we were given our assignment which is a real demo scene with some more restrictions we are now assessed on what we make and have a 1kb limit and It has to run at 30 frames a second.

Applied Game Development Week 6

This week we looked at different Design Paterns. A design pattern is a certain way of solving a problem that we expereince over time. They get refined over time and become a standard approach.In Object Orientated programming there is 3 main categories:

Creational – These relate to creating instances of classes

Structural – These relate to the relationship between Classes or Objects

Behavioural – these relate to communication between classes or objects

Singleton – This is a creational pattern which is often used. It is used to make a class global and to make it have only one instance. A typical example would be a keyboard input class for a game.

Facade – This provides an easy to user interface which wraps up functionality from other classes. Provides flexibility and makes the code more easy to read.

This week we were supposed to have frontier come down on the Wednesday to look at our games unfortunately they couldn’t make it so we got feedback off other lecturers. This went really well for my group we got lots of feedback and left a good impression. We had a lecturer from the computer games modelling and animation course come and see how the art was being used in our game and asked us a few questions about the design and look of the game. On the technical side of things we were asked about how the physics would work and a few questions on collision. This week we managed to implment hovering on the car, collision working in the test level,Projectile class and some scripting.

Mobile Devices Week 6

This week i looked at different types of connection. We were given tasks to have a go at retrieving data from the university website. After getting this working there was a task of reading a text file which contained 2 different URLs to do this i needed to read the text file and store it in a list so the user could chose which file to retrieve. The contents of the text file was split up by a ‘,’ delimiter character. I looked for a read line method but to my amazement couldn’t find one in the language so i found the sun forums had a topic about making a readline method. I set up a method to read a line and it worked.

The Generic Connection Framework (GCF)

This is contained in the javax.microedition.io package. The connector class is an interface for connection you pass in a connection string and get back an implementation of connection. The connection string is similar to a URL. HTTP is all about requests and responses you would send a request to a server and it would return a response back. If you want to use a HTTP connection you need to use MIDP 2.0 and pass in a HTTP URL to the connector this will return the implementation of a http connection. To retrieve a file you pass a URL to the open() method, cast it into the connection type you want to use so HttpConnection, Read the data and close the connection.

Wireless Messaging API (WMA)

The WMA is built on top of the Generic Connection Framework. Using the Connector.open method with a connection string set out like “sms://phonenumber:port” you receive a MessageConnection. Ports are used for the SMS service between phones. If you send a message without specifying a port it will go to the default inbox on the target device. J2ME application cant be wrote to listen on the default port. The basic steps to sending a text sms message are:

  • Open a connection using Connector.open
  • Create a new empty message using newMessage returning an object of type TextMessage
  • Use the method setPayloadText to put the message inside the TextMessage
  • Send the message using the send method

There are two main ways to recieve a message using Message Connection.

Blocking receive() – This method waits for the message and processes it when it arrives. GetAddress tells you where the message came from. getPayloadText gives you the actual text message in a string.

Non-Blocking receive() – This method uses the MessageListener interface. You register a listener using setMessageListener. When the message arrives the method notifyIncomingMessage is called. You receive the message in a separate thread.

Interactive 3D Graphics (DirectX) Week 5

This week i have been looking at rays and there uses. A ray is used to find all sorts of information in the scene. It gets cast in with a start point and a direction and intersects with objects or meshes in the scene and provides information such as hit count, distance and normal. It is most commonly used in games for the bullets hitting targets or to work out collision with the heightmap you would cast a ray down. It can be used in complex ways such as AI path finding by casting rays on objects or to check if the AI can see the player. I managed to implement my ray methods using the DirectX sample picking. it shows which triangle i select when i click on my terrain mesh. I also added a grass texture to the terrain to make it look better this was just one line of code as i had already set up texture support. We got the assignment this week which is to recreate the game “De Blob” this came as quite a shock to everyone as compared to last years simpler assignment this is going to be a very hard challenge.

Mobile Devices Week 5

This week we looked at the MIDP Record Store. This allows you to store persistent data such as High score tables. The role of the record store is to store multiple records even after the midlet has been destroyed. It even keeps the data when the device has been restarted or the battery has been replaced. Midlets cant see the location of the record stores. The record stores are identified uniquely by their names. The record store is an array of bytes. record stores can be accessed by multiple threads at the same time so need to careful to change the data.

The RecordStore class helps to modify the record store and work with the records. OpenRecordStore() method is used to open the store for editing. To work through the stores you need to use enumerateRecords this returns an enumerator to allow you to search record by record using nextRecord method.