Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name: Password:
Ambiera Forum > CopperCube > CopperCube Open discussion
Extended Javascript API and Showcase
Author Text

just_in_case
Moderator
Quote
2022-07-17 16:19:10

I am reserving this thread to post my developer log for the extended javascript API that I am creating for CopperCube, Hopefully, @niko will add all of them to the engine in future updates.

I will be posting list of stuff that I have already done in extending the API. I am going to post API command and what they will do.

here is the list:-

ccbSetMousePos(X,Y)
Sets cursor position to a location on the game screen

ccbGetAnimatedJointCount(animatednode) 
Returns the number of bones(joint) of an animated scenenode

ccbGetAnimatedJointName(animatednode,jointIndex)
returns the name of the bone(joint) of an animated scenenode, joint index is the index of bone it should be less than the AnimatedJointCount

ccbGetCurrentAnimationFrame(animatednode)
Return the current animation frame playing in the scene by the animated scenenode

ccbRenderToTexture(node, material index, camera, X resolution, Y resolution)
captures the scene from the provided camera's view and will apply it as a texture to the supplied node on the supplied material index. X and Y resolution shares the same buffer as screen, so it will be much better if you use your scrwidth and scrheight for X and Y res.

ccbGetTextureWidth(texture)
returns the size of the provided texture (width only).

ccbGetTextureHeight(texture)
returns the size of the provided texture (Height only).

ccbSetDopplerEffectParameters(DopplerFactor, DistanceFactor)
Allows you set the DopplerEffect to a different value, default is (1.0,1.0) that Coppercube uses. Works for 3D sounds haven't tested it with 2D sounds.
The value ranges from 1.0 to 10.0. This gives a nice effect for fast-moving objects like cars, missiles, or maybe if you add bullet sounds.

ccbPauseAllSounds(bool)
Pause and unpause all the currently playing sounds, depending on the boolean(true/false) provided.

ccbSplitScreen(cam1,x1,y1,x2,y2, cam2,x3,y3,x4,y4)

Allows you to split the screen into 2 camera views, you can specify the viewport coordinates for each camera marked as X and Y, Coordinates help in creating, a vertical split or horizontal split, at least one of them needs to be an active camera. This is not the same as ccbRenderToTarget(). This command needs to be executed in onFrameEvent.


ccbSetAnimationFromSceneNode(node1, node2, animationname)
Allows you to apply animations from node2 to node1, if they share the same skeleton(rig), super useful for people who work with Mixamo, now they don't have to apply animations individually to all of their animated nodes. Just apply all the animations to a single node and use the API command to apply the animation from that node to other nodes that use the same skeleton rig. ( Just added another parameter to it, you can now also define the animation name, that you want to play from another node).

More API will be added to the list.

Upgrades

Here goes the list of upgrades that I will be doing to the inbuild nodes and behaviors.

PlaybackSpeed
Added Playback speed attribute to the built-in SoundNode. You can now use it to play a sound faster or slower, It also automatically changes the pitch accordingly. Can be used to change pitch during runtime Like after the player drinks a poison, SlowDown the playback speed of sound, and many more.

Pause
Added Pause and Unpause boolean to the default sound node, Allow us to pause and unpause that specific node's sound during runtime.

But there are bugs with these upgrades, so not sure if they will make it to the release version. The only bug is It captures only one single sound node in the scene and doesn't detect attributes for multiple nodes. It can be an issue of the debug deploy, but maybe @Niko knows if it will get fixed automatically when deployed as a release.

More upgrades will be added to the list.


just_in_case
Moderator
Quote
2022-07-17 16:21:57

Here is showcase video of the ccbRenderToTexture API command, it can be used to create realtime reflections and mirrors in Coppercube, It is now possible to have dual camera rendering with this API, you can now easily create portals, mirrors and many more stuff.

Watch the unlisted video here on my YouTube Channel:-
https://youtu.be/X7E6xYsqGDE


Alireza
Guest
Quote
2022-07-17 16:41:32

That's amazing. I am impatiently waiting for the next updates.
I just hope the updates will be done soon.
And I also hope that you consider other platforms besides Windows (such as webgl and Android)
vazahat, will these new apis work for all platforms?


DouweDabbe
Guest
Quote
2022-07-18 07:01:34

Hi Just_in_Case

did you find ccb* commands / properties in the ccp source that
are not in the manual ???

also
if Irrklang library is included in the project source then its integration in the
coppercube editor is kept to a minimum ? No Sound FX,
missing file formats, and not for android/iPhone ?

refering to:
How to compile CopperCube game with C++ source using Microsoft Visual Studio
https://www.youtube.com/watch?v=PtLlcquFBx0
I saw the mousepointer, great!

at https://neophyte.cf I see many flags but
Coppercube is made near Vienna and the flag of Austria (the country) is still missing.
"Sei gesegnet Land der Erbsen, Land der Bohnen"



just_in_case
Moderator
Quote
2022-07-18 08:18:32

Hi, @douwedabbe, there are a few scripting command that are not in the manual, but No, the above command are created by me in the C++ source code, they don't come with the source. I implemented them in the Javascript API of Coppercube.

You can also extend the sound engine as well, and I am glad that you noticed the mouse pointer, I followed your advice to have a HALO around the cursor in order to highlight the mouse position.

Yeah, the Neophyte website now has translation, support. The flags you see there are on the basis of analytics, More users from those countries use the website, so I have made their language translation available there, flags are based on the language, they don't represent any country. but maybe I will make a dropdown to select all the flags in the future.


DouweDabbe
Guest
Quote
2022-07-18 09:34:20

Ah now I see why flags are there,
in the past there where also arabic users of coppercube,
but they have disapeared meanwhile.

Your site is becoming a neccesity for coppercube users!!!


just_in_case
Moderator
Quote
2022-07-18 18:18:52

Thanks, Mate for your kind words :)


Robo
Guest
Quote
2022-07-19 07:29:29

That's super cool 'just_in_case' - I hope Niko adds them to the release version for everyone to use...

I especially like the 'ccbGetCurrentAnimationFrame' command as then I can check when to play correct walking sounds for animated mesh with full body and also when to run the change animation speed (currently resets each time) so wont look so bad when run.


just_in_case
Moderator
Quote
2022-07-19 08:06:51

Thanks, @Robo, I wish the same that these upgrades will make into the released version. Just added the Doppler Effect parameters API and it sound great.


veganpete
Registered User
Quote
2022-07-19 08:44:04

Awesome! This will be great for storyboard animation in cutscenes and for in-game footstep sounds too - rather than using a timer or proximity events to detect when the feet hit the floor.

If "Animation Frame" =22, Play Sound "yippee-ki-yay.wav"


just_in_case
Moderator
Quote
2022-07-19 14:17:20

Thanks, @veganpete, Speaking of sound I have added some upgrades to the sound node, But there are a few bugs with it, but maybe it is due to debug deploy.

I will be adding more features, there is a lot of space for new things to be added in Coppercube now.



sulbcon
Registered User
Quote
2022-07-20 02:06:03

Thanks @just_in_case for dedicating your time to help us in the coppercube community.


Robo
Guest
Quote
2022-07-20 08:11:55

We have to get together and push Niko to add all these into the next update (around Christmas every year) as these are excellent additions and very much needed !

Pause sound - awesome, change sound pitch - fantastic, detect animation frame - brilliant, show mirror image - great, doppler effect - super cool!

Cheers 'just_in_case' - the game engine would be so much better if we can get these added in...

Will have to but your shader to support your great work..


just_in_case
Moderator
Quote
2022-07-20 09:19:23

I am thinking of making a video that showcases all the commands and upgrades that I have done, it will also give you guys an idea of how to use the commands, as some of the commands seems a bit complicated like the SplitScreen command.

@Robo Thanks, I too myself want to see them in the release as soon as possible. Maybe, if @Niko has time he can push updates every month with the help of other Community members who are extending the codes.

Regarding shaders, I have been more into understanding the C++ part right now, so you can say I took a break from shaders, but Yeah I do have the PBR Shader lying on my PC, it is complete but is a bit complicated to use, and I want to make it easier for the end user to set it up without much hassle. That is why I put it on hold until I found a way to make it less complicated.


Alireza
Guest
Quote
2022-07-20 14:46:37

I think it would be great if you could add another distortion parameter to the ccbRenderToTexture command, and we could do more with it. For example, reflections from a shiny metal or spherical glass surface.
Like this:
🔎︎



Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internati?nal" (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© 2020 Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact