zielak / cardsgame Goto Github PK
View Code? Open in Web Editor NEWLibrary for creating card games in general.
License: MIT License
Library for creating card games in general.
License: MIT License
Fully playable Makao/UNO style game.
Server
Client:
Query selector could be exposed to general utils?
Client's room/state could have find()
method.
"Find utility" could be just present in client
library.
One usage is in "setParent" command, which could actually inject state reference itself.
RefillDeck command -> setParent -> getParentEntity -> entity._state.getEntity...
revealed
to reflect the faceUp
&ownership
, so each component didn't had to do this: (props.faceUp || props.ownerID === gameState.clientID
)Moving entities around (new parent) seems to be buggy with colyseus new Schema.
clone()
method on all entitiesclient
package should provide "adapters". Let game author choose how he wants to render each Entityexamples
package should show both options: React and Pixi.unit test everything you wrote so far.
GOAL - make it at least YELLOW
Goal achieved!
Right now deck only synchs its items count.
Deck may have anything as its topmost child. It can be classic card, but also a card from different game.
Seems unused. I'm positioning entities on the client-side.
This could be better:
Pub
indicator (entity with public/private props)I switched to debugging in Chrome dev tools, which has collapsable log groups. Server logging should still be available when running server remotely, so this ticket is still valid.
Consider ditching Pixi dependency in favor of "choosing your own renderer".
Pixi is currently in @cardsgame/client
and every Entity is rendered with it.
Instead it could be moved to @cards/examples
:
client
should not import pixi.Make it possible to define actions (with ActionTemplate
) which would react to UI interaction: button click , slider value change, radio button change etc (all basic HTML events).
On top of current game Entity
interactions.
For now I focused on just button clicks
https://github.com/colyseus/schema
private prop sync must be all re-written.
Server:
focused
/playersMain
(new interface?)Client:
IPlayerViewPosition
, so both sides speak the same languageisInOwnersView
on the entitiesownerID
to make any decisions on positioning client-sideThese methods on ParentTrait may be confused with find
method on arrays.
const winningDeck = state
.findAll({ name: "playersDeck" })
.find(deck => deck.clientsCount() === 0)
Provide a true, small example implementation. cardsGame-examples is growing out of its initial scope.
No directionality, just use angle
.
Padding between elements?
Or
Set number of elements + Line width would determine spacing?
Hi there, tried to run your example and I failed.
/home/ddv/dev/examples/cardGameProjects/cardsGame/packages/server/node_modules/@colyseus/core/build/Server.js:157
throw new Error("Please provide a 'transport' layer. Default transport not set.");
^
Error: Please provide a 'transport' layer. Default transport not set.
at Server.getDefaultTransport (/home/ddv/dev/examples/cardGameProjects/cardsGame/packages/server/node_modules/@colyseus/core/build/Server.js:157:15)
Instead of adding new thing, see if current State has any change listeners on server side.
Have a big amount of cards? Scrape them from JSON file, assign a correct "type" in each and server will create an array of these items for you.
Server-side defined actions currently have name and description. I could create new field, which would be logged client-side in the "game history log" to know which player did what.
Inspired by how they do it at https://dominion.games
Text
be able to be owned by players?idx
and be possible to put in containers, or just be there on the table?Use cases:
Area
?I'm sending a lot of data on every single change, due to restyling of entities.
cardsData
:
cardsData
, only for each client's consistency.Find a way for selecting/marking cards without the need for additional container.
Use it in a different game, leave Makao as it is right now.
Bug visible on ContainersTest. Move anything to Hand.
It should be possible to define interaction target including its parent, nesting recursively.
Reveal/Hide UI commands should accept more than one player. Some games might require it.
Put these commands in the core cardsGame
lib, here.
hijacksInteraction
on, eg. nth card in a deck VS nth card on handA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.