Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Programming
You last visited: Today at 05:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Question]Dmap into C# form

Discussion on [Question]Dmap into C# form within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old 01/04/2011, 23:00   #16


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by Ian* View Post
Well when you try to access your dmap from another thread it will crash your program and thrown an exception saying something like no cross thread calls allowed.

If this is j ust a GUI with no functionality in it then I can totally see why there is no issue <yet>.
You can remove the check for that, and aslong as what your doing is safe then its actually not a problem at all.
Korvacs is offline  
Old 01/04/2011, 23:35   #17
 
OELABOELA's Avatar
 
elite*gold: 223
Join Date: Dec 2007
Posts: 1,076
Received Thanks: 257
I tried it on another pc that was 32 bit, but almost the same specs. It did go well, it updated the dmap better then on my own pc >.>
OELABOELA is offline  
Old 01/05/2011, 04:01   #18
 
Real~Death's Avatar
 
elite*gold: 0
Join Date: Jun 2007
Posts: 1,272
Received Thanks: 246
a buddy of mine gave me some code for this.seems to be like a binarie reader of the dmaps.he said it should help on what we are trying to do.soon as I get the connection problems im having with the alchemy source,ill try it/
Real~Death is offline  
Old 01/05/2011, 09:49   #19
 
OELABOELA's Avatar
 
elite*gold: 223
Join Date: Dec 2007
Posts: 1,076
Received Thanks: 257
Quote:
Originally Posted by Real~Death View Post
a buddy of mine gave me some code for this.seems to be like a binarie reader of the dmaps.he said it should help on what we are trying to do.soon as I get the connection problems im having with the alchemy source,ill try it/
Are you having connection problems within the code, or just with settings.txt etc..
OELABOELA is offline  
Old 01/05/2011, 11:11   #20
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,199
Quote:
Originally Posted by Korvacs View Post
You can remove the check for that, and aslong as what your doing is safe then its actually not a problem at all.
Are you talking about CheckForIllegalCrossThreadCalls? If so, why not just update the map by invoking? It's thread safe and easy
IAmHawtness is offline  
Old 01/05/2011, 12:13   #21
 
Ian*'s Avatar
 
elite*gold: 0
Join Date: Nov 2006
Posts: 805
Received Thanks: 464
Quote:
Originally Posted by Real~Death View Post
a buddy of mine gave me some code for this.seems to be like a binarie reader of the dmaps.he said it should help on what we are trying to do.soon as I get the connection problems im having with the alchemy source,ill try it/
Probably not a binary reader lol, dmaps are like..

0 = invalid coords
1 = valid coords

so for 0 draw a pixel of black for 1 draw a pixel of white.


@martin

yeah that's the exception i was talking about, and yea easy fix delegate/ invoke the function and its gone.

i wasn't aware there was a way to just disable the check? + that's not thread safe? O.o
Ian* is offline  
Old 01/05/2011, 12:20   #22
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,199
Quote:
Originally Posted by Ian* View Post
@martin

yeah that's the exception i was talking about, and yea easy fix delegate/ invoke the function and its gone.

i wasn't aware there was a way to just disable the check? + that's not thread safe? O.o
I tried using the "CheckForIllegalCrossThreadCalls = False" but to be honest, I prefer invoking since it seems like the easiest/best solution to me.
IAmHawtness is offline  
Old 01/05/2011, 12:44   #23


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Both methods work, you can just disable it and be just fine so long as you dont do something really ridiculous.
Korvacs is offline  
Old 01/05/2011, 13:27   #24
 
elite*gold: 20
Join Date: Aug 2007
Posts: 1,749
Received Thanks: 2,199
Quote:
Originally Posted by Korvacs View Post
Both methods work, you can just disable it and be just fine so long as you dont do something really ridiculous.
True, but I'm pretty sure setting CheckForIllegalCrossThreadCalls to false doesn't mean that you can access control properties. I mean, like you can by invoking. Like: If chkMyCheckBox.Checked = True then do something...
Can't do that in a seperate thread unless you're using invoke.

Also, another advantage that comes with invoking: BeginInvoke allows you to access the GUI asynchronously which is pretty neat at certain occasions.
IAmHawtness is offline  
Old 01/05/2011, 16:39   #25
 
Real~Death's Avatar
 
elite*gold: 0
Join Date: Jun 2007
Posts: 1,272
Received Thanks: 246
Quote:
Originally Posted by OELABOELA View Post
Are you having connection problems within the code, or just with settings.txt etc..
not sure as of yet but i have a week off work so i should all the time in the world to fix it...lol
i sent you the code,my buddy said it was ok.just dont post please not mine or your.
Quote:
Originally Posted by Ian* View Post
Probably not a binary reader lol, dmaps are like..

0 = invalid coords
1 = valid coords

so for 0 draw a pixel of black for 1 draw a pixel of white.
well only checked the code a bit,does me no good at the mmoment
Real~Death is offline  
Old 01/05/2011, 17:02   #26
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
The reason why he hasn't had any issues with crossthreadcall crashing is cause I already set it to false for the gui I had originally added for myself (I had one with some basic stuff like kill counter/character tracker + some basic settings). I never bothered doing any of the map stuff though cause it was always being hosted through 1 main server with everyone logging in through it. At the time I had no desire to do a proper proxy cause well... that wasn't something that really interested me.

But yes, currently the proxy he is using already has the check disabled. I've never had any problems using that system but as you said, I'm sure there are PLENTY of better ways to do things.

Note: You can access the form members but you have to set them to public (IE: set the label to public and then when starting the gui from your main program save the instance you created of it and use that to modify all the form members)
pro4never is offline  
Old 01/05/2011, 17:04   #27


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by Ian* View Post
Probably not a binary reader lol, dmaps are like..

0 = invalid coords
1 = valid coords

so for 0 draw a pixel of black for 1 draw a pixel of white.
You read the .dmap format with a binary reader. Heres the entire file:

Code:
                _FileStream.Seek(268, SeekOrigin.Begin);
                Map.PopulateTiles(Reader.ReadUInt32(), Reader.ReadUInt32());

                for (ushort y = 0; y < Map.Height; y++)
                {
                    for (ushort x = 0; x < Map.Width; x++)
                    {
                        Map.SetWalk(x, y, !Convert.ToBoolean(Reader.ReadUInt16()));
                        _FileStream.Seek(2, SeekOrigin.Current);
                        if (_Height)
                            Map.SetHeight(x, y, Reader.ReadUInt16());
                        else
                            _FileStream.Seek(2, SeekOrigin.Current);
                    }
                    _FileStream.Seek(4, SeekOrigin.Current);
                }

                uint PortalCount = Reader.ReadUInt32();

                Map.PopulatePortals(PortalCount);

                for (ushort y = 0; y < PortalCount; y++)
                {
                    DMapPortal portal = new DMapPortal();
                    portal.XCord = (ushort)Reader.ReadUInt32();
                    portal.YCord = (ushort)Reader.ReadUInt32();
                    Map.SetPortal(y, portal);

                    _FileStream.Seek(4, SeekOrigin.Current);
                }
Between access and height is a third variable which denotes the type of tile, not really necessary for private servers. Also i seek the first section of the file as its not necessary for loading the tiles.

And of course portals at the end of the file.

Edit: And also i just noticed that someone posted a copy of my loader from the CUOSP project, that loader is custom made to be used with my .smap format, it determines access based on the bits used in a byte to compress the size even further and reduce loading time. It will not work with standard dmap files.
Korvacs is offline  
Thanks
4 Users
Old 01/05/2011, 19:03   #28
 
OELABOELA's Avatar
 
elite*gold: 223
Join Date: Dec 2007
Posts: 1,076
Received Thanks: 257
My problem is that im using it on a 64 bit pc, while its 32 bit. I saw korvacs made a thread about making it 64 bit a while ago, but i think that when i turn it on 64 bit, everything will be ******.
OELABOELA is offline  
Old 01/05/2011, 21:51   #29


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by OELABOELA View Post
My problem is that im using it on a 64 bit pc, while its 32 bit. I saw korvacs made a thread about making it 64 bit a while ago, but i think that when i turn it on 64 bit, everything will be ******.
Ok, what actually is the problem?
Korvacs is offline  
Reply


Similar Threads Similar Threads
[Question] Inventar Form ändern/vergrössern
06/17/2011 - Flyff Private Server - 12 Replies
Heey, E*pvper's Ich bin dabei ein neues Ingame Design zu entwerfen. Ich hab mir da mal das Inventar angeschaut und mir überlegt wie man es doch vergrössern oder gar die Form verändern könnte. Ich hab da schon einiges versucht, leider erfolglos <.< Die SuFu spuckte auch nicht's aus ._. Ich freue mich auf jede hilfreiche Antwort :) Liebe Grüsse Apfelsuchtii
DMap Info [Question]
08/08/2009 - CO2 Private Server - 12 Replies
I have a DMap Reader on my source. I want to check the access of some locations when a player drop an item, jump, walk, etc... But, if I load the DMap in an array, I have like 20mo of RAM used by one map. An other solution is to read the DMap when the player have to check the location but I don't want to kill my computer:rolleyes: The best solution, I think, is to load in memory the most used map like TC and for the other, check when the player use the map. What is the best solution?
.DMap
06/29/2006 - Conquer Online 2 - 10 Replies
Hello, It is my first post here I usually just read topics and learn from them ect.. Thank you elitepvpers for all these weeks of help but now i need something not found.. I want to make costum little map the ones at the top right of your screen i wanted to make an edited one with lets say a star where the ganaderma spawns but i dont know how to open or save as .DMap can someone help m with this? are there any specifications when doing this? filesize ect..
DMAP
04/09/2006 - Conquer Online 2 - 5 Replies
Ok i checked on forum i couldn't find anything base on this so i'm want to know if there any program open dmap files so i can edit the maps if so could you let me know I appreciate it.
.dmap question
10/23/2005 - Conquer Online 2 - 0 Replies
does any1 kno wich .dmap snake array is..thx :rolleyes:



All times are GMT +1. The time now is 05:25.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.