react-native-game-engine-template icon indicating copy to clipboard operation
react-native-game-engine-template copied to clipboard

bug when launched

Open x5engine opened this issue 6 years ago • 9 comments

bug when I start the app

Possible Unhandled Promise Rejection (id: 1):
Object {
  "bubbles": false,
  "cancelable": false,
  "currentTarget": XMLHttpRequest {
    "DONE": 4,
    "HEADERS_RECEIVED": 2,
    "LOADING": 3,
    "OPENED": 1,
    "UNSENT": 0,
    "_aborted": false,
    "_cachedResponse": undefined,
    "_hasError": true,
    "_headers": Object {},
    "_incrementalEvents": true,
    "_lowerCaseResponseHeaders": Object {},
    "_method": "GET",
    "_requestId": null,
    "_response": "",
    "_responseType": "arraybuffer",
    "_sent": true,
    "_subscriptions": Array [],
    "_timedOut": false,
    "_trackingName": "unknown",
    "_url": "file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540anonymous%252Freact-native-game-engine-template-84bbb24a-c938-4264-8faa-dee7c0874acc/ExponentAsset-096ec86bf44273b6524c161d5cfc9aff.fbx",
    "readyState": 4,
    "responseHeaders": undefined,
    "status": 0,
    "timeout": 0,
    "upload": XMLHttpRequestEventTarget {
      Symbol(listeners): Object {},
    },
    "withCredentials": true,
    Symbol(listeners): Object {
      "abort": Object {
        "kind": 2,
        "listener": [Function anonymous],
        "next": null,
      },
      "error": Object {
        "kind": 2,
        "listener": [Function anonymous],
        "next": null,
      },
      "load": Object {
        "kind": 2,
        "listener": [Function anonymous],
        "next": null,
      },
      "progress": Object {
        "kind": 2,
        "listener": [Function anonymous],
        "next": null,
      },
    },
  },
  "eventPhase": 2,
  "isTrusted": false,
  "target": XMLHttpRequest {
    "DONE": 4,
    "HEADERS_RECEIVED": 2,
    "LOADING": 3,
    "OPENED": 1,
    "UNSENT": 0,
    "_aborted": false,
    "_cachedResponse": undefined,
    "_hasError": true,
    "_headers": Object {},
    "_incrementalEvents": true,
    "_lowerCaseResponseHeaders": Object {},
    "_method": "GET",
    "_requestId": null,
    "_response": "",
    "_responseType": "arraybuffer",
    "_sent": true,
    "_subscriptions": Array [],
    "_timedOut": false,
    "_trackingName": "unknown",
    "_url": "file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540anonymous%252Freact-native-game-engine-template-84bbb24a-c938-4264-8faa-dee7c0874acc/ExponentAsset-096ec86bf44273b6524c161d5cfc9aff.fbx",
    "readyState": 4,
    "responseHeaders": undefined,
    "status": 0,
    "timeout": 0,
    "upload": XMLHttpRequestEventTarget {
      Symbol(listeners): Object {},
    },
    "withCredentials": true,
    Symbol(listeners): Object {
      "abort": Object {
        "kind": 2,
        "listener": [Function anonymous],
        "next": null,
      },
      "error": Object {
        "kind": 2,
        "listener": [Function anonymous],
        "next": null,
      },
      "load": Object {
        "kind": 2,
        "listener": [Function anonymous],
        "next": null,
      },
      "progress": Object {
        "kind": 2,
        "listener": [Function anonymous],
        "next": null,
      },
    },
  },
  "timeStamp": 1571089175148,
  "type": "error",
  Symbol(stop_immediate_propagation_flag): false,
  Symbol(canceled_flag): false,
  Symbol(original_event): Object {
    "type": "error",
  },
}

x5engine avatar Oct 14 '19 21:10 x5engine

Has anyone been able to solve this?

vitalspace avatar Jan 08 '20 08:01 vitalspace

@HadrienRivere @x5engine

Sorry dudes, not sure how I missed this issue! First time I'm seeing it.

I used the template over the weekend on NodeJS 8.9.4 and NPM 6.9.0, it worked fine.

Can I get the following details of you guys:

  • NodeJS, NPM
  • OS
  • Expo version
  • Simulator + details
  • Device + details
  • DId you make any changes to the template or are you basically running it after cloning?

bberak avatar Jan 08 '20 11:01 bberak

@HadrienRivere @x5engine

Sorry dudes, not sure how I missed this issue! First time I'm seeing it.

I used the template over the weekend on NodeJS 8.9.4 and NPM 6.9.0, it worked fine.

Can I get the following details of you guys:

  • NodeJS, NPM
  • OS
  • Expo version
  • Simulator + details
  • Device + details
  • DId you make any changes to the template or are you basically running it after cloning?

Hello, thanks for answering.

Here is more details about the problem:

Node Version: v12.8.1 Npm Version: 6.10.2 Os; Windows Expo version: 3.11.3 Simulator : N/A Device: Motorola e5 plus, Basically when we run the npm start and wait for the program to be compiled, the screen in the divice goes dark and on the console throws the message described above. DId you make any changes to the template or are you basically running it after cloning? No.

vitalspace avatar Jan 08 '20 16:01 vitalspace

just wait another 4 months for a response

x5engine avatar Jan 08 '20 22:01 x5engine

Hi @HadrienRivere,

Can you replace game/index.js with:

import React from "react";
import { View } from "react-native";
import { GameEngine } from "react-native-game-engine";

const sys = entities => entities;

function Circle() {
  return <View style={{ backgroundColor: "red", width: 50, height: 50, borderRadius: 50, left: 100, top: 100 }} />
}

class Game extends React.Component {
  render() {
    return (
      <GameEngine
        style={{ backgroundColor: "black" }}
        systems={[sys]}
        entities={{
          test: { renderer: Circle }
        }}
      />
    );
  }
}

export default Game;

I just want to see if anything shows up on the screen. I suspect its a permission thing with downloding .fbx files, or perhaps expo isn't packaging them properly or at all.

I'll hop on my Windows machine after work and give it a shot.

bberak avatar Jan 08 '20 23:01 bberak

Hi @HadrienRivere,

Can you replace game/index.js with:

import React from "react";
import { View } from "react-native";
import { GameEngine } from "react-native-game-engine";

const sys = entities => entities;

function Circle() {
  return <View style={{ backgroundColor: "red", width: 50, height: 50, borderRadius: 50, left: 100, top: 100 }} />
}

class Game extends React.Component {
  render() {
    return (
      <GameEngine
        style={{ backgroundColor: "black" }}
        systems={[sys]}
        entities={{
          test: { renderer: Circle }
        }}
      />
    );
  }
}

export default Game;

I just want to see if anything shows up on the screen. I suspect its a permission thing with downloding .fbx files, or perhaps expo isn't packaging them properly or at all.

I'll hop on my Windows machine after work and give it a shot.

Hi. Now I have the following.

screenshot

Console:

console

vitalspace avatar Jan 09 '20 00:01 vitalspace

Okay, it must be something with .fbx extension. I wouldn't be surprised if the .glb extension also didn't work.. Can you undo what we did abouve ^^ and replace game/entities.js with the following:

import { THREE } from 'expo-three';
import Camera from "./components/camera";
import Cuphead from "./components/cuphead";
import HUD from "./components/hud";
import Turntable from "./components/turntable";
//import Droid from "./components/droid";
import Portal from "./components/portal";
//import Jet from "./components/jet";
import { clear } from "./utils/three";
import * as OIMO from "oimo";

const scene = new THREE.Scene();
const camera = Camera();
const world = new OIMO.World({ 
    timestep: 1 / 60, 
    iterations: 8, 
    broadphase: 2,
    worldscale: 1,
    random: true,
    info: false,
    gravity: [0, -9.8 ,0] 
});

export default async () => {
	clear(scene);
	world.clear();

	const ambient = new THREE.AmbientLight(0xffffff, 1);
	const sunlight = new THREE.DirectionalLight(0xffffff, 0.95);

    sunlight.position.set(50, 50, 50);

    scene.add(ambient);
    scene.add(sunlight);

	camera.position.set(0, 2, 6);
	camera.lookAt(new THREE.Vector3(0, 0, 0));

	const cuphead = await Cuphead({ y: 1 });
	//const droid = await Droid({ y: 1 });
	const portal = await Portal({ y: 1 });
	//const jet = await Jet({ y: 1 });
	
	const turntable = Turntable({ parent: scene, world, items: [cuphead, portal] });	
	const hud = HUD();

	const entities = {
		scene,
		camera,
		world,
		//droid,
		cuphead,
		portal,
		//jet,
		turntable,
		hud
	}

	return entities;
};

bberak avatar Jan 09 '20 08:01 bberak

Okay, it must be something with .fbx extension. I wouldn't be surprised if the .glb extension also didn't work.. Can you undo what we did abouve ^^ and replace game/entities.js with the following:

import { THREE } from 'expo-three';
import Camera from "./components/camera";
import Cuphead from "./components/cuphead";
import HUD from "./components/hud";
import Turntable from "./components/turntable";
//import Droid from "./components/droid";
import Portal from "./components/portal";
//import Jet from "./components/jet";
import { clear } from "./utils/three";
import * as OIMO from "oimo";

const scene = new THREE.Scene();
const camera = Camera();
const world = new OIMO.World({ 
    timestep: 1 / 60, 
    iterations: 8, 
    broadphase: 2,
    worldscale: 1,
    random: true,
    info: false,
    gravity: [0, -9.8 ,0] 
});

export default async () => {
	clear(scene);
	world.clear();

	const ambient = new THREE.AmbientLight(0xffffff, 1);
	const sunlight = new THREE.DirectionalLight(0xffffff, 0.95);

    sunlight.position.set(50, 50, 50);

    scene.add(ambient);
    scene.add(sunlight);

	camera.position.set(0, 2, 6);
	camera.lookAt(new THREE.Vector3(0, 0, 0));

	const cuphead = await Cuphead({ y: 1 });
	//const droid = await Droid({ y: 1 });
	const portal = await Portal({ y: 1 });
	//const jet = await Jet({ y: 1 });
	
	const turntable = Turntable({ parent: scene, world, items: [cuphead, portal] });	
	const hud = HUD();

	const entities = {
		scene,
		camera,
		world,
		//droid,
		cuphead,
		portal,
		//jet,
		turntable,
		hud
	}

	return entities;
};

Hi. good morning.

It seems that now everything is going right. now it clearly loads the game. there is only one detail, the cuphead entity is static. it moves under its axis but that does not advance beyond where it is generated.

img

console:

console

vitalspace avatar Jan 09 '20 17:01 vitalspace

Hi @HadrienRivere,

When you swivel the "touch stick" on the left, Cuphead should cyle through some sprite animations. Is that working? If you hit the "a" or "b" buttons some boxes and cylinders will fall from the sky.

Other than that, that's about all it does.. I use this repo as a starter for working with the React Native Game Engine library. It contains a bunch of systems and renderering effects that may be useful to others. But it definitely isn't a playable game.

Cheers.

bberak avatar Jan 11 '20 00:01 bberak