Vice Help

Tips, tactics, and general discussion for Evochron Legacy.
verbosity
Captain
Captain
Posts: 1154
Joined: Thu Sep 07, 2006 7:38 pm
Location: Deep Space 9

Vice Help

Post by verbosity »

hi,

I've been working on something for the dynamic server and got a little stuck, so I thought I'd post here........

Problem
Several aspects of the dynamic server effect economy, economy is controlled by the economy value of the nearest planet. I'm unable to figure out how to determine this.

at the moment I have the following, but I'm sure there is something wrong with it, I just can't place what is wrong with it.
------------------------------------------------------------------------------------

sector difference

causex,y,z
effectx,y,z

causex-effectx = differencex
causey-effecty = differencey
causez-effectz = differencez

convert differencies to positive values

differencex + differencey + differencez = total_difference

smallest total_difference wins

( ie smallest total_difference is equal to the effect location being closest to the cause location)
verbsleagues.co.uk sw3dg web stats systems
uaithne.com eco-living project
rulerofzu.com free fantasy mmorpg
jesterscup.com webby stuffies
verbosity
Captain
Captain
Posts: 1154
Joined: Thu Sep 07, 2006 7:38 pm
Location: Deep Space 9

Vice Help

Post by verbosity »

Originally posted by Eclipse
Why are you converting differences to positive values, shouldn't negative values remain?
nope its the difference I'm looking for, for instance

-2000 - (-1000) =-1000

so thats a difference of 1000 units

leaving the - would alter the next forumla

x=100
y=-1000
z=200

100 + (-1000)+200 = 700, which is wrong because the real difference is 1300, hence the conversion.

( ok I'm not 100% true there in that sort of case, because the true difference would involve some trigonometry rather than adding the differences together)

[Edited on 4-14-2009 by verbosity]
verbsleagues.co.uk sw3dg web stats systems
uaithne.com eco-living project
rulerofzu.com free fantasy mmorpg
jesterscup.com webby stuffies
Storm
Lieutenant
Lieutenant
Posts: 218
Joined: Mon Jan 05, 2009 8:54 pm

Vice Help

Post by Storm »

Distance (between two points) = Square Root ( (x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2 )

In case of computers using different keyboards / symbols, " ^ " = "squared" (appears as "up-arrow" on US Keyboards).

(edit)
Thats *absolute* distance (no "conversion to positive" necessary)... and then if I understand your problem correctly, its just a matter of comparing a number of absolute distances to find the shortest one.

If you need to leave out "higher functions"(?) (such as squares and square roots) for some reason(?) (I don't know what you are coding in, and in any case maybe you want to speed things up w/ simpler math)... maybe you could use a reasonable / well designed lookup table to approximate. Approximate values should be fine, because there are no planets that are THAT close together. You will have to convert major SX SY SZ / X Y Z (sectors, and "sub"-coords) into some unified system... but thats easy to do (I would use decimals).

And "squared" could be replaced by ... ((x1-x2)x(x1-x2)) ... ((z1-z2)x(z1-z2)) (might be faster depending on what you are coding in).


[Edited on 4-14-2009 by Storm]
User avatar
Vice
Administrator
Administrator
Posts: 12227
Joined: Fri Apr 25, 2003 1:38 am

Vice Help

Post by Vice »

Here's one way to get distance:

x1#=object position x(1)
y1#=object position y(1)
z1#=object position z(1)
x2#=object position x(2)
y2#=object position y(2)
z2#=object position z(2)
dx#=abs(x1#-x2#)
dy#=abs(y1#-y2#)
dz#=abs(z1#-z2#)
distance#=sqrt((dx#*dx#)+(dy#*dy#)+(dz#*dz#))

This is certainly flexible and you can change how the calculation is managed. But it's a good spherical distance check.

Edit: Looks like Storm was faster :)

[Edited on 4-14-2009 by Vice]
StarWraith 3D Games
www.starwraith.com | www.spacecombat.org
3D Space Flight and Combat Simulations
verbosity
Captain
Captain
Posts: 1154
Joined: Thu Sep 07, 2006 7:38 pm
Location: Deep Space 9

Vice Help

Post by verbosity »

cool, thanks guys,

do the formulas above work fins for the 'negative' values of the co-ord system?
(I don't know what you are coding in, and in any case maybe you want to speed things up w/ simpler math)... maybe you could use a reasonable / well designed lookup table to approximate. Approximate values should be fine, because there are no planets that are THAT close together. You will have to convert major SX SY SZ / X Y Z (sectors, and "sub"-coords) into some unified system... but thats easy to do (I would use decimals).
I'm coding in php, the higher math functions are there and included nicely :) , also I'm just going to work in sectors, as there isn't any real need to do it any finer.

I'm planning on using a lookup system simply to reduce queries to the DB, but its going to build on the fly ( if there isn't a record for the sector it'll do the calculations and enter the details into the lookup table), this will avoid build a massive table with routine that would drive my host crazy, but keep down the processes after the fact.
verbsleagues.co.uk sw3dg web stats systems
uaithne.com eco-living project
rulerofzu.com free fantasy mmorpg
jesterscup.com webby stuffies
Storm
Lieutenant
Lieutenant
Posts: 218
Joined: Mon Jan 05, 2009 8:54 pm

Vice Help

Post by Storm »

Yes, those formulas work as-is for negative coordinates. The resulting value (distance) will always be positive ("absolute distance").

" ... just going to work in sectors ... " ... there might be two planets that are relatively close to sector boundries. What if there were three planets to compare; Planet1 at sx=0, sy=0, Planet2 at sx=0,sy=13, Planet3 at sx=13, sy=0. Apparantly Planet2 and Planet3 are the SAME distance from Planet1. BUT maybe Planet3 is at the LEFT edge of the sector 13,0 and Planet2 is at the TOP edge of sector 0,13.
Storm
Lieutenant
Lieutenant
Posts: 218
Joined: Mon Jan 05, 2009 8:54 pm

Vice Help

Post by Storm »

Or actually.... again I don't what you are specifically doing...

But working in "just sectors", AND to make the math simple, if the problem is "which effects the economy of point 1 the most... point 2 or point 3 or point 4 or point 5 ... " ... if point 1 is "closest" (*roughly*) to point 3 *AND* point 5, then maybe it should be effected by *both* (which is logical).

Nothing wrong with combining an Agricultural econ WITH a Tech econ IF both are close by.

Might simplify the protocol.
verbosity
Captain
Captain
Posts: 1154
Joined: Thu Sep 07, 2006 7:38 pm
Location: Deep Space 9

Vice Help

Post by verbosity »

yeah a good point.............

The system I've decided on is a half-way house anyway, I do a query with a range ( starting a 0 - the current sector only , then 1 - the surrounding 8 sectors, etc etc) and continue till I get a hit, If I hit more than one planet I do the calculation to get the nearest planet.
" ... just going to work in sectors ... " ... there might be two planets that are relatively close to sector boundries. What if there were three planets to compare; Planet1 at sx=0, sy=0, Planet2 at sx=0,sy=13, Planet3 at sx=13, sy=0. Apparantly Planet2 and Planet3 are the SAME distance from Planet1. BUT maybe Planet3 is at the LEFT edge of the sector 13,0 and Planet2 is at the TOP edge of sector 0,13.
I've several reasons for not going deeper:
1. I only have sector co-ords for the events I'm working on, working on points more accurate is pretty pointless
2. I believe the game does these calculations based on sector only as well
3. Its a minor part of my system and I don't want to devote much more time to it ( aka. I'm lazy as hell)
4. the resultant effect is both small and temporary
then maybe it should be effected by *both* (which is logical).
both true and false,
for pvp combats this would be true, but it would be less so for some contracts, and non-existant for others.....

[Edited on 4-14-2009 by verbosity]


-------------------------------------------------------
I suppose I should explain:
I plan on making contracts and pvp effect economies, which are determined by the nearest planet, therefore I need to find the nearest planet to each event :)

[Edited on 4-14-2009 by verbosity]
verbsleagues.co.uk sw3dg web stats systems
uaithne.com eco-living project
rulerofzu.com free fantasy mmorpg
jesterscup.com webby stuffies
Gogigred
Ensign
Ensign
Posts: 7
Joined: Fri Jul 10, 2009 11:16 am

Vice Help

Post by Gogigred »

I can't hardly do simple math. These calculations you all are talking about is scaring the hell out of me. I'm having a hard time figuring how to get out of the Saphire system. LOL
Can somebody tell me in simple english how to get to another system?
User avatar
Vice
Administrator
Administrator
Posts: 12227
Joined: Fri Apr 25, 2003 1:38 am

Vice Help

Post by Vice »

Take a gate in the general direction of the system you want to travel to.

These calculations are for retrieving distance values, you don't need to worry about them during regular gameplay. This is more development related.
StarWraith 3D Games
www.starwraith.com | www.spacecombat.org
3D Space Flight and Combat Simulations
Gogigred
Ensign
Ensign
Posts: 7
Joined: Fri Jul 10, 2009 11:16 am

Vice Help

Post by Gogigred »

Vice...I am still confused. I am at x523 y1450 z1374 Evochron station, sappire system....wanting to go to fauston... have fulcrum 3. are the gates the
<X> at the top of the navigation map and the up arrow z right arrow on the left? I have gone to the top of the navigation map and tried to go to Fauston but have ended up in Glacia or Erato II which I don't see on the map at all.
I know I will feel stupid when I finally understand it.
User avatar
Vice
Administrator
Administrator
Posts: 12227
Joined: Fri Apr 25, 2003 1:38 am

Vice Help

Post by Vice »

Have you learned how to zoom in and out on the map and right click to zoom in on a nearby sector? If so, zoom in on the sector that is up and left of Sapphire with the planet 'New Hope' in it. Note how it is up on the SZ direction and left on SX. That gives you a general idea of where the gate takes you (Fauston). When you right click on the sector with New Hope in it, you can hold the mouse pointer over the gate icon (the purple X looking symbol) and it will tell you where the gate is and what its destination is.
StarWraith 3D Games
www.starwraith.com | www.spacecombat.org
3D Space Flight and Combat Simulations
Gogigred
Ensign
Ensign
Posts: 7
Joined: Fri Jul 10, 2009 11:16 am

Vice Help

Post by Gogigred »

OK....Thanks
shewter
Lieutenant
Lieutenant
Posts: 120
Joined: Sat Mar 31, 2007 2:13 am
Location: SE Arizona, USA

Vice Help

Post by shewter »

Whooo, u guys are way to smart:). A good day for me is when I button my shirt, and it comes out even hahaha
MMaggio
Captain
Captain
Posts: 1535
Joined: Tue Jul 29, 2003 1:56 pm
Location: Jupiter, Fl

Vice Help

Post by MMaggio »

I've noticed that it's harder as you grow older.
\"To kill hubris with humility is a goal rarely achieved by men\"
tha_rami
Commander
Commander
Posts: 890
Joined: Tue Jan 25, 2005 2:20 pm
Location: Netherlands

Vice Help

Post by tha_rami »

The distance calculation above is called the Pythagoram theorem, and was actually meant to find the length of the diagonal (normally called the hypotenuse) of a right triangle. Basically, they're extending the theorem to include a third dimension. It's not really a hard theorem - if you'd Wikipedia it you'll find that its included as part of basic trigonometry in high school nowadays. If you understand coordinates you should be able to wrap your mind around it.

Buttoning your shirt evenly can be made simpler by straightening the shirt first, then starting at the very bottom. Removing any spare buttons (watch out not to accidently remove the bottom button!) can help as well, but make sure you keep those in an easy to remember location.
tha_rami - The best way to predict the future is to invent it.
Vlambeer - Dutch indie game studio
Twitter - Weird news, life updates & game-related news
MMaggio
Captain
Captain
Posts: 1535
Joined: Tue Jul 29, 2003 1:56 pm
Location: Jupiter, Fl

Vice Help

Post by MMaggio »

Thanks for the shirt tip Rami! Now I might have a better chance at picking up girls!:P
\"To kill hubris with humility is a goal rarely achieved by men\"
verbosity
Captain
Captain
Posts: 1154
Joined: Thu Sep 07, 2006 7:38 pm
Location: Deep Space 9

Vice Help

Post by verbosity »

Originally posted by MMaggio
Thanks for the shirt tip Rami! Now I might have a better chance at picking up girls!:P
use both hands, and hold them at the waist. Remember to bend at the knees and not at the back ! :P
verbsleagues.co.uk sw3dg web stats systems
uaithne.com eco-living project
rulerofzu.com free fantasy mmorpg
jesterscup.com webby stuffies
User avatar
Marvin
Global Moderator
Global Moderator
Posts: 14373
Joined: Wed Mar 04, 2009 5:47 am
Location: Fallon-Reno

Vice Help

Post by Marvin »

Originally posted by verbosity
Originally posted by MMaggio
Thanks for the shirt tip Rami! Now I might have a better chance at picking up girls!:P
use both hands, and hold them at the waist. Remember to bend at the knees and not at the back ! :P
:P Took a second ... but fuuuunnnnyyy.
Maarschalk
Captain
Captain
Posts: 7641
Joined: Wed Feb 25, 2009 12:24 am
Location: USA, Also check your six!

Vice Help

Post by Maarschalk »

Originally posted by Marvin
Originally posted by verbosity
Originally posted by MMaggio
Thanks for the shirt tip Rami! Now I might have a better chance at picking up girls!:P
use both hands, and hold them at the waist. Remember to bend at the knees and not at the back !

Depends on how heavy the Girl is even if she does not weigh anything many backs have been broken not just by picking up! ROFL:P:P:P:P:P
Arvoch Alliance Stat:


Evochron Legends Stats:


Evochron Mercenary Stats:


Darkness is the absence of Light as Evil is the absence of Good
shewter
Lieutenant
Lieutenant
Posts: 120
Joined: Sat Mar 31, 2007 2:13 am
Location: SE Arizona, USA

Vice Help

Post by shewter »

Originally posted by tha_rami

Buttoning your shirt evenly can be made simpler by straightening the shirt first, then starting at the very bottom. Removing any spare buttons (watch out not to accidently remove the bottom button!) can help as well, but make sure you keep those in an easy to remember location.
Hehehe thx Rami,now my wife wont have to dress me:P
MMaggio
Captain
Captain
Posts: 1535
Joined: Tue Jul 29, 2003 1:56 pm
Location: Jupiter, Fl

Vice Help

Post by MMaggio »

Now, can I have any hints on how put my belt on without missing any of the loops?:P
\"To kill hubris with humility is a goal rarely achieved by men\"
shewter
Lieutenant
Lieutenant
Posts: 120
Joined: Sat Mar 31, 2007 2:13 am
Location: SE Arizona, USA

Vice Help

Post by shewter »

Originally posted by MMaggio
Now, can I have any hints on how put my belt on without missing any of the loops?:P

Hehehe, can't help ya there MM, wife still does that for me:P

[Edited on 7-28-2009 by shewter]
verbosity
Captain
Captain
Posts: 1154
Joined: Thu Sep 07, 2006 7:38 pm
Location: Deep Space 9

Vice Help

Post by verbosity »

Originally posted by shewter
Hehehe thx Rami,now my wife wont have to dress me:P
thx Rami,now my wife wont have to dress me :mad:
verbsleagues.co.uk sw3dg web stats systems
uaithne.com eco-living project
rulerofzu.com free fantasy mmorpg
jesterscup.com webby stuffies