Modify physics -get rid of viscosi -underwater model

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

pheonixstorm wrote: DING! lightbulb.. we already have something we can use once modfied. I can't remember the name, something to do with gun tracking I think. That could be a good start to attack the problem from aside from the math.
(There is a smiley for that :idea:)
Are you trying to remember auto-tracking/ITTS?
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

P.S. I restored VS console.. Python interpretor working...
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

BEZ_BASHNI wrote: What I need is math functions to do base trigonometric calcs -I used to beleive that python math is a prebuilt lib and works not bad...
Go to pypy's or unladen-swallow's benchmark site (if you can find it, there was one, I just can't find it), to see how... misguided... that statement is.

math is a builtin module, with builtin functions. But in order to invoke even the simplest of those functions, you have to:
  • Interpret the bytecodes representing function invocation
  • Set up the argument stack
  • Call the function through a virtual function table
  • Create the "float" object representing the result. This includes memory allocation.
  • Return to the interpreter loop
Now, I gather your misguidedness comes from a different misconception:
BEZ_BASHNI wrote:
There are no such functions in CPython (usual python, the one VS uses)
After "uncompressing" pyc file into python namespace the interpretator jumps along the lines .im_func.func_code.co_code and converts bytecode to machinecode..That was the function I meant.
Take a look at Python's source.
In Python/ceval.c, you'll find PyEval_EvalFrameEx.
That's python's main interpreter loop. Machine code is never generated, that loop interprets the bytecode and performs the operations encoded by it. It's never translated into native code.
Stackless is the same. Pypy is the only with a JIT, now that unladen-swallow is dead.

With that in mind... how many times slower is pure math code?
BEZ_BASHNI wrote:Unit iterator will be better to keep outside of the python also -at least to do some database -style requests to the VS units like give ID's of the non-friendly units in range Y, give id of nearest unit...
And with that in mind, this kind of high-level stuff is where python shines. That's what's right in eve, that's why AI in python is a no-no, but "behavior scripts" (taking out the core of AI algorithms into C) might work.

Interpreting bytecode is nothing compared to path finding, ray tracing, etc. So when each bytecode involves a lot of work, then is where Python is well used.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

travists wrote:
pheonixstorm wrote: DING! lightbulb.. we already have something we can use once modfied. I can't remember the name, something to do with gun tracking I think. That could be a good start to attack the problem from aside from the math.
(There is a smiley for that :idea:)
Are you trying to remember auto-tracking/ITTS?
ITTS only gives you a direction. Not instructions of how to best accelerate the ship towards that direction, nor how early do you have to start turning around in order to start decelerating.

It's a chore, it's not rocket science if you don't have the same low-acceleration limitations, but it's still a lot of boilerplate and a lot of contingencies to take into account. A chore.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Modify physics -get rid of viscosi -underwater model

Post by pheonixstorm »

Ah but it still has to calculate that direction, so it does point us in a direction we want, its just a very limited code set to follow, but its better than nothing ;)
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
TBeholder
Elite Venturer
Elite Venturer
Posts: 753
Joined: Sat Apr 15, 2006 2:40 am
Location: chthonic safety

Re: Modify physics -get rid of viscosi -underwater model

Post by TBeholder »

pheonixstorm wrote:No damage from collisions.
Impact elasticity is a matter of choice - though obviously you have to calculate less of them if you make them very inelastic. :twisted:
And in VS it's global and adjustable as physics/inelastic_scale.
pheonixstorm wrote:A lot of the objects in game you can fly through (which is down right annoying). When warping you can warp through pretty much any object. Planets, suns, stations...
That's either performance save or more likely plain low precision. Happens in FFE (and VS versions with time acceleration, IIRC).
travists wrote:When dropping you near a significant object it self corrects to place you in that orbit before disengaging.
If the ship is correctly affected by gravity, this boils down to "use your navigation target's frame of reference on approach", which is the most sane way to do it anyway.
And if it isn't, this won't help because...
klauss wrote:The problem with orbits is it involves acceleration, constant acceleration. Delta-V.
Or simply weak thrusters. Which also would look silly. Right, orbital mechanics is for all or nothing.
klauss wrote:The problem with gravitational maneuvering is that it involves applying Delta-V to change from one frame of reference to the next. It takes a lot of energy and time to do it naively, and people don't want to spend that time.
I already mentioned here that SPEC changes delta-V at least through tweaking inertial limitations, even if its net result obeys preservation.
And gravity in the warped effective space is going to be amplified/attenuated by "warp refraction" (assuming "gravity is force", since using GRT's "gravity is warp" is messier and would get in troubles even other effects in VS).
Which may allow other delta-V changes, unless gravity and inertia tweaks negate each other (this can be said for sure only for a finished physics model, not "in the general direction").
travists wrote:The Delta-v of a ship's afterburners is quite large.
Depends on the type (fuel-guzzling one is obviously worse), though default exhaust velocity of 1/60 c definitely helps.
klauss wrote:Furthermore, we're not talking about highly optimized AI routines, we're talking about modder-friendly AI routines, probably far from optimal. If they were to be CPU-bound, which they are in VS, writing them in python makes them around 100 to 1000 times slower.
Given VS architecture, the issue is compounded. There is no multithreading, so when VS is running AI graphics and everything else freezes. This means AI has to run very very quickly to remain smooth, and it simply cannot do that in pure Python.
So the worst bottleneck is impossibility to break at least graphics, generic physics / main game logic and some parts of AI into separate threads.
That is, the scripted autopilot is good only for handling less time-critical things, and not stuffing all and any standard functions into C code would be counterproductive. Of course.
If the bots (parts of AI choosing actions, such as reading XML aloud to the rest as it does now) were farther from real-time than the parts doing "match velocity" and suchlike, this probably won't ruin everything.
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

I modified the VS console - now possible to use shift for capital letters and special symbols
It helps a lot for development - at least it is possible now to see unit variables just typing in console :print VS.getUnit(num).getSomething and see output in stdout... and adjust velocity 'on fly'...
The current library for python in VS is beautifull, give access to most variables and thats what I wanted to get from the beginning...
I agree that we must uce C++ as muh as possible , but at the development stage for me is much faster to make autopilot scrip on python , test it , and then rewrite it on C++.
pheonixstorm
Elite
Elite
Posts: 1567
Joined: Tue Jan 26, 2010 2:03 am

Re: Modify physics -get rid of viscosi -underwater model

Post by pheonixstorm »

hmm wonder why it was turned off or taken out to begin with. Think you can get a diff ready to hit the experimental branch?
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

pheonixstorm wrote:hmm wonder why it was turned off or taken out to begin with. Think you can get a diff ready to hit the experimental branch?
I never knew myself. I don't think anyone that knows remains active.
So you have my blessing to re-enable it if you wish ;)
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

klauss wrote:
travists wrote:
pheonixstorm wrote: DING! lightbulb.. we already have something we can use once modfied. I can't remember the name, something to do with gun tracking I think. That could be a good start to attack the problem from aside from the math.
(There is a smiley for that :idea:)
Are you trying to remember auto-tracking/ITTS?
ITTS only gives you a direction. Not instructions of how to best accelerate the ship towards that direction, nor how early do you have to start turning around in order to start decelerating.

It's a chore, it's not rocket science if you don't have the same low-acceleration limitations, but it's still a lot of boilerplate and a lot of contingencies to take into account. A chore.
If this is how it is presently implemented, so be it. However, to remain true to the Wing Commander (esp. Privateer) roots of VS ITTS should calculate where the target will be when your blaster bolts get there, not just show you which direction it is going. In that case feed it your ship's speed instead and it will plot the course.
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Currently started fighting with orbital mechanics in VS.
The existing model uses the precalculated orbits , which are described with apogee (apsis) and perigee , some velocity and period.
This could work , but speed clamping doesnt let planets fly at realistical speed.
Now ,with gravity enabled,i am trying to disable orbits , put the planets to the apsis point , calculate the orbital speed , so it will pass peregee point , launch them and see what happens..
I made more correct model of sol system (added correct surface gravity for planets) and it will be the benchmark of the model...
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

First my VS success.
I redone the gravity simulation once more and fixed some small bugs...
Gravity really working!!!
I send the planets in sol system to fly on their orbits , and they fly as they should without any precalculations -physics only.
The VS enjine can work - I can fly from planet to planet... Only SPEC gives some hard time - It have problems going to planet flying several km/s speed ..But even now if you sycronize speed with a planet before- you can fire spec and reach/.

In the generated systems the gravity is generated based on the planet mass wich is calculated from radius and type (star gas rock) - then the orbital vector calculated according to their location to parent planet - and they are fired in that direction and fly forewer ..I hope..
Also I made xml to enablee- disable OGRE planet...
charlieg
Elite Mercenary
Elite Mercenary
Posts: 1329
Joined: Thu Mar 27, 2003 11:51 pm
Location: Manchester, UK
Contact:

Re: Modify physics -get rid of viscosi -underwater model

Post by charlieg »

Patches to http://dev.vega-strike.org please!!
Free Gamer - free software games compendium and commentary!
FreeGameDev forum - open source game development community
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

Sounds very cool, BEZ_BASHNI! Have you worked with stations yet? Can we have a script to calculate Lagrangian points to drop some stations in, others in orbit around key planets? To test this drop an object the mass of the ISS at the orbital height and speed of the ISS and see what happens.
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Stations are orbiting around their planets also.
Everything which is in \sectors.xml file or generated is orbiting around base planets.
I thried to jump and dock station which is orbitig around moon ,wich is orbiting around earth ,wich is orbiting around sun..
It is possible if you syncronize velocity first....Now I am trying to change code to let SPEC synchronize the velocity with a target - at least it's 'forward directional' componet...

If gravity is set inside xml file it is used - othervise it is calculated...
The apsis points is got from the same xml - the planet is placed to the apoapsis point ,which is got from xlm and launched with the velocity ,calculated , so that the planet will pass apoapsis and periapsis, also got from xml. I didnt find where the orbital plane is set - so the orbital plane is defined by centerplanet to apoaxisi vector and one of the coordinate axises. In future we can add a vector wich will be used to defile the orbital plane to make 100% astronomically -correct systems. The time wich is inside xml can be used to set a planet's starting point on the orbit.


I made a stability test and launched the system for 24+ hours - I put a station on a 350 km round orbit around earth (close to real ISS orbit) .After initialisation it was launched with a correct velocity, I jumped to it, syncronized velocity with planet, activated flight com to sit in one point and observed the station passing near me every 95 minutes... Very close to real ISS period.
Some orbit precession occur in the test due to the moon influence, as it happens in reality...So VS can be used for educational purposes also now.

About Lagrangian points - I think they must be the places for were you can make a jump to another system's Lagrangian point.
Also thought about SPECS drive physical background.. If we imagine the ship have a powerful engine which can accelerate it with 1000g we need an artificial gravity source in a nose of the ship with at least 995g (the human body cannot stand >5g for a long time) . If we switch on such a source it will start affecting nearby objects - tracktoring nearby ships and pushing your ship to nearby planet...Any mass movement will eat energy-so we will not be able to move planets with the capabilities of the ship's reactor -so we will overload it and will need to reduce gravity and acceleration..
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

I think it would be easier to assume an "acceleration absorber" (the term Wing Commander used) is directional and has a limited range, so can be safely ignored.
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Looked trough the weapons in VS- the situation is sad imho.
The beams uses sequence to check -step-by step collision tree, lookin mostly at the target unit - -no friendly fire - no damage at high traversal...Now trying to make 'normal' long-range laser for vs ,who will make quick 1-step check for for bounding spheres...
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

BEZ_BASHNI wrote:Looked trough the weapons in VS- the situation is sad imho.
The beams uses sequence to check -step-by step collision tree, lookin mostly at the target unit - -no friendly fire - no damage at high traversal...Now trying to make 'normal' long-range laser for vs ,who will make quick 1-step check for for bounding spheres...
Are you sure about that?

I'm not... because you can hit targets without selecting them. Tractor beams for instance do that.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

I think I may have been on the receiving end of friendly fire. You can certainly hit targets flagged as friendly. A weapon rework is not unnecessary, but I would agree that checking the net result of all the code (play the game) would be better than blindly reworking because of how the code should work. (Should and computers just don't mix)
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

travists wrote:(Should and computers just don't mix)
Should and computer code, rather. It's not the computer, is the person reading the code. With gargantuan code as in the case of VS, it's easy to think you know how it should work and be missing a crucial part.

Like, IIRC, that both beams check against units, and units against beams. So, while maybe in one direction it's only checking against the target, the opposite direction will probably check against the beam nevertheless.

In any case, I do think there are bugfixes to be applied to beam collision checking. There just are too many glitches ingame to be considered OK code.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

I was wrong.. But not completly.
What it actually does:
1. Checks for collision with activetarget.
2. Cycle the rest of the collideble units...
Some other perfomace issues ..(calculatios of vector angel,ets)

So friendly fire possible , but you can shoot through unit and hit one behind if that's marked target.

How it should be done-: during the initialization make check for bounding spheres-1-line formula -distance_between_line_and_point <raY-radius+shpere_radius =we addd unit to collisioners list bublesorting them along range onetime.
Closest unit in a collision list gets damage.
For a short pulse lazer it will be fast and effective.
If we want constant beams to intercept fast moving units between frames (vich vs cannot handle now) it will be a little more tricky , but it looks like theres a simple math way to do it.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

BEZ_BASHNI wrote:I was wrong.. But not completly.
What it actually does:
1. Checks for collision with activetarget.
2. Cycle the rest of the collideble units...
I see, so if it hits the active target and someone gets in the way, the someone won't be hit, only the active target.

Since we have many beams with infinite propagation speed in the game (this issue would be fixed with slower propagation speeds), we have to fix this, and check all collideables anyway. I can see how this would be a performance issue, though. Will have to think about this a bit.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
BEZ_BASHNI
Merchant
Merchant
Posts: 53
Joined: Wed Nov 16, 2011 7:00 pm

Re: Modify physics -get rid of viscosi -underwater model

Post by BEZ_BASHNI »

Started testing playability....The auto -generated systems put planets to close to each other - which makes them to spin with an annormal angular speed.
Trying to fix...
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Modify physics -get rid of viscosi -underwater model

Post by klauss »

Be careful, you can't set 100% realistic scales.

It was tried at sol, and it produces some sever precision artifacts, even with all the tricks VS employs to avoid them.

I think sol is at the limit, which is 1:10 scale.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
travists
Expert Mercenary
Expert Mercenary
Posts: 893
Joined: Thu Jul 08, 2010 11:43 pm
Location: Sol III North American Continent

Re: Modify physics -get rid of viscosi -underwater model

Post by travists »

that would necessitate reducing the mass of the planets and stars proportionately...

keeping the density the same that would mean setting mass at about 1%?


That can't be right :x
Post Reply