Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

2D Multiplayer Trivia Quiz Game

Discussion in 'Multiplayer' started by ilyassalm, May 29, 2019.

  1. ilyassalm

    ilyassalm

    Joined:
    Mar 1, 2019
    Posts:
    7
    Hello,
    i created a simple 2D Trivia Quiz Game and i wanted to add Multiplayer features to it (max 8 people playing the game at the same time). but i really got confused with the amount of options we have at our disposal (Unet, photon, ...).
    and the majority of tutorials i found on Online are talking about FPS multiplayer games. and i don't think a simple quiz Trivia game will ever need all that!
    So please help i'm really lost! any guides, suggestions or help on how to make a Multiplayer Trivia Quiz Game will be appreciated.

    Thanks,
    Best Regards
     
  2. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    154
    For this type of games a server authoritative solution is best, as you can validate all the answers from the server side (the "authority") and make sure no one is cheating. As an additional bonus you can store scores and things like that in a central place be it the local file system or a database etc.

    For this kind of work I usually recommend SmartFoxServer, as it's a battle-tested solution (it's been around since forever) and offers a ton of options. But it's also easy to get started with. You can check their documentation and you'll find very basic tutorials that build on top of each other. Stuff like creating a basic lobby, adding a chat, creating a turn-based game and adding the server side code. www.smartfoxserver.com

    I am sure other people will chime in with possible alternatives too.
     
    ilyassalm likes this.
  3. ilyassalm

    ilyassalm

    Joined:
    Mar 1, 2019
    Posts:
    7
    Hey MrsPiggy,
    Thank you so much for your answer it does definitely clear things out for me.
    I was at first considering using "Unet" the Built in networking system by unity or Photon, as those are the ones i heard about a lot from people and from youtube. but i really got confused how to use them in a simple Trivia quiz game. because all the tutorials i have seen mostly talking about FPS or 2D platformers games that involves Movement (Transforms) and actions, .... and do i really need all of that in my game?
    and talking about code do i really need to adjust it for Multiplayer or SmartFoxServer (Lobby) take care of that?

    i'm just a beginner in Multiplayer Logic and architecture, any help will be appreciated!

    Thank you so much
     
  4. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    154
    Exactly, you won't probably need that.

    Yes, some changes are necessary. For example you will need to be connected and logged in the server before you can actually play. Other changes may be necessary if you want people participating in the game to interact with each other, such as chatting or seeing their profile etc.
    If you choose SmartFoxServer I'd recommend following their tutorials from the documentation. They start very simple and they teach you one thing at a time. Good luck.
     
  5. ilyassalm

    ilyassalm

    Joined:
    Mar 1, 2019
    Posts:
    7
    Hello MrsPiggy,
    i have actually worked with The smartFoxServer, and i have successfully connected my game to their server, but then i didn't know what to do next! it seems like i need to configure the file extensions with java on their server so that the players can interact with each other.?

    and there is no full tutorials from A to Z on how to create a full multiplayer game with the smartFoxServer.

    i'm really confused what to do next and how to make my game playable online?
    Any help please?

    looking forward to hearing from you,

    Kind regards,
    ilyass
     
  6. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    281
    Hello ilyass, did you check this page in the documentation? http://docs2x.smartfoxserver.com/ExamplesUnity/introduction
    You will find 9 tutorials of increasing complexity showing how to create the building blocks of most multiplayer games: a lobby, a chat, the turn-based interaction, movement synchronization, ecc.
    If something is still not clear, you can contact us on our support forum and we will be happy to help.
     
    MrsPiggy likes this.
  7. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    154
    That depends on what you need to do. How does your quiz game work? Are there game tables/rooms or is everyone participating in the same quiz at the same time?

    Extensions are useful to add your own game logic on the server side, such as verifying that the player answer to the quiz is correct and so on and so forth.
    They have lots of tutorials to get started. Follow the links in @g_a_p post.
     
  8. ilyassalm

    ilyassalm

    Joined:
    Mar 1, 2019
    Posts:
    7
    yes, there is game rooms, and there is two modes in the game, the first mode is the public mode where player can join a room from 2 players to 8 players and challenge each other. and the second mode is the private mode where players can invite their friend to challenge each other or maybe people they have played with before. (in this mode i was thinking maybe the game will generate a random code that the host player can send it to his friends to join the match! but i have no idea on how i can achieve that, if you have any insights please help!)

    yes i know, i have actually read about extensions on the smartFoxServer documentation, but the challenging part is that i can't write extensions with C# it must be java, right? if it's in Java, i don't really have an experience with it. i just know enough in C# to make simple game. so how can i deal with the extensions problem and server side of the project?
     
  9. ilyassalm

    ilyassalm

    Joined:
    Mar 1, 2019
    Posts:
    7
    thank you @g_a_p for the help, yes i actually went through all the documentation and i have successfully connected the game with the smartFoxServer and i configured the client part, but i'm stuck now in the server side part, i read on the site that there is those extension files are the one controlling the server side and i have no knowledge in the java Programming language! is there is a possibility to write them in C#? and i don't think my game will need movements or complex multiplayer features, it's just a multiplayer Trivia Quiz Game. So please how can i manage the server side if i have now knowledge about java?

    And for the tutorials i managed to test the first one, but the others i didn't know how to make the server side working!

    Any useful information's, links or solutions will be so much helpful for me.
    thanks for the support.
     
  10. g_a_p

    g_a_p

    Joined:
    Mar 16, 2015
    Posts:
    281
    Java is very similar to C#, so I guess you can write a test Extension following the dedicated documentation quite easily, if you want to give it a try. This document describe how to create your first Java Extension step by step:
    http://docs2x.smartfoxserver.com/ExtensionsJava/writing-extensions

    Another option for the server side is to write your Extension in JavaScript. This is where to start from:
    http://docs2x.smartfoxserver.com/ExtensionsJS/quick-start

    My suggestion is to try one of the two approaches. Then if you have specific issues, we can further discuss them.
     
  11. ilyassalm

    ilyassalm

    Joined:
    Mar 1, 2019
    Posts:
    7
    i will try Java since it's similar to C# and i will read the documentation, and if i get stuck i will reach to you back again.
    thank you so much @g_a_p for the help :)
     
  12. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    154
    Ok. So SmartFoxServer provides an invitation api that gives you all the tools to send invitations between players and accept/refuse them.Also they provide match-making systems for both private and public games.
    The base for these interactions is the buddy system. This allows every player to keep track of their friends, see when they are online, change their state, chat etc. You'll find well don't tutorial on how this works in their docs.
    If you want to start a private game with your friends I believe you create an SFSGame room which allows you to specify a list of people you want to invite, and the minimum # of players required to start a game. All the rest (invitations and invitation replies) are handled by the system.

    If you check their example you'll find a prototype that shows how to use these features.

    Server side code can also be written in Javascript, which is more approachable if you're not a friend of Java.
    Check their docs for the details.
     
  13. ilyassalm

    ilyassalm

    Joined:
    Mar 1, 2019
    Posts:
    7
    Thanks, @MrsPiggy i will try out the examples, and go through the documentation and hopefully i will come up with the right implementation (first time is always the hardest, after that everything will be clear)

    i actually have a question regarding the time, how many hours/ days it will take me as a beginner to implement the Multiplayer functionalities? vs an experienced unity developer?