Reply
 
Thread Tools Rate Thread Display Modes
Old 01-21-2010, 00:38   #1
Bajotumn™[2]
Sith Lord
 
Bajotumn™[2]'s Avatar
 
Join Date: Sep 2008
Location: Albuquerque, New Mexico, USA, North America, Earth, Milky Way, Universe No.6578B.7784.221
Posts: 462
Bajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond repute
Wooooooooooo

None of you are going to understand this but I don't care.

Converting my old C++ game to C#. I get to do lots of really cool **** i didnt get to do before cause I was too lazy to write a massive amount of **** to do it.

Code block from GameMap.cs
Code:
        private void LoadMapTiles() {
            //Open our new file stream to read this map file into memory
            //We want to take our UID variable and get the path to the file that contains
            //The numeric representations of the tile layout this map is going to use
            //We are opening with read only access.
            FileStream FS = new FileStream(Config.GetMapTilesPath(UID), FileMode.Open, FileAccess.Read);
            //Initialize our binary reader to handle all the data reading
            BinaryReader BR = new BinaryReader(FS);
            //Read the first 4 bytes as our number of rows
            iRows = BR.ReadInt32();
            //Read the second 4 bytes as our number of columns
            iCols = BR.ReadInt32();

            //Read another 248 bytes. This just serves to seperate our config datafrom the actual row,col values.
            //This makes 256 bytes read in total, a good header for this basic type of file
            //Basically we want to reserve this space for future use.
            //Possible additional information might contain:
            //  The version of the map layout.
            //  The map generator. EX: MapMaker/1.0
            //  The author of the map. EX: SomeCoolPersonThatMakesMapsAndStuff
            BR.ReadBytes(248);
            
            //Initialize our Tiles array as a new 2D ushort array with the proper sizing.
            Tiles = new ushort[iRows, iCols];
            //We will use a ushort temp var for the data we read in so that it can be printed to the console as debug
            ushort temp = 0;
            //Loop for rows
            for(int x = 0; x < iRows; x++) {
                //Loop for columns
                for(int y = 0; y < iCols; y++) {
                    //Read 2 bytes to get our tile value we want for this coordinate
                    temp = BR.ReadUInt16();
                    //Set this tile
                    Tiles[x, y] = temp;
                    //Write out some debug being sure to space out each number to maintain a table like look
                    DebugConsole.Write(temp.ToString().PadRight(3));
                }
                //Make a new line for the debug printing so that it's in a table format
                DebugConsole.WriteLine();
            }
            //Ok we finished loading the tiles into memory
            DebugConsole.WriteLine("Finished loading map");
        }
The numeric table created would look something like this:
Code:
14 11 12 10 9  9  12 15 10 9  9  13
3  12 6  6  10 8  5  15 6  15 15 15
15 2  4  6  6  6  15 10 5  15 15 15
11 5  6  6  6  6  10 1  8  9  9  12
10 9  5  7  6  6  6  15 6  15 15 6
3  9  9  9  5  6  6  15 6  15 15 6
10 9  8  8  8  1  5  15 6  15 15 6
6  15 6  6  3  9  9  9  1  12 15 6
6  15 6  6  15 15 15 15 15 6  15 6
6  15 6  3  9  9  13 15 15 3  12 6
6  15 6  15 15 15 15 15 15 15 6  7
7  15 3  9  9  9  9  9  9  13 3  13
Attached Thumbnails
Click image for larger version

Name:	SampleTileGridImages.jpg
Views:	34
Size:	309.9 KB
ID:	128974  
__________________
Code:
* #06 * - Retired. Too busy with work
 130  131   131   131
Water Fire  Fire  Fire
Sith Lord
Skills:
  • Heaven Blade:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Level 2[Leveling on hold for now]
  • Chain Bolt:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
  • Fire Meteor:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
  • Tornado:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
Code:
 ***9650;
***9650; ***9650;
Quote:
Originally Posted by Eurochic View Post
Everyone is entitled to their opinion, unfortunately yours doesn't count.
[/url=http://www.youtube.com/watch?v=K6Tjwxbpn2I]My Rig[/url]

Last edited by Bajotumn™[2]; 01-21-2010 at 00:45.
Bajotumn™[2] is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 05:13   #2
tevren
blah.
 
tevren's Avatar
 
Join Date: Jan 2005
Posts: 9,552
tevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond reputetevren has a reputation beyond repute
Quote:
Originally Posted by Bajotumn™[2] View Post
None of you are going to understand this but I don't care.

Converting my old C++ game to C#. I get to do lots of really cool **** i didnt get to do before cause I was too lazy to write a massive amount of **** to do it.

Code block from GameMap.cs
Code:
        private void LoadMapTiles() {
            //Open our new file stream to read this map file into memory
            //We want to take our UID variable and get the path to the file that contains
            //The numeric representations of the tile layout this map is going to use
            //We are opening with read only access.
            FileStream FS = new FileStream(Config.GetMapTilesPath(UID), FileMode.Open, FileAccess.Read);
            //Initialize our binary reader to handle all the data reading
            BinaryReader BR = new BinaryReader(FS);
            //Read the first 4 bytes as our number of rows
            iRows = BR.ReadInt32();
            //Read the second 4 bytes as our number of columns
            iCols = BR.ReadInt32();

            //Read another 248 bytes. This just serves to seperate our config datafrom the actual row,col values.
            //This makes 256 bytes read in total, a good header for this basic type of file
            //Basically we want to reserve this space for future use.
            //Possible additional information might contain:
            //  The version of the map layout.
            //  The map generator. EX: MapMaker/1.0
            //  The author of the map. EX: SomeCoolPersonThatMakesMapsAndStuff
            BR.ReadBytes(248);
            
            //Initialize our Tiles array as a new 2D ushort array with the proper sizing.
            Tiles = new ushort[iRows, iCols];
            //We will use a ushort temp var for the data we read in so that it can be printed to the console as debug
            ushort temp = 0;
            //Loop for rows
            for(int x = 0; x < iRows; x++) {
                //Loop for columns
                for(int y = 0; y < iCols; y++) {
                    //Read 2 bytes to get our tile value we want for this coordinate
                    temp = BR.ReadUInt16();
                    //Set this tile
                    Tiles[x, y] = temp;
                    //Write out some debug being sure to space out each number to maintain a table like look
                    DebugConsole.Write(temp.ToString().PadRight(3));
                }
                //Make a new line for the debug printing so that it's in a table format
                DebugConsole.WriteLine();
            }
            //Ok we finished loading the tiles into memory
            DebugConsole.WriteLine("Finished loading map");
        }
The numeric table created would look something like this:
Code:
14 11 12 10 9  9  12 15 10 9  9  13
3  12 6  6  10 8  5  15 6  15 15 15
15 2  4  6  6  6  15 10 5  15 15 15
11 5  6  6  6  6  10 1  8  9  9  12
10 9  5  7  6  6  6  15 6  15 15 6
3  9  9  9  5  6  6  15 6  15 15 6
10 9  8  8  8  1  5  15 6  15 15 6
6  15 6  6  3  9  9  9  1  12 15 6
6  15 6  6  15 15 15 15 15 6  15 6
6  15 6  3  9  9  13 15 15 3  12 6
6  15 6  15 15 15 15 15 15 15 6  7
7  15 3  9  9  9  9  9  9  13 3  13
makes sense, easy to follow the comments!
__________________
HaiL aND GLoRY To THe DeSiBRoTHeRHooD
***10084;Mayfaire
*******
tevren is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 07:29   #3
anpaff
Banned
 
anpaff's Avatar
 
Join Date: May 2005
Posts: 11,548
anpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond repute
i dont understand a fuxor of that


give me carrots
anpaff is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 09:38   #4
Slaugh
Quitted
 
Join Date: Nov 2009
Posts: 83
Slaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond reputeSlaugh has a reputation beyond repute
Quote:
Originally Posted by anpaff View Post
i dont understand a fuxor of that


give me carrots
But, i want cookies
Slaugh is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 10:54   #5
Wiener
Vegar
 
Wiener's Avatar
 
Join Date: Mar 2007
Location: Norway, Ĺlesund
Posts: 1,337
Wiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond repute
Send a message via MSN to Wiener
Quote:
Originally Posted by Slaugh View Post
But, i want cookies
no can has.
__________________
Sunshine:
ChingChong, 130-130-136 pure warr, 350 raw bp
DingDong, 130-130-12x nin-war-fire, 300ish bp


Quote:
Jerri says:
nigros who dont believe in allah shall perish

Jerri says:
as long as i know that allah akbar everything is JIHAAAAD
Quote:
Originally Posted by Planes v1.0b View Post
This is obvious I would think. It seems to me that your computer is broken.
LADY HAS HER OWN SPESHUL SPOT HEAR!

rep: 191883791 point(s) total
Wiener is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 11:13   #6
anpaff
Banned
 
anpaff's Avatar
 
Join Date: May 2005
Posts: 11,548
anpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond repute
Quote:
Originally Posted by Wiener View Post
no can has.
can has no ?
anpaff is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 11:16   #7
Wiener
Vegar
 
Wiener's Avatar
 
Join Date: Mar 2007
Location: Norway, Ĺlesund
Posts: 1,337
Wiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond repute
Send a message via MSN to Wiener
Quote:
Originally Posted by anpaff View Post
can has no ?
no men :/
__________________
Sunshine:
ChingChong, 130-130-136 pure warr, 350 raw bp
DingDong, 130-130-12x nin-war-fire, 300ish bp


Quote:
Jerri says:
nigros who dont believe in allah shall perish

Jerri says:
as long as i know that allah akbar everything is JIHAAAAD
Quote:
Originally Posted by Planes v1.0b View Post
This is obvious I would think. It seems to me that your computer is broken.
LADY HAS HER OWN SPESHUL SPOT HEAR!

rep: 191883791 point(s) total
Wiener is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 11:17   #8
anpaff
Banned
 
anpaff's Avatar
 
Join Date: May 2005
Posts: 11,548
anpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond repute
aah men say yes can has no men pls
anpaff is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 11:21   #9
Wiener
Vegar
 
Wiener's Avatar
 
Join Date: Mar 2007
Location: Norway, Ĺlesund
Posts: 1,337
Wiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond reputeWiener has a reputation beyond repute
Send a message via MSN to Wiener
Quote:
Originally Posted by anpaff View Post
aah men say yes can has no men pls
okay, can has
__________________
Sunshine:
ChingChong, 130-130-136 pure warr, 350 raw bp
DingDong, 130-130-12x nin-war-fire, 300ish bp


Quote:
Jerri says:
nigros who dont believe in allah shall perish

Jerri says:
as long as i know that allah akbar everything is JIHAAAAD
Quote:
Originally Posted by Planes v1.0b View Post
This is obvious I would think. It seems to me that your computer is broken.
LADY HAS HER OWN SPESHUL SPOT HEAR!

rep: 191883791 point(s) total
Wiener is offline   Reply With Quote Share with Facebook
Old 01-21-2010, 11:23   #10
anpaff
Banned
 
anpaff's Avatar
 
Join Date: May 2005
Posts: 11,548
anpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond reputeanpaff has a reputation beyond repute
woohooo i can has yes men no
anpaff is offline   Reply With Quote Share with Facebook
Old 01-22-2010, 14:08   #11
Bajotumn™[2]
Sith Lord
 
Bajotumn™[2]'s Avatar
 
Join Date: Sep 2008
Location: Albuquerque, New Mexico, USA, North America, Earth, Milky Way, Universe No.6578B.7784.221
Posts: 462
Bajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond repute
Quote:
Originally Posted by tevren View Post
makes sense, easy to follow the comments!
Yar, I wrote them just for posting. I never write comments for myself unless they're technical **** like the value of a constant or whatnot.
__________________
Code:
* #06 * - Retired. Too busy with work
 130  131   131   131
Water Fire  Fire  Fire
Sith Lord
Skills:
  • Heaven Blade:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Level 2[Leveling on hold for now]
  • Chain Bolt:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
  • Fire Meteor:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
  • Tornado:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
Code:
 ***9650;
***9650; ***9650;
Quote:
Originally Posted by Eurochic View Post
Everyone is entitled to their opinion, unfortunately yours doesn't count.
[/url=http://www.youtube.com/watch?v=K6Tjwxbpn2I]My Rig[/url]
Bajotumn™[2] is offline   Reply With Quote Share with Facebook
Old 01-22-2010, 14:10   #12
=[ZerG]=
I hunger..
 
=[ZerG]='s Avatar
 
Join Date: Dec 2009
Location: Main Hive Cluster, Sector 6, Planet Char
Posts: 108
=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute=[ZerG]= has a reputation beyond repute
Quote:
Originally Posted by Bajotumn™[2] View Post
Yar, I wrote them just for posting. I never write comments for myself unless they're technical **** like the value of a constant or whatnot.
Yar, is this multiplayer yet? chat interface? multithreading?
__________________
[I Walk Through The Valley Of the Shadow Of Death]
=[ZerG]= is offline   Reply With Quote Share with Facebook
Old 01-22-2010, 14:36   #13
ZeRoDaY
Hi!
 
ZeRoDaY's Avatar
 
Join Date: Dec 2005
Location: Ill in oy
Posts: 2,464
ZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond reputeZeRoDaY has a reputation beyond repute
Send a message via AIM to ZeRoDaY
so if we dont understand, why even post it. We get it, you know computaz
__________________
Sunshine Server
Lvl 127 Trojan>LVL 122 Water Taoist> LVL 106 Trojan -XeL- -- RETIRED
Lvl 130 Archer>LVL 130Archer Synthetic -- RETIRED(For Now)
Lvl 130 Ninja>LVL 100 Ninja XeleX
ZeRoDaY is offline   Reply With Quote Share with Facebook
Old 01-22-2010, 15:04   #14
Bajotumn™[2]
Sith Lord
 
Bajotumn™[2]'s Avatar
 
Join Date: Sep 2008
Location: Albuquerque, New Mexico, USA, North America, Earth, Milky Way, Universe No.6578B.7784.221
Posts: 462
Bajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond reputeBajotumn™[2] has a reputation beyond repute
Quote:
Originally Posted by =[ZerG]= View Post
Yar, is this multiplayer yet? chat interface? multithreading?
Miltithreaded, yes. One thread for drawing and another for input a third psudo thread for debug output.

Chat interface not really, probably not going to do tcip, but I might do multi player on the same machine, just different control sets.

I haven't decided what graphics library I'll use yet, right now im using GDI+ because Window7 finally has hardware acceleration when doing GDI+ drawing. Other possibilities include DirectX 2D drawing, but DirectX can be a real pain in the ass...

The input method I have to use is a bit complex, because windows is *** and I can't use the built in events for form keyboard and mouse input, so I just capture the messages and process them accordingly in
Code:
protected override void WndProc(ref Message m) {
            //Console.WriteLine(m);
            switch(m.Msg) {
                case 0x100: {
                        //WM_KEYDOWN
                        ConsoleColor clr = Console.ForegroundColor;
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("KEYDOWN: " + m.WParam);
                        Console.ForegroundColor = clr;
                        break;
                    }

            }
            base.WndProc(ref m);
        }
Only a basic test right now, but that's where i'll process at.

As for music and sound, I'm not sure if I'll just use built in audio processing or build a wrapper.
__________________
Code:
* #06 * - Retired. Too busy with work
 130  131   131   131
Water Fire  Fire  Fire
Sith Lord
Skills:
  • Heaven Blade:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Level 2[Leveling on hold for now]
  • Chain Bolt:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
  • Fire Meteor:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
  • Tornado:
    ***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608;***9608; Fixed
Code:
 ***9650;
***9650; ***9650;
Quote:
Originally Posted by Eurochic View Post
Everyone is entitled to their opinion, unfortunately yours doesn't count.
[/url=http://www.youtube.com/watch?v=K6Tjwxbpn2I]My Rig[/url]
Bajotumn™[2] is offline   Reply With Quote Share with Facebook
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 23:25.