Comments (7)
That's great feedback. All the feedback has been that it's too difficult. I've tweaked it a bit and removed the rotation (like you comment) and it plays a lot easier. Try refreshing that heroku site to see what I mean.
Shame though. The original control scheme was similar to "Gravity Power" on the Amiga. I'd like to build some kind of dog fighting or racing game using that control schema still - but for previous version, well I don't think I'd ever get another job due to the difficulty of it, haha.
from matter-js.
Is using resurrect-js a requirement for serialisation? I didn't have any problems not using it but might be setting myself up for trouble later.
Nope, it's just the first library I found to work best at handling serialization in general. Any lib that can handle complete serialization of JS objects should work. But it seems many simply don't handle all the edge cases properly such as preserving dates, floating point values, null
, true
, false
, Infinity
etc which can cause issues.
How do I take a serialised object / world and restore it? Just feed it into the create function?
When you deserialise the object should perform (ideally) identical to the one you serialised. So if you serialise a body instance, you should be able to just unserialise it and use World.add(body)
just as if it had come out of Body.create
.
Also I wouldn't advise passing them through constructors again, as they don't guarantee to be 100% perfect at recreating the original object so this will be unreliable.
Is their a way of "updating" a created object or is just overwriting the properties sufficient?
It depends on the property, in some cases you can. But there are some cases where updating one property requires a number of other property updates.
In the latest master version there are some new setters for some of the more complex operations (see here). So look for a setter first!
What I suggest is that you have two modes of sync:
- a full sync where you send a fully serialised world / body
- an update sync where you manually update important properties (positions, angles etc)
A function that automatically updates any property dynamically would be cool (something like Body.set(property, value)
and Body.set(map)
, this is something that I've considered myself (as I've experimented with multiplayer games in Matter too). I might try something like it when I get time.
For now if you just need a quick approach that works for a game then maybe do something like the above?
I haven't given any serious thought to debugging the issue were the objects don't interact with each other but does anything spring into mind about where I might start?
Not sure what you mean here, can you send me some code? (feel free to email if its private).
from matter-js.
Excellent, I'll post a few more comments on how I'm handling some things once I get them going (e.g. using JSON patch to only send changes).
Thanks!
from matter-js.
How are you getting on with this?
I've added a new function which you may find useful.
It's Body.set(body, properties)
where properties
is an object of body properties and values to set. The idea is that it will automatically delegate to the correct setter function if there is one.
I think you'll be able to use it to help automatically apply your object updates?
Try it in the latest master build:
https://github.com/liabru/matter-js/blob/master/build/matter.min.js
from matter-js.
That's awesome. To be honest, I've been a bit distracted with Clojure/ClojureScript recently so haven't looked at my game since I left it. When I get back onto it though I'll look at using the body set function though, it looks perfect.
I wound up using a different JSON serialiser in the end, I didn't have a good result with resurrect-js. Besides that, it didn't have any AMD / CommonJS integration making it a pain to use with WebPack. I've gotten as far as serialiser the objects and sending them over the wire, I still had a few bits to debug with the interactions with the created objects.
I should finish up my Clojure stuff soon so I'll be back on the game :)
from matter-js.
For what it's worth - here's the start of the game. I've built a scaled down, single player, version for my CV but ideally would like to adapt into a multiplayer game at some stage.
http://richardson-homepage.s3-website-ap-southeast-2.amazonaws.com/
from matter-js.
Nice! Interesting concept for story telling. The ship seems a little hard to control though, I'd probably prevent it from rotating and just have upwards motion against gravity, maybe allow a little side to side motion at a slower rate when pressing the left and right keys.
from matter-js.
Related Issues (20)
- What is the least expensive way to make bodies of different shapes smaller? HOT 1
- Constraints seems to make bodies stick
- add n-gon to the project gallery
- weird texture behavior - multiple textures rendered for one body HOT 2
- Chain connecting 2 players causes 1 player to accelerate slower than the other even with same force
- Render.setSize is not present in the build
- Trying to change seed, to take control of deterministic behavior
- How to suppress body tremors? HOT 2
- Why does the attractor only work on one of the two BODYs? HOT 1
- Using compound bodies with Bodies.fromVertices does not work it just shows a filled in shape. HOT 1
- Why don't bodies sometimes collide? HOT 1
- Constraints with distance limits (e.g. for ropes)
- Why might there be such an error? HOT 1
- Simple Polygon Physics Issues HOT 1
- How to add project to the Wiki gallery ?
- How to scale the world? HOT 2
- [Phaser 3] Position of matter sprite's image not correct in container HOT 1
- loss of sprite quality on mobile HOT 1
- `Composite.translate` didn't move the bodies included
- Create Matter.Bodies.fromVertices with rounded vertices
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matter-js.