Urban Interactive – Project Development Blog

New Arrival

Posted in ROTJ by urbaninteractive on March 30, 2009

As you may have noticed I haven’t posted for a few weeks, and this is due to the arrival my son.  He weighed in a 8lbs 11.  Mother did really well, and is recovering at home.  I have taken 2 weeks off to try and help.  I think now after 12 days we are starting to get into some sort of routine.  However sleep is a premium, and what spare time we do get through the day is spent with one of us snoozing.  Its definitely worth it though.

Ref ROTJ I have dusted off the code and I’m still working on the first level.  I’ve started to code the beginning of the level where you will arrive at light speed.  So far so good.  Once its finished I will pop a small video of it up.

I also started work on the game launcher which is also in a nice vector mode.   The idea being that player will be able to select which of the 3 Star Wars vector games they want to play (SW and ESB will be emulated using Mame).  The user will be able to select the game using the either left of right and the fire button.  I will show the three logo’s on the screen and turning left and right will rotate one logo into view.  This should be nice in a Mame cabinet as hopefully the whole thing should look seamless.  The only requirement is that the Mame cab has a button which sends and ESC signal to quit the emulator and return back to the launcher.

Advertisements

Hidden Line Removal Revisited…

Posted in ROTJ by urbaninteractive on March 15, 2009

Hello All,

Since the last post I have finally nailed how to do a basic hidden line removal routine.  I tried coding this a few months back but even though I got it working the routine was way too CPU hungry.  I revisited it because in the first level I want the player to protect the Millennium Falcon.  When I plonked the model into the game using the standard drawing routine it didn’t look nice, and it was difficult to work out exactly what you were looking at.  Here’s and example of what I mean…

Before and After hidden line removal.

Before and After hidden line removal.

Now I think its a bit clearer.

As I say previously I did have routine to do this.  I am using the Painter method, which basically means I draw the furthest away faces first, and then the closers faces will cover up the further faces.  It’s better explained here…

http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/hiddenlines/

The reason my previous version was slow was because I was using BlitzMax’s own graphics routines for drawing polygons.  These proved to be a lot slower than creating them directly using Open GL commands.  Also I discovered some unhelpful “features” of BlitzMax TList class which also had an impact on the performance.  Firstly TLists.Sort method uses a bubble sort.  This is easiest sort to program, but for sure one of the slowest.  Previously I stored all the faces in a list and then sort them in Z order using TLists.Sort, I have now changed this to merge sort and it made a huge difference.  I did a test showing 3 hidden line objects and the speed of the new sort routine was 10 times faster.

Also I found out the the TList.Count method does not point to a stack which stores the current number of items in list.  Instead it actually recounts the list every time which can be slow if you have a lot of items and a lot of lists.  I had previously use the count method a lot to see if a list was empty, I’ve switched these checks now to TList.IsEmpty (which I should have done in the first place).

Making the new Hidden Line routine also meant I needed to modify my existing vector object editor because the hidden line object format is different to the normal wire frame format.  This took a day, but now its really simply to use.  Overall Im please with the speed results, and I think the game will look better for it.

This will probably be my last post of a few weeks now, as my wife is now overdue (sounds like I’ve ordered her from a Russian Brides Website and the delivery is late) – When I mean overdue I mean she is expecting our first child.  So any minute now the sleepless nights and lack of concentration will start…