Mining ideas / code from other games

Game development with Board Game Arena Studio
User avatar
Ciffy
Posts: 30
Joined: 18 August 2015, 21:59

Mining ideas / code from other games

Post by Ciffy »

Is there an easy way to look at the code for other games? I want to learn how to rotate the view / board so that your pieces are always on the bottom (like in chess, your pieces are always the ones closest to you, but it knows how to display that info upside down for your opponent). Is it just deciding which way is "right" and displaying it normally and when not "right" do it upside down? 2 players only for now.

Also, there's nothing in the tutorial about limiting a game's number of players; it just says to lower the player count before creating the game. Is there anyway (again, like in chess) to say, "this game will only take 2 players".
User avatar
Bids
Posts: 72
Joined: 02 April 2019, 18:10

Re: Mining ideas / code from other games

Post by Bids »

Hi, there is a BGA code sharing page where you can see the code of some game. You can look in google for BGA code sharing. You can change the number of players in the gameinfos.inc.php file. Hope it helps :)
User avatar
XCID
Posts: 78
Joined: 26 March 2020, 01:45

Re: Mining ideas / code from other games

Post by XCID »

On the studio projects list, you can gain read access to most of the games.
User avatar
RavingWanderer
Posts: 83
Joined: 12 May 2020, 16:08

Re: Mining ideas / code from other games

Post by RavingWanderer »

In particular, the tutorial Hearts game will show you how to orient the player displays so that the current player is "south".
User avatar
tchobello
Posts: 693
Joined: 18 March 2012, 13:19

Re: Mining ideas / code from other games

Post by tchobello »

you can find chess, checkers or xiang qi code in studio projects (don't forget to select 'already published')...
User avatar
junibegood
Posts: 49
Joined: 25 November 2016, 21:12

Re: Mining ideas / code from other games

Post by junibegood »

Is there anyway (again, like in chess) to say, "this game will only take 2 players".
This is defined in "gameinfos.inc.php". See documentation here : https://en.doc.boardgamearena.com/Game_ ... of_players
User avatar
Ciffy
Posts: 30
Joined: 18 August 2015, 21:59

Re: Mining ideas / code from other games

Post by Ciffy »

Thanks all. I couldn't make heads or tails out of the Hearts stuff, but chess is what I'm trying to model after and, thankfully, I think I see how it's handling the board positioning based on color. Love the fact that you can get read only to other stuff to learn with.

Now I just need to get you people to comment your code! >_>
User avatar
LaszloK
Posts: 36
Joined: 05 January 2018, 19:00

Re: Mining ideas / code from other games

Post by LaszloK »

The best code to learn from usually has few comments.
Comments are not like Schindler's List. They are not "pure good". Indeed, comments are, at best, a necessary evil. If our programming languages were expressive enough, or if we had the talent to subtly wield those languages to express our intent, we would not need comments very much - perhaps not at all. The proper use of comments is to compensate for our failure to express ourself in code.
(Robert C. Martin, "Clean Code", p. 53.)
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Mining ideas / code from other games

Post by Tisaac »

LaszloK wrote: 20 February 2021, 10:09 The best code to learn from usually has few comments.
Comments are not like Schindler's List. They are not "pure good". Indeed, comments are, at best, a necessary evil. If our programming languages were expressive enough, or if we had the talent to subtly wield those languages to express our intent, we would not need comments very much - perhaps not at all. The proper use of comments is to compensate for our failure to express ourself in code.
(Robert C. Martin, "Clean Code", p. 53.)
I think he is referring more to the framework code structure rather than what is inside the functions. If you don't know how the framework works, it's pretty to hard to understand what's going on. Read the docs, again and again, that's probably the best advice I can give you.
User avatar
Ciffy
Posts: 30
Joined: 18 August 2015, 21:59

Re: Mining ideas / code from other games

Post by Ciffy »

Yeah, it's more a matter of understanding how the piece data is stored so that it can be displayed from either side. Since I also don't know the framework, it's just a steeper curve. I'll get there though.
Post Reply

Return to “Developers”