Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > CopperCube Open discussion
Extended Javascript API and Showcase

just_in_case
Moderator
Quote
2022-08-03 14:19:25

@veganpete Your request has been served, just added an API to control the gametimer speed, which allows you to slow down or make the game faster.

here is a video showcasing the slow mo with the API command.
https://youtu.be/6d2vr59zOCo

you might not be able to get an Idea when I am executing the command, but whenever the scene slows down I am using the command to slow it down, you can see that it slows down the whole game, the particles,grass, animations and behaviors.

setting the speed to 1.0 make it normal again.


VP
Guest
Quote
2022-08-03 15:03:55

Wow- that's perfect! Thank just_in_case

This will be great for bullet cams and cut-scenes etc. Nice one!


just_in_case
Moderator
Quote
2022-08-03 15:36:30

yeah, we might also be able to use the same command to create pause screens too, all we need to do is to set 0 as the gameTimerSpeed and it will pause everything, setting the speed back to 1 will unpause it.
only drawback of this command is that anything that is not using the timer will still be able to run, for example FPS camera will still be able to look around in the scene without, but won't be able to move into scene but can be used to look around. As it is using the mouse input to rotate the camera.
so if you have something like on a key pressed, change position of a scenenode to somewhere else, it will still move the player to a location.
even if the game timer is stopped or set to 0.

so thats a limitation, orherwise it can be used for pausing the game as well, but I think an additional API for actually pausing the game is needed, maybe the sleep command will do the job if I put a huge time for the sleep there, and then create a method to break the sleep or wake the device.


Robo
Guest
Quote
2022-08-04 09:38:32

In short I need textures not affected by Directional light only Point lights (for indoors) and only way I know is to add normal maps textures. The inbuilt 2 materials just dont work well enough for this....both 18 and 19

18 'normalmap_trans_add' - does work half way but also the textures is half way transparent and so the underlying objects underneath the mesh with tranparent textures show through the surface when they should be partially hidden and thus if we could change the transparency amount of this material would fix most problems up.

19 'normalMap_trans_vertex_alpha' - rarely works as intended and when it does very very fussy over what colors in the texture to use - might work ok if we could also adjust the tranparency level as above but Im thinking 18 'normalmap_trans_add' may be the best one to use for this purpose...

see attach picture..

[image/http://lasttrump.net/images/trans.png]

http://lasttrump.net/images/trans.png


just_in_case
Moderator
Quote
2022-08-05 06:25:41

ahhh okay, that might be hard cause, all of the internal materials are using global parameters for the lighting, so if we turn it off for one material, then it will be off for all the textures or objects that are using the same material... adding a toggle for that will be an editor enhancement and as we don't have access to editor code, it's a bit hard, we can however add this is an API too, but that will require modifying the inbuilt materials as well, and my skills aren't yet that good that I can fiddle with inbuilt Materials.

regarding the inbuilt materials for transparency as I said in my previous post, material type "Normal_map_with_vertex_Alpha" will only work if you have vertex transparency, it has nothing to do with texture you are using, you need to change the vertex color of your model. So this is obvious why it didn't work for you. Simply, apply this material to anymodel and then right click on that model, go to modify and click clear vertex color, and you will get to know what I mean. You can vertexpaint your model with transparency and can import it as a .Dae model file, because it supports importing with the the vertex color and can then use this "Normal_Map_with_vertex_alpha" on that and it will work for you.

For the "Normal_map_with_transparent_add", no there is no opacity control for that, and I am not sure If I will be able to add that for the other additive transparent material as well.

meanwhile, you can try using my custom light shader, it doesn't get affected by directional lights, and works with transparency with normal mapping as well, I am not sure if the issue that you were having with your Coppercube version that we talked about is resolved or not, but you can give it a try.


Robo
Guest
Quote
2022-08-05 10:46:02

ok, thanks 'just_in_case' for the feedback.
I didnt know about the vertex alpha thing but makes sense...I guess this might work well for fairly detailed mesh models but simple polygons would not be very accurate, then again maybe the transparency level could be adjusted this way for the vertex alpha one....cheers

Unfortunately haven't had any luck with the latest version of the point light shader...my pc runs differently than yours obviously for unknown reasons...and still getting the 4th point light to switch on/off when using the shader....will try older versions..


DouweDabbe
Guest
Quote
2022-08-11 16:45:56

How about using the editor text boxes in games as well?

in the cc editor you can use the:
- alert()
- prompt()
- confirm()
text boxes for testing in the scripting window and
for comments an output in plugins etc.

I find them handy also for in game debugging as the debug panel is fixed in size and location.
They are easy, flexible and quick to format with text.


just_in_case
Moderator
Quote
2022-08-13 02:50:52

@DouweDabbe, they are editor commands, and the boxes that shows up is for editor only they uses the wxWidgets library.
and unfortunately we don't have any access to the editor source, so we can't really bring changes to the editor related stuff, only @Niko can.


Robo
Guest
Quote
2022-09-09 04:48:09

I was wondering if the default CC spot light could be adjusted to allow it to turn or rotate with the player - or at least have access to the Directional properties and dynamically changed during runtime ? - This is the only real problem in my game I haven't been that happy with as of yet.

The torch shader is great but doesn't work with all the other point lights at the same time. Using a vignette can work but needs a darker background overlay by default and you switch the vignette on to have proper light changes that look correct plus it brightens the sky which doesn't look right also.

I think the inbuilt spot light would be good if it could rotate and solve my problems else have the torch shader (you made) also work with point lights....


just_in_case
Moderator
Quote
2022-09-09 07:32:41

I think this can be done, I will look into this, it only requires an additional property attributes direction just like the directional light, meanwhile, if you want you can set the direction of the spotlight with the help of javascript.

With the help of the script convert the light to the directional light and set its direction to the camera target if you are using FPS camera or set it to the desired location like in front of the player to simulate a flashlight.
And then immediately turn it into a spotlight, you can do this on everyframe. I am not sure though if this will affect the lighting or not but It may change the direction of the spot light.

and if you only want to create the flashlight then simply create a fixed direction during the start of the game and then make the spotlight children of your player, make sure there is a bit difference in the position of the player and the light so that it can rotate the spotlight when the player rotates.

Edit:- just tried it myself and found that "LighType" also don't return as a property so, yeah the above method also won't work. Will have to add them as real attributes to the scnenodes. Will try to add them


Robo
Guest
Quote
2022-09-10 15:10:35

ok - cheers.

Another problem I just noticed about Spot lights is that only the "Color" property field can be changed with code during runtime and when you do it reverts the Attenuation back to default value of (0.0, 0.066667, 0.0) everytime (which affects the brightness value).

So you cant even change the color dynamically....maybe this is a bug that can be fixed so that at least the color can be changed for adjusting brightness as the "Radius" only works with Point lights....


Robo
Guest
Quote
2022-09-11 23:50:03

Spot Light update:

Success! - you can change spot lighting strength with only using the "Color" property. I just had to increase the fixed 'Radius' of the Spot light as well as change the 'AmbientColor' to something like (10,10,10) and then I could basically turn on and off the spot light from nothing to full strength, so it does work...


Robo
Guest
Quote
2022-09-12 02:35:52

Point lights could be a lot better if we could adjust the strength of the light and not just the radius.

That way we could have higher local bright areas giving a deeper mix of dark and light areas for better effect.


Insane
Guest
Quote
2022-09-12 21:44:39

wow! Any chance that you can include websocket networking support, so that we do not have to use the command line?


just_in_case
Moderator
Quote
2022-09-13 10:49:52

@Robo, you can increase or decrease the attenuation for the point lights in irrlicht/irredit settings to control the strength of pointlights.

@Insane I am still learning basics of C++, my skills aren't that advanced that I can add networking support. Right now I am utilizing elements that are already in the irrlicht API that Coppercube uses. Maybe in future I will be able to do that.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "?nternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact