Jump to content

  • Log In with Google      Sign In   
  • Create Account


Anri

Member Since 15 Sep 2003
Offline Last Active Mar 27 2014 04:43 PM
-----

Topics I've Started

If it ain't broke then don't fix it...DOH!

01 November 2012 - 02:43 PM

This has got to count as one of the most stupid things I have ever done in programming...nope, nothing comes close! O_O

So, I've been writing a ray-casting engine over the last few weeks, and despite numerous complications, I finally got my textured walls and so, to go one better I decided to finish off the engine with floor-casting...

So, I decided to use a different texture to the one I used for the walls - which had nice different colours in it. However, for this one I opened up MS Paint and filled in a blue base and then...well...using a pixel width brush, drew some lines to create a brick like pattern...

...so, with my new floor texture, I then wrote the floor casting code, and then...

A WHOLE LOAD OF FLICKERING LINES!

...oh dear, my code seemed to be at fault! So, seven days later I eventually came to the conclusion that I simply didn't understand floor-casting, and that Permadi and Lode were talking bollocks in their tutorials. I even went to the length of reversing the maths to get original casting distances using the projection plane! Something simply wasn't right here, but I vowed to build this engine without any assistance...so asking for help here would have been pussying out...

So tonight, I thought I would muck about by using a more detailed texture from Wolfenstein3D...and discovered a truly spine-tingling fact...

...THERE WAS NOTHING WRONG WITH THE BLOODY THING!!!! O_O

...turns out my original floor texture simply didn't have enough detail to display properly! I honestly feel like such a twat for spending seven days trying to fix something that wasn't broken in the first place! o_O

Sigh, the engine is now complete and I am feeling relieved I can begin with tidying it up and optimising...then making a game of some description...

Has anyone else here done the same thing? Tried to fix something that wasn't broke in the first place? Posted Image

Sega console programming(homebrew?).

19 October 2012 - 02:41 PM

I recently saw the most amazing thing on Classic Game Room(YouTube channel) which was a new DreamCast game called Gunlord and it looks amazing.

So having finished my Degree this week and a basic Java Ray-casting demo, I'm kind of heart-set on a bit of retro-console programming as my next project. Most likely not a full game, but at least a demo or two. One concern I do have - I don't want to have to physically or software-wise modifiy a console to run my demos.

There seems to be two possible target platforms: The DreamCast(wow, I really want one of those in my collection!) or....the sega Mega-CD. Both seem to only require a user to burn a demo/game to a CD and then just pop it in the console as it is. I think the Mega-CD is going to be difficult, but the DreamCast appears to require a knowledge of C which I'm quite happy to use...

I used to program in C/C++, moved on to Java and Visual Basic for my education and even dipped my toe in C64 assembly(still a beginner, though). I would very much like to have someone's opinion on this (foolish?) ambition that has actually done some console homebrewing - and educate me as to the harsh realities one will face, and if there is an ideal console to homebrew for.

Many thanks.

Difficulty on deciding on a suitable qualification

16 October 2011 - 05:20 PM

My thanks to anyone who is kind enough to be reading this plea for help, and even more for responding.

I am stuck with a difficult decision regarding my computing education with the Open University, in the UK. I am in full time work at a food retail store(which I hate), and have been teaching myself programming for just over a decade. I am currently 31 years old and my two computing-related qualifications are...

  • Diploma of Computing (Open University)
  • City & Guilds: Introductory Computing (Computeach)
I have finished a 3rd qualification and should receive it at the end of this year, which will be...

  • Certificate in Computing & IT (Open University)
Which is fine, but I now have to make a decision on my next, and most important, qualification. I am currently pursuing what is called an "Open" Degree, without Honours, and will only be labelled as a Bachelor of Science. I will finish it in October 2012.

However, there is another qualification which has me wondering if I am going for the wrong qualification. It is a "Diploma of Higher Education in Computing & IT" and I already meet the requirements for its Software Developer option, but mopping up the last remaining modules it will take me until June 2013, although I might be able to snag - in a rather sly manner - another Diploma of Higher Education in June 2012...but only if I do go for the Comp & IT DipHE...

I feel that the Diploma will allow me to learn Maths, an area in which I struggle, and even sneak in some Assembly programming. Its also a named qualification for the field. However, I do feel that I will be filtered out of job applications without at least a Bsc Degree, even if it isn't a named qualification other than "Bachelor of Science"...

LOL, I personally wish I could just jack it all in and go back to teaching myself C++ and Maths(far more effective! ^_^), but any advice will be greatly appreciated.

Steve.

Getting to grips with bytes and targa files in Java

13 July 2010 - 11:20 AM

Okay, this isn't actually a cry for help but something I just wanted to share with others who might be having trouble loading in data types from a binary file that are more than one byte.

Here was the problem I faced: Loading in a targa image file.

Here is the basic skeleton for opening a file(although could be written better no doubt)...

public void loadImageFromFile(String fileName)
{
try
{
FileInputStream theInputStream = new FileInputStream(fileName);
DataInputStream readerStream = new DataInputStream(theInputStream);

//Read in yer bytes from the file here(which we will do next...)

readerStream.close();
theInputStream.close();
}
catch( IOException e)
{
System.out.println("Error: Failed to open the file");
}
}

...so you would call this method by providing the usual string containing the name of the file you want to open. The next task was to read in the first three fields of the header of the targa file. Now all of these are fortunately a single byte in size. So here is how we would go about reading them in...

byte Field1 = readerStream.readByte();
byte Field2 = readerStream.readByte();
byte Field3 = readerStream.readByte();

...and we're done. However, we will hit a field that uses 2 bytes. One such field is located at bytes 12 and 13 - the Width of the targa image. Another difficulty is Java's lack of unsigned types, but it can be dealt with. One might think its easy to use readUnsignedShort() and simply slap it in an Integer, but its easier to read the two bytes in separately...

int partA = 0x000000FF & ((int)readerStream.readByte());
int partB = 0x000000FF & ((int)readerStream.readByte());

...so, now we have the two bytes, we need to add them together and store them in a third int variable. However, we need to do a bit of mucking about with bit-shifting. here is a method to take care of things...

public int getDoubleByteType(int a, int b)
{
return ((b << 8) | a);
}

...now, here is the gist of it - when using readUnsignedShort(), it seems to load the bytes in the order( A, B ), and store them into two bytes like that, but what we really need to do is store them as ( B, A ).

Anyway. Here is a method to load in the first 18 bytes that make up the header file of a targa file. With this method you can at least obtain the width and height of the image, which comes in handy for extracting the image data itself(but that's for another time)...

public void loadImageFromFile(String fileName)
{
try
{
FileInputStream theInputStream = new FileInputStream(fileName);
DataInputStream readerStream = new DataInputStream(theInputStream);

int[] myBytes = new int[18];

for(int i=0; i<myBytes.length; i++)
{
myBytes[i] = 0x000000FF & ((int)readerStream.readByte()) ;
}

int width = (myBytes[13] << 8) | myBytes[12];
int height = (myBytes[15] << 8) | myBytes[14];

for(int i=0; i<myBytes.length; i++)
{
System.out.println("Byte " + i + ": " + myBytes[i]);
}

System.out.println("\n\nWIDTH: " + width);
System.out.println("HEIGHT: " + height);

readerStream.close();
theInputStream.close();
}
catch( IOException e)
{
System.out.println("Error: Failed to open the file");
}
}

...so in the end, I hope this helps those who are reading in double-byte fields and wondering why the values are not quite right.

Direct2D

30 June 2010 - 08:10 AM

Not an immediate problem, but the news of a separate 2D component in DirectX once again is very interesting!

I installed the June 2010 DirectX SDK, and tried to compile a Direct2D test. However, it reported an error of missing "D2D1.dll".

Yup, I'm using Vista and Direct2D is a Win7 tech, but then on MicroSoft's website it claims that installing Service Pack 2 will add Direct2D to Vista. So I did that but alas, still no cigar...

I don't actually need to switch over to Direct2D just yet, but it would be nice to know more.

PARTNERS