Quantcast
Viewing all 2747 articles
Browse latest View live

Cocos-JS Native Build Instructions

@dylanwoodbury wrote:

Hi, I’m using Cocos2dx-JS v 3.17.1. I’ve built the game for web (Demo: https://playemojipop.com MUST BE PLAYED ON MOBILE MODE OR ON PHONE BROWSER). I want to compile the game for native devices but have been having difficulty (recent post).

I was wondering if anyone had up-to-date instructions for building the game on Android/iOS devices? Or any general advice or resources I should be looking at? Am a game designer by trade but having coding experience obviously. Thank you!!!

Posts: 1

Participants: 1

Read full topic


Cocos2d-x v4.0 crash on iphone which don't support metal.

@nirobkuet wrote:

Hello

I am working to upgrade my project to v4.0, I create a simple hello world project and run it on ios simulator. It’s working well in which simulator support metal (i.e, iphone 6s-ios13.2.2) but it’s crashing in which simulator doesn’t support metal (i.e iphone 5s-ios12.2).

Is it a bug in cocos2d-x v4.0 or I am missing something?

Thanks

Posts: 3

Participants: 3

Read full topic

cmake and v3 -> v4 migration

@FelixFox wrote:

In the new v3-v4 migration assistant you mention that one should use cmake to generate a new project. I know nothing about cmake. Is this a must ?

Can’t I just generate a project using cocos command line tools?:
cocos new -l cpp myNewProject ?

What is the advantage of cmake?

Congratulations to the team on the new release!

Posts: 2

Participants: 2

Read full topic

Unable to load images to create Sprite cocos2d-x 4.0 Xcode 11

@safwanahmed wrote:

I just installed cocos2d-x and start using with XCode 11. I created a Helloworld sample project with following commands from Terminal.

cocos new Test -p com.mindcob.readisdead -l cpp -d ./

cd Test
mkdir ios-build && cd ios-build
cmake … -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos

It’s working fine. I just copied the image HelloWorld.png, remain it to HelloWorld1.png and add that to project but code isn’t loading that while I’m creating Sprite. Please help me as I’ve wasted hours on that. Thanks

Posts: 3

Participants: 3

Read full topic

Adding image into mobile app through PC

@xxYxx wrote:

I’m trying to make an program launcher for my PC that runs on a mobile device. I’m using sockets to transfer the information from one device to the other. On the PC side, I can adjust the layout and which programs that can be launched whereas the mobile side only launches programs.

What I’m wondering is, how can I pass an image that I selected on the PC side to the mobile device to act as its icon.

Posts: 1

Participants: 1

Read full topic

Can everyone explain a little bit regarding cocos thread, jni thread, GLthread, main thread , ui thread ...?

@dragon0962 wrote:

Hi all,

Currently I have a little trouble regarding cocos thread, jni thread, GLthread, main thread , ui thread … ?

If I want to integrate third party lib on Android Platform , the best way I should write everything in AppActivity.java to make it run on Main Thread right ? ( for me , I created XXXHepler Class with some public static functions , I don’t know what thread it is working on )

As I know , JNIThread is another thread completely independent from the main thread ! If I want to run the java code in main thread , I need to call Image may be NSFW.
Clik here to view.
:slight_smile:

//context = AppActivity.getContext()
public static void functionNoReturnValue(){
Handler mainHandler = new Handler(context.getMainLooper());
mainHandler.post(new Runnable() {

    @Override
    public void run() {
        // run code
    }
});

but If I want to call one functon with return value in main thread , What should I do ?
Example:

//context = AppActivity.getContext()
public static double functionReturnValue(){

double result = 0.0;
Handler mainHandler = new Handler(context.getMainLooper());
mainHandler.post(new Runnable() {

    @Override
    public void run() {
        // run code
		result = getDoubleFunctionInMainThread();
    }
});

return result; // It always return 0.0
}

Thanks

Posts: 1

Participants: 1

Read full topic

Solution for HTTPS SSL HANDSHAKE Android Older versions

@Chino9 wrote:

Hi,

I want post the solution in the original posted message but i cant(i dont know if is related a permission in my profile), if someone can advice or copy this solution I will be grateful.

Original Post:

SSL23_GET_SERVER_HELLO error on Android 4.4.x

Problem: in older device (I tested with android 6.0.1, ando 4.4) when i send a remote request task for example a remote sprite and the server have cert(https), android not complete the task and in the log fount this problem:

Caused by: javax.net.ssl.SSLProtocolException: SSL handshake terminated: ssl=0x9869f3c0: Failure in SSL library, usually a protocol error
12-07 08:51:28.046 10002-10090/com.interactiveuy.divino W/System.err: error:100c5410:SSL routines:ssl3_read_bytes:SSLV3_ALERT_HANDSHAKE_FAILURE (external/boringssl/src/ssl/s3_pkt.c:972 0x9f9c4a00:0x00000001)
12-07 08:51:28.046 10002-10090/com.interactiveuy.divino W/System.err: error:100c009f:SSL routines:ssl3_get_server_hello:HANDSHAKE_FAILURE_ON_CLIENT_HELLO (external/boringssl/src/ssl/s3_clnt.c:750 0xab22459f:0x00000000)
12-07 08:51:28.046 10002-10090/com.interactiveuy.divino W/System.err:     at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
12-07 08:51:28.046 10002-10090/com.interactiveuy.divino W/System.err:     at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324)

I try many solutions i was founding in the web, creating my self ssl factory for example… but nothing work for me.

Solution: I update the libray used by android httpclient-4.4.1.1.jar for last httpclient-4.5.8.jar
You can download jar in this link:

httpclient-4.5.8.jar

replace path:
/YOUR_COCOS2D_PROYPATH/cocos2d/cocos/platform/android/java/libs

Rebuild and cross your fingers

I broken my head some days, and i want a share my treasure workaround.
GOOOD LINES OF CODES!!!
BYE

Posts: 1

Participants: 1

Read full topic

A problem with sprite shaders

@Jugival wrote:

A problem with sprite shaders.

I was trying to use shaders in the following way:

  1. I have created global GLProgram objects using GLProgram::createWithFilenames function.
  2. When a sprite needs a shader I create a GLProgramState with a global GLProgram object and assign it to the sprite (or use setGLProgram for existing GLProgramState objects).

The problem I encountered is that these GLProgram objects can not exists on its own. If they are not assigned to sprite they get deleted automatically and I am left with dangling pointers.

How can I preserve these GLProgram objects in a way that they would be used when needed?
Or is there another way to store shaders?

Posts: 3

Participants: 2

Read full topic


No SOURCES given to target

@digimikeh wrote:

Hi!
i have installed cocos into another machine (linux)
using Qt Creator as well, after successfully passed all installation instructions, i copied all my source and header files from my game, added the names to CMakeLists.txt but when i save it, it says:

CMake Error at CMakeLists.txt:140 (add_executable):
No SOURCES given to target

Any help?
thanks.

Posts: 2

Participants: 2

Read full topic

Integration of Android Game SDK

@stephenhurry wrote:

Google has just released their very first version v1.0.0 of the Android Game SDK, which will boost the performance of game on Android platform, plus, it is a library separated from the Android SDK itself:
https://developer.android.com/games/sdk/

As Cocos2d-X is comping to the v4.0 era with the metal support, the margin of iOS over Android in terms of stability, rendering performance has been widen, this would definitely not good to development of cross-platform games. Cocos team should look into the integration of this SDK seriously.

Posts: 1

Participants: 1

Read full topic

How to use dragonbone with cocos2dx-JS on native build

@developerkus wrote:

I completed design my animation with Dragon Bone(xml, plist, texture) but I can’t find any solution or example to use in Cocos2dx-JS on mobile device. I tried with ccs.armatureDataManager but always get exception read xml file athought xml format check is perfect.
Anyone can help me about this, please?

Posts: 1

Participants: 1

Read full topic

Black screen when hot update by using Asset Manager

@john_daniel wrote:

Hi everyone, I have an issue when I implement Asset Manager for hot update. After new resources download finished, I get problem when restart game, let me know if you need more info. Thanks.

  • Cocos2d-JS v3.17.
  • Xcode 10.1

Implement UPDATE_FINISHED event code:

case jsb.EventAssetsManager.UPDATE_FINISHED:
cc.log(“Update finished. " + event.getMessage());
// This value will be retrieved and appended to the default search path during game startup,
// please refer to samples/js-tests/main.js for detailed usage.
// !!! Re-add the search paths in main.js is very important, otherwise, new scripts won’t take effect.
var searchPaths = this._am.getLocalManifest().getSearchPaths();
cc.log(”***** Search path*****");
for (var i = 0; i < searchPaths.length; i++) {
cc.log(“searchPaths[i]);
}
cc.log(”*****");
// Register the manifest’s search path
cc.sys.localStorage.setItem(“search_path”, JSON.stringify(searchPaths));
cc.sys.localStorage.removeItem(this._KEY_DOWNLOADED_SIZE);

// Restart the game to make all scripts take effect.
cc.log(“End audio engine”);
cc.audioEngine.end && cc.audioEngine.end();
cc.director.purgeCachedData();
cc.loader.releaseAll();
cc.log(“Restart game”);
cc.game.restart();
break;

Console output

Update finished.

***** Search path *****
/Users/jonh_daniel/Library/Developer/CoreSimulator/Devices/85B1778C-A99A-4EEA-8EC6-974BA41B7922/data/Containers/Data/Application/6FF6C95D-7931-415D-A09A-A0F83CAD2F5C/Documents/remote_assets/


End audio engine
“/Users/jonh_daniel/Library/Developer/CoreSimulator/Devices/85B1778C-A99A-4EEA-8EC6-974BA41B7922/data/Containers/Bundle/Application/C3F17374-8C30-46D1-AAED-5FDB6B123432/MotalCombat-mobile.app/res/font/cam_stroke_32-export.png” rc=2 id=3 423 x 428 @ 32 bpp => 707 KB
“/Users/jonh_daniel/Library/Developer/CoreSimulator/Devices/85B1778C-A99A-4EEA-8EC6-974BA41B7922/data/Containers/Bundle/Application/C3F17374-8C30-46D1-AAED-5FDB6B123432/MotalCombat-mobile.app/res/logo.png” rc=2 id=2 321 x 321 @ 32 bpp => 402 KB
“/cc_2x2_white_image” rc=2 id=1 2 x 2 @ 32 bpp => 0 KB
TextureCache dumpDebugInfo: 3 textures, for 1109 KB (1.08 MB)

Restart game
basic_object_finalize 0x132c425e0 …
jsbindings: finalizing JS object 0x132c42610 (WebSocket)
jsbindings: finalizing JS object 0x132c42640 (SocketIO)
basic_object_finalize 0x132c42700 …
basic_object_finalize 0x132c42730 …
2019-12-10 10:20:49.028477+0700 MotalCombat-mobile[9934:253579] [si_destination_compare] send failed: Invalid argument
2019-12-10 10:20:49.028605+0700 MotalCombat-mobile[9934:253579] [si_destination_compare] send failed: Invalid argument
debug server : error creating/binding socket
Cocos2d-JS v3.17
JS: ScriptingCore:: compileScript fail:src/base.js
JS: /Users/jonh_daniel/Library/Developer/CoreSimulator/Devices/85B1778C-A99A-4EEA-8EC6-974BA41B7922/data/Containers/Bundle/Application/C3F17374-8C30-46D1-AAED-5FDB6B123432/MotalCombat-mobile.app/script/jsb_boot.js:431:Error: can’t open : No such file or directory

Evaluating main.js failed (evaluatedOK == JS_FALSE)
2019-12-10 10:22:19.108694+0700 MotalCombat-mobile[9934:253294] Received XPC error Connection interrupted for message type 3 kCFNetworkAgentXPCMessageTypePACQuery
2019-12-10 10:22:19.109244+0700 MotalCombat-mobile[9934:253294] Received XPC error Connection invalid for message type 3 kCFNetworkAgentXPCMessageTypePACQuery

Posts: 1

Participants: 1

Read full topic

Using BOX2D just for collision makes sprites get moved very fast

@abrajam wrote:

Hi, I putted a physics body to all my sprites that I want to check for collision, but I really not want to use the other physics features like gravity, friction, etc just need a more precise collision than just checking for intersection between bounding boxes.

The thing is that when I set physicsworld and physicbodies my characters get moving very fast compared to the movement made without setting a physics world. I move them on the game with setPositionY(getPositionY + speed * dt) I mean no physic forces, is there a way to prevent what is happening? Please give me some help because I think that they are kinematic bodies and shouldn’t be affected this way by the physics but somehow they do and I can’t find the setting to prevent it, also the documentation is out of my understanding and it differs between classical BOX2D and the implementation of cocos2d-x of this library.

On my scene I set this:

#if _USE_PHYSICS == 1

if (!Scene::initWithPhysics())
        return false;

//getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
getPhysicsWorld()->setGravity(Vec2(0.0f, 0.0f));
getPhysicsWorld()->setSpeed(0.0f);

MyBodyParser::getInstance()->parseJsonFile("Physics");

#elif _USE_PHYSICS == 0

if (!Scene::init())
    return false;

#endif

and in my characters like this, I vary the 3 parameters for Physics Material but I see no difference:

if (!Sprite::initWithSpriteFrameName(_ENEMY_IDLE_PATH))
    return false;

#if _USE_PHYSICS == 1
    auto phBody = MyBodyParser::getInstance()->bodyFormJson(this, "Enemy", PhysicsMaterial(1.0f, 0.0f, 10.0f));
    phBody->setDynamic(false);
    phBody->setGravityEnable(false);
    this->setPhysicsBody(phBody);
#endif

and like this:

if (!Sprite::initWithSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(filename)))
    return false;

setVisible(false);

#if _USE_PHYSICS == 1

auto phBody = MyBodyParser::getInstance()->bodyFormJson(this,
                                                        (_type == UP_BULLET) ? "BulletPlayer" : "BulletEnemy",
                                                        PhysicsMaterial(10.0f, 0.0f, 10.0f));

phBody->setDynamic(false);
phBody->setGravityEnable(false);
this->setPhysicsBody(phBody);

#endif

Hope somebody could help, thanks.

Posts: 4

Participants: 2

Read full topic

Failed to link program OpenGL error 0x0501

@digimikeh wrote:

Hi…
I get this error:
cocos2d: ERROR: compileProgram: failed to link program OpenGL error 0x0501 in /home/simo/Desktop/cocos2d-x/Akrasiel/cocos2d/cocos/renderer/backend/opengl/TextureGL.cpp updateData 207

By the way, my game still runs and nothing seems to work bad… so i suspect this is not a critical error, but does iti means?

Thanks

Posts: 2

Participants: 2

Read full topic

Visual Studio solution for cocos2d-x v4.0

@pccsoares wrote:

The Visual Studio project and solution is missing from cocos2d-x v4.0.
Any plans for adding it? Any way to create them?

Posts: 2

Participants: 2

Read full topic


Tile maps with Clipping nodes

@Barok wrote:

Hello wanted to ask about Clipping nodes
Will clipping nodes work with tile maps? I’ve seen the clipping node example and notice that it only worked on sprites.

if I parented the tilemap to the clipping node and then the clipping node to the scene, would it work the same way?

Posts: 5

Participants: 2

Read full topic

Android Studio 3.5 Error

@R101 wrote:

Is anyone else seeing this error pop up when a Cocos2d-x project is open in Android Studio 3.5.x?

Image may be NSFW.
Clik here to view.
image

Just need to know if anyone else is seeing it, because if not then it’s something specific to my setup.

Posts: 1

Participants: 1

Read full topic

Migrating resources?

@dogwalker wrote:

@slackmoehrle, can you point me to a post where there’s a good explanation for changing how I use resources on Windows (and maybe Mac, not sure) from the older 3.17 to the newer approach, and what I need to do. For example, do I move all my subfolders that are currently under Resources?

thanks again!

Posts: 7

Participants: 2

Read full topic

v4.0 PC Resources folder

@mark0x01 wrote:

Hello,

On the PC, I’ve always preferred to have NO ‘resource’ files copied from the resources directory into anywhere else each time I’d run the app/game. Up until Cocos2d-x 4.0, it was fairly straightforward to fix the issue each time just by backing out the changes from this commit: https://github.com/cocos2d/cocos2d-x/pull/10431/files, and then doing a few other tweaks here and there (remove the post build ‘copy’ event in VS, etc) to run the app or game using the resources right there where they already are in the resource directory.

What I am wondering is if somebody could point me to the relevant location for that - using Cocos2dx 4.0. I realize that all of that seems to be done using ‘CMake’ in this version - so I am finally biting the bullet and trying to learn how it works and how to use it. There seems to be a lot of CMake related files, and I’ve looked through them all and see spots that look related, but it is kind of daunting for a CMake noob. If somebody knew the exact file(s) that might deal with this one specific particular issue, it would be a great help as I get my feet wet learning CMake and how to use it with Cocos2d.

Thanks in advance!
-Mark

Posts: 3

Participants: 3

Read full topic

NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN

@Chino9 wrote:

Hi i have problem with android studio project, until yesterday was worked. But i think when i execute gradle update make this issue. From this moment i cant build the app because i have the followin message:

Gradle sync failed: executing external native build for cmake /Users/…/CMakeLists.txt (4 s 813 ms)

22:06 NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN

And in stacktrace show:

org.gradle.api.GradleException: executing external native build for cmake /Users/mexicanobermudez/Documents/workspace_divino/mobile/app/CMakeLists.txt
at com.android.build.gradle.internal.cxx.logging.ErrorsAreFatalThreadLoggingEnvironment.close(ErrorsAreFatalThreadLoggingEnvironment.kt:50)
at com.android.build.gradle.tasks.ExternalNativeJsonGenerator.buildForOneConfigurationConvertExceptions(ExternalNativeJsonGenerator.java:164)
at com.android.build.gradle.tasks.ExternalNativeJsonGenerator.buildForOneAbiName(ExternalNativeJsonGenerator.java:208)
at com.android.build.gradle.internal.ide.NativeModelBuilder.buildNativeVariantAbi(NativeModelBuilder.kt:149)
at com.android.build.gradle.internal.ide.NativeModelBuilder.buildAll(NativeModelBuilder.kt:97)
at com.android.build.gradle.internal.ide.NativeModelBuilder.buildAll(NativeModelBuilder.kt:38)
at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$ParameterizedBuildOperationWrappingToolingModelBuilder$1$1.create(DefaultToolingModelBuilderRegistry.java:138)
at org.gradle.api.internal.project.DefaultProjectStateRegistry.withLenientState(DefaultProjectStateRegistry.java:132)
at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$ParameterizedBuildOperationWrappingToolingModelBuilder$1.call(DefaultToolingModelBuilderRegistry.java:134)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOpera

I try download new NDK, Import again the project, Undate gradle version, and others worksarounds, but any was working.

I appresiate any colaboration.

THANKS

Posts: 2

Participants: 2

Read full topic

Viewing all 2747 articles
Browse latest View live