Jump to content
Sign in to follow this  
casp0or

[Question] How to build a game, the right way?

Recommended Posts

Posted (edited)

Hey,

I was building a Eth-Game and I´m finished now. (www.TokenWarriors.net)

Next, I want to start developing for the xaya-network. 👍 And now I have some questions before I start to do so.

 

First up I did not know how to develop a game for the xaya network and my initial question is: Should I use a server or only a client for the user?

Second I think I need a server at least to hold an old game state if the blockchain reorg itself. But then I could do all the calculations on my server and only present the last game state to the client.

 

3. How would I implement a fight between two player units and one dies?
- one player starts to attack another player's unit and to do so he creates a transaction into the xaya-network with

/g {
"gameName":{
	"unitName":"#unitID#",
      "action":"#attackID#",
      "target":"21-35"
}
	

and then I´m stuck  ... Where should I do the damage calc and how could I return that the enemy or the player unit has died? 

Or should the game client just hide the dead unit and allow no further turns to be made with it and if a player invokes a new transaction even if the unit is dead, nothing should happen in the game client? 

 

Regards
casp0or

Edited by casp0or

Share this post


Link to post
Share on other sites

It is nice to hear you want to try your hands on a Xaya game - that is highly appreciated!  Be sure to first read our tutorials and other documentation, for instance "SQLite Hello World" one.  And don't hesitate to ask more questions as you go along!  Also, you can take a look at our xid repository, which implements a simple but full-fledged game.

I'm not exactly sure what you mean with your server/client question.  You do not need any servers at all, as every node in the network (with the full XAYA blockchain) can compute the game state for themselves as well as handle all reorgs.  But you may want to design your game locally in a client/server fashion, where the game backend provides a local server (built with libxayagame) and the frontend / UI talks to it.

Calculating the damage and doing all other things will be done in your game logic's "update callback" - that is explained in the tutorials.

Share this post


Link to post
Share on other sites

Thanks, this was the answer I was looking for.

So I build a client where all stuff happens👍

I found the tutorial after I wrote this 😅

Regards

  • Like 1

Share this post


Link to post
Share on other sites

Great!  Do let me / us know if you have any more questions, we're certainly happy to get more people building on Xaya!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Your use of this site is governed by our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.