Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: fixed typing and separted code #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

esphung
Copy link

@esphung esphung commented Jan 5, 2024

📯   Description

Move to TypeScript ts(x) files so types, classes and code are up-to-date

📝   Summary of changes

  • src folder contents converted to ts (or tsx) files depending on what they return
  • standard modern RN boilerplate files added
  • added TS config files for handling editor configurations
  • *.d.ts file was stripped down an the appropriate types/interfaces sent to there correct components

🧪   How Has This Been Tested?

  • iOS builds and runs
  • Android builds and runs

@bberak
Copy link
Owner

bberak commented Jan 5, 2024

Thanks for your PR @esphung

I've added a couple of comments..

Just wondering if we need to build anything now (since we've moved the files over to TS) before publishing to NPM? Or is that unnecessary?

Also wondering if we should bump the major version on the package? I suppose you didn't make any breaking API changes -- so that might be overkill..

@esphung
Copy link
Author

esphung commented Jan 5, 2024

I was going to suggest adding an example app like what most standard RN libraries come with nowawdays; any create-react-native-library project. I wasn't sure how you would feel about that so I left it out.
Considering I have no idea what any of the previous code was doing, I think it would be wise for us to test it for a bit first. I am using the same code for a personal project, so I will be testing a few times a month. Go ahead and leave comments and I'll fix/address them to learn more about the package and we we feel comfortable about it, we can release it.
It's a small package, but I don't develop a lot of video games so I'm not a pro at building engines. I do, however, write native bridges between iOS and JS for a living so I'm confident this code will work for the most part.
Syntactically, it is correct, but, for example, I left 'Entities' without a type because I wasn't sure if that was intentional.
When/if you do end up shipping it,

I suggest we test until the end of the month and then release, after that, I can continue working on it and just make small commits.

PS: I can also add some unit test and GH actions. They are free for public repos

@bberak
Copy link
Owner

bberak commented Jan 6, 2024

Okey @esphung that's a good idea.. Let's test this PR/branch for a month (I'd like to test it with the latest version of Expo on iOS and Android) before merging into master and publishing a new version on NPM.

I was going to suggest adding an example app like what most standard RN libraries come with nowawdays;

There's an example app that accompanies this library where we can add examples etc: https://github.com/bberak/react-native-game-engine-handbook

I kept it separate to the core library because I didn't want to bloat the core engine with assets and other game-related resources

Syntactically, it is correct, but, for example, I left 'Entities' without a type because I wasn't sure if that was intentional.

Because this was originally a pure-JS library, we bolted on types after (and we kept some of the entity-related types quite loose, because they kind of are 🤷‍♂️)..

PS: I can also add some unit test and GH actions. They are free for public repos

Happy to hear more about this and how it would work ☺️

@bberak
Copy link
Owner

bberak commented Feb 25, 2024

Hey @esphung

I was testing out this PR today on a demo app, and I found the TS version to be very choppy in terms of registering touch events.. It's weird, the framerate seems good, but it's almost like the touch events are not being registered in a smooth stream.. It's hard to explain, but I've created a branch that replicates this issue:

If you run the Touch Events > Multi-Touch scene, you'll see what I mean. I can replicate the issue on both iOS and Android. I'm using real devices... I wonder if it's something to do with the changes to the moveThreshold parameter..

I tried to get some screen recordings of the issue:

smooth-js.mp4
choppy-ts.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants