NC-Client: An alternative open-source game client for NextColony by jarunik

View this thread on steempeak.com
· @jarunik · (edited)
$28.76
NC-Client: An alternative open-source game client for NextColony
#### Repository
https://github.com/Jarunik/nc-client

### Open Source Client for NextColony

Demo: https://nc-client.jarunik.com

![app.PNG](https://files.steempeak.com/file/steempeak/jarunik/0AY9ZJkX-app.PNG)

#### What is the project about?

This project started as an experiment to research options for another game client for NextColony. I stumbled from one problem to the next. That didn't bother me much as my first priority was building an app to gain more knowledge and insight into Steem blockchain games. I solved quite a lot of basic problems and built infrastructure to address them. Over time it became clear that a functional app is not too far away anymore. It is still not done but you can now play some aspects of the game with it. So decided to keep building it and share it with the community. I hope it helps some of you or motivates you to participate in the blockchain adventure.

I took a pretty simple approach to implement the game client:

1. Create a VueJS App
2. Register it with Steemconnect (https://app.steemconnect.com/apps/create)
3. Use SteemConnect.js to create a token for users (https://www.npmjs.com/package/steemconnect)
4. Store the token in my App.
5. Create Custom JSON transactions that represent game commands and send them to the Steem Blockchain
6. Read out the Game State from the NextColony Server API

Here are some of the key challenge that I worked on:

- There is no easy way to Issue custom JSON transactions on the latest steemconnect SDK.
	- Solution: Use the Beta Version: https://www.npmjs.com/package/steemconnect/v/3.0.0-beta.2
	- Additional Bonus: You also get a Steem Keychain Integration with it.
- I soon realized that I need global state in order to manage key information and avoid spaming the API.
	- Solution: Use VueX as a data store: https://github.com/Jarunik/nc-client/tree/master/src/store
- It is cumbersome to write all thes JSON's and trigger complex commands on the chain.
	- Solution: I created my own SteemConnect Class that extends Steemconnect and offers an API for the commands I need: https://github.com/Jarunik/nc-client/blob/master/src/services/steemconnect.js
- There are a lot of API calls that I need to retrieve the game state and they might change regularly.
	- Solution: I created my own API services that take care of Data retrieval: https://github.com/Jarunik/nc-client/tree/master/src/services
- There are a lot of languages on this world and I will want translations soon or later.
	- Solution: I included i18n (internationalization) support and made it ready to use: https://github.com/Jarunik/nc-client/tree/master/src/i18n

I still have some things I want to try out in this project and are not really solved yet:

- User and planet layer as context that should update automatically without too much API calls.
- Better UI handling of the slow blockchain commands (Waiting and Delayed feedback for the user)
- Styling: I didn't bother with it yet.
- Protection of drastic transactions like gifting planets.

Oh ... I forgot to link the game in case you want to have a look at the official client: https://nextcolony.io

#### Technology Stack
I am building the entire client with VueJS: https://vuejs.org/

I consume two services with my client:
- Steemconnect to trigger custom JSON transactions
	- Format of the JSON transactions is defined by NextColony: https://jarunik.github.io/nc-docs/json/
- NextColony API to retrieve the game state: https://jarunik.github.io/nc-docs/api/

Inside of VueJS I try to keep dependencies small. I currently have these dependancies:

```
  "dependencies": {
    "core-js": "^2.6.5",
    "vue": "^2.6.10",
    "vue-router": "^3.0.3",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.7.0",
    "@vue/cli-plugin-eslint": "^3.7.0",
    "@vue/cli-service": "^3.7.0",
    "@vue/eslint-config-prettier": "^4.0.1",
    "axios": "^0.18.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "moment": "^2.24.0",
    "steemconnect": "^3.0.0-beta.2",
    "vue-i18n": "^8.11.2",
    "vue-template-compiler": "^2.5.21"
  }
```

I use the following frameworks on top of of the basics:
- `vuex`provides me with a global store with proper state handling
- `vue-router` to have proper URL's routing to the pages with dynamic routes. 
	- Example: My Planets Buildings: https://nc-client.jarunik.com/jarunik/P-Z5CNNNZTL40/buildings
- `axios`to do the API calls: https://github.com/Jarunik/nc-client/blob/master/src/services/api.js
- `moment` to handle and format times and dates
- `steemconnect` to login users and sign and broadcast steem transacitons
- `vue-18n` provides me with a translation framework

 If you are interested in one of these libraries you can find an example implementation in my client. I am still learning how to make better use of them so feedback is welcome too.

#### Roadmap

I am currently building out the app along the existing game features. I am still missing these:

- Planet Gifting
- Item Gifting
- Galaxy Map
- Fleet
- Shipyard

Once I have these I will most likely try to look into the upcoming battle features and then look into making things nicer. It is all still far out but this would be a wis hlist:

- Translations
- Better User Experience
- Mobile Support
- Battle Simulation
- Styling
- Graphics

Looks like I will never finish... **as there is still a lot that I want to experiment with.** Maybe you can help me?

#### How to contribute?

Quality contributions to the web client are very welcome.

Please open issues for feedback, ideas, change request and bug reports.

To help with development:

1. Fork the repository
2. Create a feature branch
3. Make a pull request for your feature
4. Let jarunik know on Discord: https://discord.gg/A8tH9Vv
5. Jarunik will review, discuss and merge the pull request.

In case you want to do bigger changes: Please describe them in an issue and discuss them with @jarunik before implementation.

I am also taking care of documentation of the JSON and Rest API of NextColony. Contributions are also welcome there: https://github.com//jarunik/nc-docs

Do you want to build something on Steem too?

#### GitHub Account
https://github.com/Jarunik
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 33 others
properties (23)
post_id74,899,750
authorjarunik
permlinknc-client-an-alternative-open-source-game-client-for-nextcolony
categoryutopian-io
json_metadata{"app":"steempeak\/1.9.9","format":"markdown","tags":["utopian-io","nextcolony","development","vuejs","game"],"users":["vue","jarunik"],"links":["https:\/\/github.com\/Jarunik\/nc-client","https:\/\/nc-client.jarunik.com","https:\/\/app.steemconnect.com\/apps\/create","https:\/\/www.npmjs.com\/package\/steemconnect","https:\/\/www.npmjs.com\/package\/steemconnect\/v\/3.0.0-beta.2","https:\/\/github.com\/Jarunik\/nc-client\/tree\/master\/src\/store","https:\/\/github.com\/Jarunik\/nc-client\/blob\/master\/src\/services\/steemconnect.js","https:\/\/github.com\/Jarunik\/nc-client\/tree\/master\/src\/services","https:\/\/github.com\/Jarunik\/nc-client\/tree\/master\/src\/i18n","https:\/\/nextcolony.io"],"image":["https:\/\/files.steempeak.com\/file\/steempeak\/jarunik\/0AY9ZJkX-app.PNG"]}
created2019-05-17 12:51:09
last_update2019-05-18 09:56:24
depth0
children9
net_rshares53,956,127,195,610
last_payout2019-05-24 12:51:09
cashout_time1969-12-31 23:59:59
total_payout_value22.663 SBD
curator_payout_value6.096 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length6,219
author_reputation15,567,620,005,037
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars0
author_curate_reward""
vote details (97)
@ruvoter ·
supportedbyruvoter
Thank you for @nextcolony post.

Supported you a little.

Keep exploring!
@bronevik

You could support #nextcolony with us
[delegate 10 SP](https://app.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=ruvoter&vesting_shares=10%20SP) [20 SP](https://app.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=ruvoter&vesting_shares=20%20SP) [50 SP](https://app.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=ruvoter&vesting_shares=50%20SP) [100 SP](https://app.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=ruvoter&vesting_shares=100%20SP)[500 SP](https://app.steemconnect.com/sign/delegateVestingShares?delegator=&delegatee=ruvoter&vesting_shares=500%20SP)                
        
πŸ‘  
πŸ‘Ž  ,
properties (23)
post_id74,899,937
authorruvoter
permlinksupported-by-ruvoter-1558097709zz
categoryutopian-io
json_metadata{}
created2019-05-17 12:55:12
last_update2019-05-17 12:55:12
depth1
children1
net_rshares-2,219,107,820,134
last_payout2019-05-24 12:55:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length744
author_reputation33,453,722,064,839
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (3)
@mys ·
$0.17
Stop with these phishing links, please.
πŸ‘  , ,
properties (23)
post_id74,900,559
authormys
permlinkre-ruvoter-supported-by-ruvoter-1558097709zz-20190517t131222503z
categoryutopian-io
json_metadata{"community":"busy","app":"busy\/2.5.6","format":"markdown","tags":["utopian-io"],"users":[],"links":[]}
created2019-05-17 13:12:24
last_update2019-05-17 13:12:24
depth2
children0
net_rshares308,972,150,515
last_payout2019-05-24 13:12:24
cashout_time1969-12-31 23:59:59
total_payout_value0.128 SBD
curator_payout_value0.040 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length39
author_reputation14,753,290,326,944
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (3)
@schlafhacking ·
$0.23
nice! Could be a pretty frontend for a bot, too.
πŸ‘  ,
properties (23)
post_id74,906,619
authorschlafhacking
permlinkre-jarunik-nc-client-an-alternative-open-source-game-client-for-nextcolony-20190517t151917716z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit\/0.1"}
created2019-05-17 15:19:21
last_update2019-05-17 15:19:21
depth1
children0
net_rshares408,198,891,009
last_payout2019-05-24 15:19:21
cashout_time1969-12-31 23:59:59
total_payout_value0.170 SBD
curator_payout_value0.056 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length48
author_reputation4,641,588,833,612
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@freddbrito ·
This is great!
properties (22)
post_id74,910,352
authorfreddbrito
permlinkre-jarunik-nc-client-an-alternative-open-source-game-client-for-nextcolony-20190517t164201048z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit\/0.1"}
created2019-05-17 16:42:57
last_update2019-05-17 16:42:57
depth1
children0
net_rshares0
last_payout2019-05-24 16:42:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length14
author_reputation32,859,932,476,006
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@helo ·
$6.50
- More image would have improved this article. it's a front end after all.
- Good article with explanations of coding choices.  Let's include code samples next time.
- Please include your Pull Request link for your next submission 
- Make smaller commits for good separation on concerns.
- Do make more comments and remove dead code.

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/2-2-1-2-2-3-4-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
post_id75,007,512
authorhelo
permlinkre-jarunik-nc-client-an-alternative-open-source-game-client-for-nextcolony-20190519t172349752z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https:\/\/join.utopian.io\/guidelines","https:\/\/review.utopian.io\/result\/3\/2-2-1-2-2-3-4-","https:\/\/discord.gg\/uTyJkNm","https:\/\/join.utopian.io\/"],"app":"steemit\/0.1"}
created2019-05-19 17:23:48
last_update2019-05-19 17:23:48
depth1
children2
net_rshares11,549,701,997,193
last_payout2019-05-26 17:23:48
cashout_time1969-12-31 23:59:59
total_payout_value4.980 SBD
curator_payout_value1.515 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length783
author_reputation119,612,833,307,875
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (26)
@jarunik ·
Thanks for the feedback.
properties (22)
post_id75,138,867
authorjarunik
permlinkre-helo-re-jarunik-nc-client-an-alternative-open-source-game-client-for-nextcolony-20190522t053221630z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steempeak\/1.9.9"}
created2019-05-22 05:32:27
last_update2019-05-22 05:32:27
depth2
children0
net_rshares0
last_payout2019-05-29 05:32:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length24
author_reputation15,567,620,005,037
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Thank you for your review, @helo! Keep up the good work!
properties (22)
post_id75,151,751
authorutopian-io
permlinkre-re-jarunik-nc-client-an-alternative-open-source-game-client-for-nextcolony-20190519t172349752z-20190522t110605z
categoryutopian-io
json_metadata{"app":"beem\/0.20.17"}
created2019-05-22 11:06:06
last_update2019-05-22 11:06:06
depth2
children0
net_rshares0
last_payout2019-05-29 11:06:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length56
author_reputation152,913,012,544,965
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steem-ua ·
#### Hi @jarunik!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
post_id75,008,526
authorsteem-ua
permlinkre-nc-client-an-alternative-open-source-game-client-for-nextcolony-20190519t174720z
categoryutopian-io
json_metadata{"app":"beem\/0.20.19"}
created2019-05-19 17:47:21
last_update2019-05-19 17:47:21
depth1
children0
net_rshares0
last_payout2019-05-26 17:47:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length286
author_reputation23,203,609,903,979
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Hey, @jarunik!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
post_id75,041,249
authorutopian-io
permlinkre-nc-client-an-alternative-open-source-game-client-for-nextcolony-20190520t104724z
categoryutopian-io
json_metadata{"app":"beem\/0.20.17"}
created2019-05-20 10:47:27
last_update2019-05-20 10:47:27
depth1
children0
net_rshares0
last_payout2019-05-27 10:47:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length589
author_reputation152,913,012,544,965
root_title"NC-Client: An alternative open-source game client for NextColony"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000