The City has Roads

The city has made some progression. I spent far too much time trying to create some building textures, but didn’t really create any decent textures so I have decided to leave the buildings how they are for now. The city now has a road and a gradient skybox. The floor texture is just generated using the 2D array that contains the world data.

I have read a lot on different implementations on city generation from using grid plans, l-systems to voronoi diagrams. The task at the moment is to try and improve the current version as much as possible and then document the effect those improvements have had in optimisation or realism.

Networking Pac-Man

For the Networking module, a multiplayer networked game is required (obviously). I decided to make a variation of Pac-Man in Java. Each player starts as a Pac-Man and the aim is to reach 500 points before anyone else. Points are awarded for eating pills and eating opponents, by getting a power pill. If you do eat an opponent they will change into a ghost. Ghosts are able to gain points by touching normal Pac-mans (Pac-mans without a power pill). In doing so, the ghost will turn that Pac-Man into a ghost (sort of like Zombies). Ghosts can return to a Pac-Man state by eating a power pill!

Continue Reading →

Texture and Cars

The next step was to create a texture for the buildings. I haven’t had much experience in DirectX generating textures in code, so to begin with I have decided to create a 512 × 512 texture with some windows (a load of squares).

Now that I have some experience of creating textures in code, I should be able to create more realistic building textures and hopefully add more variety. I then marked the roads in the scene’s 2D array I created, marking them with the directions the car would go in (North, East, South or West). I then spammed the roads with a load of red or yellow cars (quads) on these roads and moved them around in the scene. At the moment when they go out of the scene, they simply loop back to the other side.

You can see the result at the moment in the above screenshot. Obviously I need to make the scene more realistic by adding lights, improving the building textures, adding variety, fog, a skybox and there more improvements/additions I can make. These hopefully will be done in upcoming weeks, but of course are dependant on time.

Procedural City

For one of my assignments at university I will be creating a procedural city. At the moment it is very basic in its early stages. It contains 20,000 buildings within the scene at the moment running at 53 fps (on my very average/slow home computer), where as at University it runs at 800 fps, so hopefully you can see how crap my graphics card is.

Continue Reading →

W7: Walking over terrain

I finally fixed the issue I was having with getting the camera walking over the terrain. I ‘think’ the error was that I wasn’t translating onto the x-z plane at the beginning of my GetHeight(float x, float x) function properly. I said ‘think’ because I redid all of my functions that got the height of the terrain. Sometimes its best to start over again instead of continuously trying to re-edit something that doesn’t work. It’s a relief finally getting this fixed, as I have wasted a lot of time trying to get this to work.

In addition I managed to add a zombie into my engine by doing this untidily within one class. I am now trying to implement this the proper way to ensure that it is easier to add other assets to the engine. However I am currently having problems constructing my WorldObject class (that manages all objects within the world; i.e. their position, orientation) and my ResourceManager class (checks to see if a mesh or texture has already been loaded, to stop it from being loaded again when these resources are used on multiple objects for example).

As you can see I have added a texture to my terrain. All that was required at the time for this to work was one simple line.

D3DXCreateTextureFromFile(gd3dDevice, "grass.jpg", &mTexture);

Within my time of frustration trying to get the camera to walk over the terrain I cleaned up a lot of the code and removed unnecessary parts of my engine. This should make it easier for me to implement future additions.

W5: Floating Point Numbers

There are different number types, such as natural numbers (positive numbers), integer (positive and negative), rational (1/2, 1/3, 1/4), irrational (sqrt(2), e, PI), real numbers and complex numbers.

In my code I constantly use floats, without considering how it works. This week was spent making our own floating point calculator to add, multiply, subtract and divide floating point numbers using the IEEE 754 Standard.

Continue Reading →

W5: De Blob

I successfully created user input with the camera. However, I have been having some troubles making the camera walk across the terrain. For some stange reason, my camera appears to go up invisible hills when moving around. I’m guessing that the camera’s position hasn’t been set to the terrain’s position, so when the camera is supposed to go up a certain part of the terrain (that is visible) it would; instead of going up terrain a mile away from the hill.

I have added statistics in the top left of the screen which was quite an easy task to do.

I created a state manager for my application, which makes it a lot easier to handle my application. Currently there are only two states; the loading state and terrain state. I have also made start on implementing a resource manager, which will make it easier to handle resources loaded into the application. Currently I have no resources in my engine.

Our lecturer has given us details on our assignment task. For my assignment I must recreate ‘De Blob’. This will be a very tedious task. Hopefully I can recreate De Blob to a good standard in the time I have left for this semester.

W3: Frank Luna

This week I managed to implement a camera system; allow input with the mouse, keyboard and Xbox 360 controller and I managed to implement height-based lighting.

However, to begin with I had to put everything I had into a new framework. To be precise I placed my code within Frank Luna’s framework (from his Introduction to 3D Game Programming with DirectX 9.0 book). This framework was well structured since it made it easier to handle the device; for example when my program is running, if a user changes program, my program will still be running in the background. This becomes a lost device and once the user goes back to re-open the program the program must be reset.

Continue Reading →

W2: Terrain

For this week, I had to create terrain and implement different terrain types and lighting.

Firstly I rendered a large grid on screen and then created a list of vectors to store the y value of the terrains height map at different positions. I loaded a RAW file (which are typically used to store height maps) into the program and this was the result.

Continue Reading →

W2: MIDlets

I produced an insurance form which could be filled in by a user on the mobile phone as part of this week’s exercise.

When the user entered their details and pressed Save it would show the details they entered.

This was created using TextFields (textboxes), StringItems (labels), ChoiceGroups (checkboxes and radiobuttons), Commands and two different forms. The general setup involved creating a new form and then appending any textboxes, labels, etc… that I wanted to appear on that specific form; i.e. form.append(textbox);.

There are three specific functions within the application:

  • startApp – what is done at the opening of the application whether starting the app or resuming after a pauseApp
  • pauseApp – what to do when the application is interrupted (e.g. phone call)
  • destroyApp – how to destroy the application safely

Those functions are used on MIDlet applications. This program is an application using  MIDlet, which is a Java Application Framework for MIDPs (Mobile Information Device Profile) typically used on mobile devices.