cptn-solo / woffler_contract Goto Github PK
View Code? Open in Web Editor NEWWoffler game EOSIO contract
Woffler game EOSIO contract
Generate level with green and red cells, and pot balance. Append the level to the branch from the context of level generation (root branch creation: fill level's pot with branch owner's stake amount).
NB: may be adding a field for "branch starting balance" to (new, root) branch would be more clear and would separate branch creation logic from branch launch logic. Should think before implementation.
Now many actions perform almost same checks for player permission to do something, like check for current state, level, stake in branch, etc.
This logic can be implemented as player state check in player class.
Initially tried link to setup cmake, but include warnings was fixed by renaming symlink from eosiolib
to eosio
Root branches are missing its part of profit and the rate of branch share in level's profit not defined.
Set active branch and level for player. Player state initialisation.
Will start with tables to get some feedback for the class diagram from #3.
There are not that many tables. Will create all of them, and after that will think on actions implementation sequence.
As it was stated in #17, contract gets Const::houseShare% of stake value in each stkaddval
action made on root branch. Level's pot get's total staked value, only stake record gets split.
#29 shown that 30ms max-transaction-time is not enough for current implementation. Need to try to defer some logic (unlock using vector intersection check) or to change cell storage logic - implement binary approach for cell generation and intersection checking. The latter will lead to some limitations in branch design (fixed length levels), but will also greatly simplify the level concept and improve performance dramatically.
we need green and red cells distributed around the level somehow
Action to create an account in the game contract without any balance yet.
For each deferred action (tipbranch, tipstkhldrs, tipchannel) there should be a queue for transactions with sent/date flag set by a deferred action if fired. These queues should be processed each time upon revenue share event. More to say - revenue share itself should only place deferred transactions to the queue and then initiate processing of it. This approach will give deferred actions another chance to fire if for some reason it was not initially.
Next level without winner or just zero position in the current level
Enable processing of transfers send to contract:
Will work in the same Draw.io file where Game loop models where made
When splitting a branch, retries count runs out and player stays in position without available free options. To continue playing, someone will call claimgreen
action to reset his position in the current level (zero, retries count restored).
This action's logic is basically called from the last attempt to unlock new level of a branch in next
workflow and while unlocking a split branch and no retries left to continue trial without payment.
Channel existence check and height update upon each signup.
Solve overlapping of two vectors is not trivial task in terms of efficiency/algorithm development.
For split
action generation of green cells, compatible with set of red cells is a trial and basically a paid feature.
Generating non-overlapping sets of red/green cells by contract can be non efficient and lead to action termination by a node due to transaction timings.
Suppose cells generation process for root level should be free as there is already a staking process in place.
Cell generation process for next level can be a matter of gamification. For example, a player solved level and decided to go further (which launch a level generation process in turn), can have same 3 retries to generate new level with appropriate cell sets. After retries count goes zero, player can be either jailed, or returned back 1 level, or just positioned to the level's base and try to solve it again.
Any gamification will be chosen, vector comparing algorithm should be implemented using bitwise operators to perform efficient comparisons. Later this same algorithm can be used to check if player's trial ends up with red or green cell. Storing cells as binary mask would be a good idea too - we can just convert vector into bit mask. But the generation process itself organised using "steps" concept is good and gives more dispersion to cells distribution, and offers to control quantity of reds and greens in the given level more accurately.
Another (vector) approach is vector intersection checking, which is more flexible and can allow simple implementation of big (long) levels.
Now class members are just copy values from structs made private and it is requires sync of values of that members each time we modify the underlying object.
It would be better to implement a reference/pointer on the object's instance data to avoid syncing which is obviously a bug prone approach.
Implement trial logic - generate random number for "try position", count retries, enforce turn upon retries finished.
Implement turn logic - switch try-current position, commit turn result and timestamp.
Initial model is done: added sales channel to logic data model and to the TAKE flow.
So far we have revenue channels for participants:
The question is, would the balance be correct and how to balance game win-win business model.
It could be done by check for timespan between level result and now() - if interval of jail/take where finished, then player state can be changed according to level result as if unjail/untake were claimed by specific actions.
Regeneration action must be available until level is unlocked. After non intersected red/green combination is found, level marked as unlocked and can be played.
extend the implementation for registerStake - (add balance via record modification in addition to emplace, which is done for now)
If a player selected an option of taking reward, he should solve a level once again to make another selection next time. Suppose claimtake
action should position player on zero in solved level instead of promoting him.
Create branch before level generation, branch metadata processing. Stakeholders management for created branch (add contract as a stakeholder with 3% contract's stake)
new fields added to models but not to the sources
Staking on non-root branch is ok and will unify the workflow of adding funds to levels - no matter root- or sub-branch is created, it's root level needs to be funded and the branch itself needs to register its stakeholders.
Question of adding contract's (house) stake to the non-root branches is more interesting.
On one hand is unification - when a branch is added, the player should stake on it, while contract should process his funds: subtract player's active balance, append stake to the branch and move funds forward to the level's pot. Each such transaction can be easily split at house share rate (say 3%), stake can be registered as 97:3 and total value (100%) then moved to the level's pot.
On the other hand, if this procedure is taking place in each branch staking workflow, and not only root branch, the house's share in business became too discrete. Anyway, there would be a hierarchical revenue share implemented and some part of child branches' revenue will flow upwards in any case. May be house' stake in the child branches is an excess.
Until decision made, #44 is in effect (block account removal if referrals present).
Prepare draw.io models to outline main subject-object interactions.
Same model file is pushed to the IA folder in contract source files.
Actually there are 3 actions involved in branch split process:
splitlvl
) - split branch from green cell if there is no split yet in current level;unlocklvl
) - use retries (free or payed) to unlock new level;splitbet
) - get additional retries by making a payment;Zero position in the current - or even previous if exists - level
Action to create a root level is required anyway - for root branch initialisation or sub-branch. So the decision is - this action should work both for root- and sub-branches equally.
A 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.