|
You last visited: Today at 13:35
Advertisement
Tips and Tricks to CO Programming
Discussion on Tips and Tricks to CO Programming within the CO2 Private Server forum part of the Conquer Online 2 category.
01/27/2012, 06:53
|
#1
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
|
Tips and Tricks to CO Programming
I just want to hear some ideas and tricks that some of you guys are using now days in your programming in the co community. It doesn't have to be something big or save a lot of performance or anything. Just something crafty how you handle things that is unique. For example, for my dropped floor items dictionary. Instead of using each items UID as the key. I actually use the X coord concatenated to the Y coord. So X = 429, Y = 378 becomes 429378. The number will always be less then a uint. The reason I do that is because instead of searching through all the dropped items using a loop to see if a spot on the ground is taken, I can just use the Dict.ContainsKey method.
|
|
|
01/27/2012, 07:21
|
#2
|
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
|
I never thought about that.
|
|
|
01/27/2012, 07:26
|
#3
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
|
I like it that way things can never stack. And the keys will never be the same as long as u always have X first, or always have Y first.
|
|
|
01/27/2012, 08:42
|
#4
|
elite*gold: 0
Join Date: Jan 2012
Posts: 21
Received Thanks: 7
|
Make sure you use as much CPU as possible.
|
|
|
01/27/2012, 11:46
|
#5
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Quote:
Originally Posted by 12k
I like it that way things can never stack. And the keys will never be the same as long as u always have X first, or always have Y first.
|
The coordinates 345 , 79 and 34, 579 are the same, hurray for not thinking things through!
Also does this mean when you spawn a character you loop through all combinations of the coordinates within the viewable range individually?
|
|
|
01/27/2012, 12:59
|
#6
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
|
Quote:
Originally Posted by Korvacs
The coordinates 345 , 79 and 34, 579 are the same, hurray for not thinking things through!
Also does this mean when you spawn a character you loop through all combinations of the coordinates within the viewable range individually?
|
Lol? Why would i do that. Characters can stack and can walk on items. This has nothing to do with dmaps. Its just for dropping items really. And in which case I don't think your going to be dropping an item on the other side of the map are you? No, you check coords 0-+2 away from you. As for the duplicate entry for the dict. I always add a 0 to the Y value if its less then 100. Hurray for not thinking about things on that one once again. How about you stop trying to pick things apart for once.
#edit if your meaning for spawning items i use the same way any typical source does.
|
|
|
01/27/2012, 13:04
|
#7
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
You add a zero? Please tell me your not doing this with strings and parsing and are instead using maths to solve this, please tell me that you have thought about maps with coordinates that go into the thousands.
My point was when you spawn a character you have to show it all the items on its screen, so you have to check all of the cords on the screen to find the items that have been dropped.
How about explaining yourself clearly for once x.x
|
|
|
01/27/2012, 13:14
|
#8
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
|
1. Check bottom of last post. I didnt get it updated in time.
2. Only reason for explaining myself clearly is for you because nobody else wants to try to pick apart everything.
3. Woopdy doo make 79 as Y to 0079 and 555 into 0555. Problem w/ the thousands solved.
4. Ofc I am.
Have you said 1 positive thing in a post in your last 500 (other then on ur servers thread)? Pretty sad when thats a serious question and its directed at a mod.
|
|
|
01/27/2012, 13:26
|
#9
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Lol, well anyway my Tip/Trick would be to move to parallel programing with the use of concurrent dictionaries for any collection which could potentially be required to both read and write to at the same time, so any collection that contains, accounts, characters, items, monsters, would most likely benefit from this.
|
|
|
01/27/2012, 13:32
|
#10
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
|
A while ago pro4never suggested this to me. It worked pretty well. I don't quite understand why the concurrent dictionaries always require an "out" as an arg when ur removing or updating though. Rather annoying.
|
|
|
01/27/2012, 14:19
|
#11
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Because typically once you remove something from a collection you want to do something with it, if not then you could write an extension which just removes the object and doesn't return it through an out.
|
|
|
01/27/2012, 16:05
|
#12
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
Korv is correct though... the floor system you're talking about is actually most likely LESS efficient than the basic 'loop through a collection' type system due to the extra overhead for inserting entries as well as calculations and loops needed to check screen for spawning items to yourself.
If you really want efficiency then just write a proper quad system which will make it plenty efficient and allow scalability as more objects are added to the map.
|
|
|
01/27/2012, 17:03
|
#13
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
|
Quote:
Originally Posted by pro4never
Korv is correct though... the floor system you're talking about is actually most likely LESS efficient than the basic 'loop through a collection' type system due to the extra overhead for inserting entries as well as calculations and loops needed to check screen for spawning items to yourself.
If you really want efficiency then just write a proper quad system which will make it plenty efficient and allow scalability as more objects are added to the map.
|
Haha, didn't say it was more efficient or less efficient. Its just a unique way I handle them. As the first post says. He was just trying to give me reasons why it wouldnt work. Not why it wasnt good for performance.
|
|
|
01/27/2012, 18:12
|
#14
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
|
uint uid = x | (y << 16);
if you insist on constructing a uid based on x,y
given x,y < 0xffff
|
|
|
01/27/2012, 19:53
|
#15
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
Quote:
Originally Posted by 12k
Haha, didn't say it was more efficient or less efficient. Its just a unique way I handle them. As the first post says. He was just trying to give me reasons why it wouldnt work. Not why it wasnt good for performance.
|
The two are not always mutually exclusive...
If something is not efficient then regardless of its functionality then it is not the ideal solution.
Please ***... lets not all turn into hipster programmers who code something so it's not so 'mainstream'. Obviously conquer sources that are public are FAR from optimized but doing something just to be unique is not the way to go... Your reasons for adopting a new system should be efficiency and or ease of use.
Your system is neither which is why korv was insulting it (and now I get to jump on that bandwagon it seems)
|
|
|
 |
|
Similar Threads
|
TIPS AND TRICKS
12/05/2011 - Cabal Online - 11 Replies
Q>Is there any way to LVL DOWN your char? or decreasing some of the EXP?
|
MW3 - Tips & Tricks !
11/12/2011 - Call of Duty - 2 Replies
Hallo,
hab hier mal ein Thread eröffnet, werde immer wieder updaten :)
1. Ingame Musik ausschalten
Ihr kennt es, ihr seit letzer bei SnD, die Zeit ist fast um und die Musik wird lauter...
Damit könnt ihr sie ausstellen, um Gegnern im vorteil zu sein:
In dein Mw3 Verzeichnis gehen (C:/Programme/Steam/Steamapps/Common/Mw3)
Dort den miles Ordner einfach umbenennen, vorher aber eine sicherungskopie machen
|
tips and tricks for 4th job
12/17/2010 - Grand Chase Philippines - 22 Replies
hey..
I am getting really tired of having my lass becoming a slasher
hanggang ngaun..step 2 plng aq
tips and tricks po..
cno gs2 magshare??
|
Gacha Tips/Tricks [Sealed bead tricks]
11/25/2010 - Grand Chase - 25 Replies
is there anyway to complete an epic sealed bead set with just using a less amount of scrolls? if there is tell me the trick or tip to do it :) please help, if you want to keep it a secret just pm it to me and I promise you i wont spread it :D
|
All times are GMT +1. The time now is 13:35.
|
|