476

(17 replies, posted in External Tools)

ok,
that seems good.

- yes good idea (with an option you can un-check if possible)

- I agree, I tried to not export similar keyframes in a row but it still misses optimization like the
one you suggest.

- texture filename are made local like this "../maps/filename"
if you export the mesh in your-project/meshs/ path when your textures are already in your-project/maps/ path

- but yes a "copy maps" option can be useful if the textures are not in the good place,
it should just give a warning that if there is already textures in the maps folder with the same name it can be lost.


If you are interested (and if you have time), there is other improvements I had in mind
that I never had time to do, would you want to hear ?

477

(17 replies, posted in External Tools)

I have to say that I don't understand what you mean by "restrict  the export to Deform bones only"
can you give a clear example ?

478

(56 replies, posted in Editor)

Hi there,

I wanted to post some news about some development I'm working on,
there was some things to do around MGui (Maratis GUI system) and the window management
and I'm finally starting to see the end of the tunnel.

I had to modify the window system management to move to GLFW 3 and stop writing all the system
dependency manually, it will make things easier and we will benefit from GLFW community and tests.

The first benefit will be the possibility to handle separate windows on desktop, with multitasking.
GLFW 3 was totally reorganized and the logic is really good.

I also wrote a new image loader that uses FreeImage library (to stop using DevIL),
the development is more alive than DevIL's and the license is more permissive.

MGui was rewritten to be more flexible and dynamic, text drawing is now handled by MEngine and
can use standard fonts and unicode text (it will finally allow non-english users like russians to type text).

Here is the first glimpse of a color picker window :
http://www.maratis3d.org/wp-content/uploads/2013/08/MGui2-01.jpg

And right now I'm working on a generic GUI node system :
http://www.maratis3d.org/wp-content/uploads/2013/08/MGui2-02.jpg
That could be used to handle objects hierarchy, visual game logic etc.

So this is the good news,
the bad news is that I was forced to refactor a lot of MGui code and it broke a lot of compatibility,
there will be a lot of work to adapt MaratisUI...

When I have a viable base code I'll create a new branch on svn.
smile

Anaël.

Hi,

we would like to organize bug report better as the forum is too limited for this purpose,
it's hard to sort and follow the topics or to upload patches.

So please report bugs and patches here using the issue manager :
https://code.google.com/p/maratis/issues/list

Thank you all.

480

(7 replies, posted in General)

I updated the download page of Maratis website with a direct link to google code issue manager :
http://www.maratis3d.org/?page_id=57

I'll see what is possible with the forum, at least I'll add a post-it.

481

(1 replies, posted in General)

Hi and welcome ! smile

482

(7 replies, posted in General)

damvcoool > requests can be acceptable on the google thing if it's directly connected with code or development, for general requests and wishes it's better to keep it in the forum. There is an 'Enhancement' type in the issue panel so it's good.

Sponk > so maybe I'll close the forum thing and put a redirection on google code, as it supports uploading patches and a better bug management. Can you try to post your patch on it ? I'll see how I can make it clearer that bug and patches needs to be reported on google code with a link in the website and the forum.

483

(7 replies, posted in General)

one question is, should the bug report topic on the forum be closed to redirect all bugs/patchs on google code manager ?

484

(7 replies, posted in General)

For bug and patches there is already something on google.code (where Maratis repository is hosted) :
https://code.google.com/p/maratis/issues/list

485

(13 replies, posted in Scripting)

You can use a dot product between two normalized vectors :
http://images.tutorvista.com/cms/images/83/dot-product-image.PNG

ex :

pos1 = getPosition(object1) -- player
pos2 = getPosition(object2) -- enemy

-- get the direction of object2 if it's face is oriented toward the Y axis
dir2 = getRotatedVector(object2, vec3(0, 1, 0))

-- get the vector between object1 and object2
vec = pos1 - pos2

-- find the angle between dir2 and vec
dotValue = dot(normalize(dir2), normalize(vec)) -- dot product returns the cosinus of the angle
angle = math.acos(dotValue) -- get the angle in radian
angle = math.deg(angle) -- convert to degree

486

(13 replies, posted in Scripting)

- the 2D rotation example only uses basic lua math (math.sqrt, math.sin etc).

- I don't understand what you mean by "aiming acurracy range" or delta yaw angle.

487

(13 replies, posted in Scripting)

If you want to code a 2d rotation (around the angle Z only) you can use some arithmetic :

-- get 2d vector length
function getLength2d(vec)

    return math.sqrt(vec[1]*vec[1] + vec[2]*vec[2])

end

-- normalize 2d vector
function normalize2d(vec)

    length = getLength2d(vec)
    vec[1] = vec[1] / length
    vec[2] = vec[2] / length
    return vec

end

function lookAt(object, dir, rotSpeed)

    -- compute object X dir and Y dir
    rot = getRotation(object)

    zAngle = math.rad(rot[3])
    sinZ = math.sin(zAngle)
    cosZ = math.cos(zAngle)

    YDir = normalize2d({sinZ, -cosZ})
    XDir = {-YDir[2], YDir[1]}

    -- dot products for orientation and angle
    ori = (dir[1]*XDir[1] + dir[2]*XDir[2])
    angle = math.acos(dir[1]*YDir[1] + dir[2]*YDir[2])

    if ori < 0 then
        angle = - angle
    end

    rotate(object, {0, 0, 1}, math.deg(angle) * rotSpeed)

end

For a true 3d look-at, it's more complicated, you need to use a dot product to find the angle between the objects
and a cross product to find the rotation axis. It's better you use the look-at behavior directly.

488

(13 replies, posted in Scripting)

Hi,

for the look-at, you can use the look-at behavior (in the behavior tab), just write the name of the target.

To find the distance between objects in lua you can do :

pos1 = getPosition(obj1) -- use getTransformedPosition instead of getPosition if the objects are parented
pos2 = getPosition(obj2)
distance = length(pos2 - pos1)

"3d math" from the wiki : http://wiki.maratis3d.org/index.php?tit … tions_list

489

(6 replies, posted in Scripting)

first this two line need to be inside onSceneUpdate :
force = getCentralForce(Player)
speed = length(force)

but you are not using "force" or "speed" variables.

What is the problem with your script ? is it not compiling or just acting strange ?

I don't know what your script does exactly, but I can say that you should do "thrust cap" after "raise thrust\lower" and not before.

If you just want to add this velocity limitation we talked about, try to add this after "--Movement RCS" block :

force = getCentralForce(Player)
speed = length(force)

if speed > maxSpeed then
    addCentralForce(Player, force*(-0.1))
end

490

(6 replies, posted in Scripting)

I think you can do something like that in lua, I'm not sure how precise it will be but it should work.

you can try to normalize the force if the speed reach some amount :

force = getCentralForce(object)
speed = length(force)

if speed > maxSpeed then
    force = normalize(force)*maxSpeed
    clearForces(object)
    addCentralForce(object, force)
    -- you might need to do the same with the torque if you want to limit rotation speed too
end

or by applying an inverse force if you want it to be more smooth :

force = getCentralForce(object)
speed = length(force)

if speed > maxSpeed then
    addCentralForce(object, force*(-0.01))
end

491

(6 replies, posted in Scripting)

Hi,

do you mean like the object should behave normally with no damping but could not go faster than a certain velocity ?
or do you mean the object will be affected by a sort of resistance or friction ?

If you set the linearFactor 'z' to zero the physics will be 2d in translation.
For the rotation as I said it should work with a constraint, you can also reset one rotation axis to zero every frame in lua.

But yes I'll see if there is a way to enable per-axis angularFactor with bullet, if yes it won't be complicated to add.

493

(7 replies, posted in General)

He used blender particle hair, that was the problem as it cannot be supported like that in real-time, it need to be textured plane.

You can only lock torque on all axis with "angularFactor"
if you want to lock only one axis you need a constraint with a parent and an angular limit like :

AngularLimits
lox 0
loy 0
loz -180
upx 0
upy 0
upz 180

but you need to be clever with how you setup the parent if you don't want the parent to influence the collision shape,
also axis are local so be sure your parent orientation is like you want.

For example, if I continue on this random example, the way I would do it is like this :

- create a game plugin in c++ with 3 behaviors (player, enemy1, enemy2)
- a custom MGame class if necessary (for example to handle path finding or global events)
- the variables (speed, power) will be attached to each behavior so it will be possible to edit their value in-editor
- a custom draw function for the player behavior to draw the field-of-view in-editor as an helper
- custom script functions in c++ to call special actions from lua
- the scene specific logic in lua

Nistur, this was just a random example, as everything in it can be done already.

I'm just saying that a good starting point to plan gameplay tools, is a real game situation and it's need
(one looking like this random example).
To point out was is possible and what is not possible with the current version of Maratis.

There is a way in lua to control objects : http://wiki.maratis3d.org/index.php?tit … ng_example
it can be helpful for some entities, however everything need to be written in lua and cannot be manipulated by the editor compared to the behavior system.

It is seductive to think about a data editor inside maratis to manipulate game variables, I taught about it when writing the behavior system, but I realized that it will be hard to be flexible enough and anticipate what a game will need (float, string are easy, but maybe you will need to store a complex table, a matrix or else).

kirilz, you wrote you'd like to write the data definition in lua but operate it in c++, if you operate the data in c++ it means you have to know the structure of the data in your c++ code, so why no define the data in c++ ?

What I'd like to discuss, and it's what I try to ask Nistur too, is a practical situation in a game that can be studied, like :
- a game with one player and 2 types of enemy :
  - player : can move around a level. It's variable are : speed, life, score, field of view
  - enemy 1 : is attracted by player, touching the player reduce player life depeinding on it's power. It's variable are : speed, power
  - enemy 2 : is attracted by player when out of player field of view, and repulsed by enemy 1 if it's power is inferior as the one of enemy 1. It's variable are : speed, power

we should :
- be able to change the variables in-editor to fine-tune the game
- the entities interactions should be updated automatically
- I'd like to call special actions triggered in lua
etc

Hi,
welcome : )

- About require, nothing is preventing using it, but there is some limitation for now :
the dofile call has been modified to simplify the path search and to be able to access files inside a package transparently (npk packing), the same thing is not done yet for require.

- There is a behavior system to create complex entities behaviors, it can be extended in c++ using a game plugin, you can find some examples in maratis website and in the wiki (like "WaterDemo" implementing fish behaviors : http://www.maratis3d.org/?page_id=53).

The basics are explained here : http://www.maratis3d.org/?p=500

- the lua API is hand-written.

For contribution to the official dev we can talk by mail about the planned evolution and some themes you could be interested of. Big help is needed to make small games/examples to test the pipeline and show how Maratis can be used, there is some key features to develop or improve like the lua API, Android port, publishing pipeline, particles system, level of detail, basic behaviors etc

General roadmap in the wiki : http://wiki.maratis3d.org/index.php?title=Roadmap

499

(29 replies, posted in Showcase)

Hi, it looks very promising !
I'd like to see a video !

500

(2 replies, posted in Scripting)

it depends also how you want to push the chair,
do you want to push the chair in front of you (meaning the fps view) ?

if yes, you can use the same ray you used with "rayHit(V1, V2)" :

force = 10 --set the force you want
someVector = normalize(V2 - V1)*force

addCentralForce(Chair, someVector) -- call this only one time