Re: Few questions

Here one way to do a timer :

t = 0 -- timer t
startTimer = 0 -- timer off by default
timerInterval = 3*60 -- timer interval : here 3 seconds
timerLoop = 0 -- if you want the timer to loop, set timerLoop = 1

function onSceneUpdate()

    if isKeyPressed("X") then
        startTimer = 1
    end

    -- timer
    if startTimer == 1  then
        if t == timerInterval then
                print("time up !")
                t = 0
                if timerLoop == 0 then
                    startTimer = 0
                end
        end
    end

    -- increment t
    if startTimer == 1  then
        t = t+1
    end

end

Re: Few questions

PunBB bbcode test
working perfect, many thanks !

Re: Few questions

Sorry my English is very bad I use a translator.

I have a question about maratis:

Hiding away the game resources ( images, models, sounds, or scripts) from the end user, in multifiles
Whether Maratis will include the right tools and built-in features for creating and loading container files.

Re: Few questions

it's actually not featuring this,
but it will planned in the future, I hope to find contributors help for this.

Re: Few questions

Hi again ! some new questions :

Deactivate

Deactivate function is only hiding an object, but the object is still there and interacts with others objects (collisions etc)
Is it normal or bug ?

GUI exemple : interaction between scenes

I have trouble with the GUI exemple,
Is it possible to make it share the same LUA script between scenes ?

I mean, when you start Scene-1, only Scene-1 LUA script is taken in account
GUI scene script is ignored, even if you assign him the same script than Scene-1

Effect question

http://www.youtube.com/watch?v=rRByoE2Avpw#t=1600
Any idea on how to reproduce that effect, i mean the color stream who follow the weapons ?

Re: Few questions

Hi,

for deactivate in script, it's maybe a bug, it should not continue to collide, I'll have a look at that, thank you for reporting.
For now you can deactivate the object and set the position far away.

Abour GUI exemple, and in general, there is only 1 script launched at a time,
and it is the one from the current scene (Scene-1 in this exemple).

And for the effect, there is 2 ways you cand do something similar :

1 - animate the effect by hand in blender, make a two-sided mesh looking like the shape you want (here an arc), and in the material (when you are in Maratis render mode), set "additive" blending. You can also animate the texture offset to make a fade effect (use a fade texture going from clear to dark (in additive black is invisible)). If necessary, use some bones to deform the effect mesh.

2 - make the effect by programming (more complicated) using the c++ SDK. First in blender create a small polygon attached to the blade and set a transparent material (for it to be invisble). Then in c++, you can find this polygon according to the material and extrude it dynamically.

But, in the video you sent, I think it's done by hand (like in 1).

Re: Few questions

Thanks, i go for the method 1
firsts test were already nice wink

Re: Few questions

Hi I have also some general questions about levels.

1) if we load mesh in the methode "onbeginlevel" to create entities dynamically during the game , how can we free the memory already used to stock them, when the level is over and the "onendlevel" methode is called ?

2) if I use for example the methode "setLevel (pointortolevel2) " during an update methode of a behavior, what happens exactly?

3) is it possible to create another way to exit the game than "escape" ?

Re: Few questions

Hi,

1) it's automatically cleaned.

2) "setLevel" should be used carefully, it should be only called using the MGame class at the end of "update()".
If you want to load a different level, it's better to use "loadLevel(const char * filename)".
Otherwise, "setLevel" just change the current level pointer.

3) You can use the code of MaratisPlayer (it's on svn) and modify it a bit, or even create your own independent player, it's very simple, there is a ready made vcproj (pc) and xcodeproj (mac).

Re: Few questions

Hi, I made a basic behavior to test the level permutation (level1 to level2 and level2 to level1) :

if(input->onKeyDown("C"))
    {
        MLevel* level = engine->getLevel();
        if (level->getSceneByName("Sc1"))
        {
         getGlobalFilename(levelx, workingDir, "levels/level2.level"); 
         engine->loadLevel(levelx);
        }
        else
        {
            getGlobalFilename(levelx, workingDir, "levels/level1.level"); 
         engine->loadLevel(levelx);
        }
    }

This work , but after 6-7 commutations (1-2 for levels using complexes shaders) maratis crash.

(maybe it's because of a lack of memory ... ?)

Re: Few questions

LoadLevel should be called only from the MGame class, because behaviors are parts of a level scene so it can cause crashes if it is called in the middle of the level update.

Use the same code you wrote in a custom MGame class at the end of the MGame::update() function. It should work.

Re: Few questions

Thanks, this time it's work wink

Re: Few questions

Hi, some other questions :

Camera FOV

I'm trying to make a zoom but i cant get camera fov changes working like "t = t + 1" stuff.
I tried many thing also with getCameraFov and also setCameraFov(Camera0, 60+1) but it doesnt matter what i do,
with 60 + 1 only +1 is applied and only one time (cant loop it)

Also i tried with a timer:

if t == 1 then
    setCameraFov(Camera0, 61)
end

if t == 2 then
    setCameraFov(Camera0, 62)
end

and so on, this one is working, but i doubt thats a good way to do :x

Shadeless materials

Is it possible to have a object not affected by light using the standard renderer ?

SponzaFPS with a gamepad

Tried the example with gamepad script but the view starts and never end to rotate (Z axis) just after i launch the game, any idea how to fix this ? (im using a PS2 gamepad)

Re: Few questions

this doesn't work ?
fov = getCameraFov(Camera0)
setCameraFov(Camera0, fov+1)

- Using the standard renderer, you can set the emit color to white for an object not affected by light.

- For the joystick, maybe you didn't calibrated it precisely (windows config pannel) ?

Or you can try to change this part in the script :

if dx > -0.2 and dx < 0.2 then dx = 0 end
if dy > -0.2 and dy < 0.2 then dy = 0 end
if dz > -0.2 and dz < 0.2 then dz = 0 end
if dw > -0.2 and dw < 0.2 then dw = 0 end

try using a  number bigger than 0.2 maybe.

Re: Few questions

an other way to zoom is to move closer the camera and the object wink

Here a very basic example in c++ (sorry I am not very good in Lua)

float zoomSpeed = 1.0; // the zoom speed
MOEntity* camera, cible; 
MVector3 vector = cible->getPosition() - camera->getPosition();
vector.getNormalize()*= zoomSpeed;
camera->setPosition(camera->getPosition()+vector);

I wish that this could help you wink

Last edited by Alinor (2011-09-08 08:14:56)

Re: Few questions

anael wrote:

this doesn't work ?
fov = getCameraFov(Camera0)
setCameraFov(Camera0, fov+1)

Damnit xD thats probably the only thing i didnt tried, and thats working ! thank you
Also thanks Alinor but C++ is like chinese for me, i dont even know where to put that :x

For joystick, it didnt fix the problem, i will try to recalibrate later on but
i doubt thats the prob, as im playing alot of games with my gamepad and never had that problem

And lastly, about shadeless objects, when you say set Emit to white, is just apply a texture like this or something else ?
PunBB bbcode test-PunBB bbcode test

I tried about 1hour with many differents options but its still not shadeless
i need some more info :x

Re: Few questions

you see the "Emit" value in "Shading" (in your right screenshot) is "0.0", set it to "1.0".

The "Influence" settings are not used in Maratis, exept the "Blend" :
http://www.maratis3d.com/wp-content/uploads/2011/01/11.jpg

Re: Few questions

The best i can get is a very bright (emit only) or very dark object (playing with diffuse,specular,hardness), but its still affected by light

Just to make sure,
I want that object to be shadeless in maratis with standard renderer (in the game), not fixed renderer

Re: Few questions

ok, I taught it was fixed renderer.
With a standard material, you can do :
emit = 1.0
diffuse = white (1, 1, 1) WARNING : don't forget the intensity factor set to 1.0
specular intensity = 0

This globally works,
but if you want something perfect, the best it to do a custom glsl shader.

Re: Few questions

Hmm writing GLSL shaders is out of my range, but nevermind, your method should be ok for what i'm trying to do
I was also thinking about put my object inside of a box (along with camera), toy around with double sided and see if it blocks the light

Thanks

Re: Few questions

Hi I have also some generals questions :

About engine c++ :

I have some probleme with the function "bool onKeydown(* char)" with keyboard symbols : the effect in maratis is quite similar to "bool isKeyPressed(* char)", I think that I should maybe use "void flush(void)" but I don't know how do it ...

About graphism :

can we create a function c++ who render a texture progressively transparent and finally set the visibilty of the object on "off" (using the function "setInvisible" (to erase object too far from the camera  for example) wink

Re: Few questions

Hi, i need a quick tip on :

getBehaviorVariable(object, behaviorId, « variableName »)
setBehaviorVariable(object, behaviorId, « variableName », value)

Im trying to make some kind of waypoints with the LookAt behavior for entities,
The idea is :

"box" with LookAt on object1
when "box" has reached object1, LookAt target change to object2
and so on.

But for now in all my tests theres no changes at all so i must do something wrong

Re: Few questions

If your behavior is the first on the list, behaviorId will be 0, the second will be 1 etc
"variable name" will be "target" for the LookAt behavior, and then you can set the variable.

try :
setBehaviorVariable(camera, 0, "target", "object2")



Alinor : I don't remember if we talked about your question, for the transparent effect, you can play with the "opacity" value of the object material. If your object is an instance (if the mesh is used by multiple entities) you'll have to make a copy of the mesh for each entity (in the constructor of the behavior for example).

Re: Few questions

Great, thanks smile

Also, nothing to do with that but, for my previous problem with  car / angular factor and weird collisions,

It was because i tried to make the car moving like a normal character (like in yofrankie with a player bounding box)
I completely forgot your PhysicsTest level in Demos, tried with that and theres no problem at all -.-

Re: Few questions

Vegas wrote:

for my previous problem with  car / angular factor and weird collisions,

It was because i tried to make the car moving like a normal character (like in yofrankie with a player bounding box)
I completely forgot your PhysicsTest level in Demos, tried with that and theres no problem at all -.-

At least on a single flat plane hmm
Still have problems on assembled meshes.
I uploaded the project : http://dl.dropbox.com/u/19970067/Questions/Drive.rar
It contains the car (exactly like in your example, and a flat road)