1
\$\begingroup\$

I want to know how can I define daily monthly challenges in my game? Is this something can be defined locally or its need server and external services? And which servers and technologies can implements that? Is persistent connection or … needed as server should send messages to clients with no request?

Specifically, I use unity.

\$\endgroup\$
  • \$\begingroup\$ I think you'll get more focused answers if you edit this question to specify more concretely how you want your challenge system to work. As TomTsagk's answer points out, there are many approaches to a challenge system, with very different implementations depending on what it needs to do. Narrowing down to one specific challenge system, and one specific problem you've encountered trying to implement it, will let us get much more concrete with proposed solutions. \$\endgroup\$ – DMGregory Jul 13 '18 at 13:21
4
\$\begingroup\$

It all depends how you want to implement them.

Do you want them to be unique every day? Then most likely you'd have to make them in a server, but that adds the negative that users have to be online to get the challenges.

Otherwise you can create something like 100 challenges, and every day give a random one to each user, in which case, you don't need any server and can implement that locally. But in this case, if you want to give new challenges to users, you can only do so through a game update.

How to implement a server that does that? I'm afraid that question is too vague. It takes articles and articles to teach someone that. Basically you'd need a server that stores the data, then the app will attempt to connect to said server and retrieve that data. Assuming you don't want separate challenges for each user, there is no need for authentication, so everyone gets the same challenge every day. How to implement all of these in more detail depends a lot on the current state of your app


A few helpful steps for implementation with a server:

  • Own a server online (either rent one or if you plan to store low amount of data, you can get away with using something free?)
  • Upload a text file that includes information about your challenge. This could be a simple .txt file that includes ids of challenges, or a combination of numbers to construct a challenge (pick stage number XX and special rule number YY). Or it could be something more complicated, like a formatted file that includes enough data to define this challenge as precisely as you want (eg challenge_name = my_challenge; teams = 2; players = 8; ...). Unfortunately I can't give a more specific example, as both ways can be used for different reasons.
  • From your game, at a specific point (when the game starts? when the player presses a button that says "start challenge" ?) make an online connection, that connects to that file on your server.
  • If failed, the daily challenge cannot be started (as the game doesn't know what to start)
  • If succeed, parse the file, and "create" locally the challenge depending on the data that you retrieved. What data would that be, depends on the variety of your challenges, but it can be a different stage, a different play mode, a specific time limit etc etc

If you are new to something like this, maybe you can try using a json file as you can put abstract information to it, and there are many parsers online so you don't have to do the hard work.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ can you give some leading point to start. ill accept your answer after some research \$\endgroup\$ – virtouso Jul 13 '18 at 13:29
  • \$\begingroup\$ @virtouso if you give me more details about how you plan to implement that, I can be more precise. Would you like to do them online with a server, but have unique challenges daily? (hard way) or something simpler, with a specific amount of challenges that gets randomly selected every day/week and needs no server? \$\endgroup\$ – TomTsagk Jul 13 '18 at 14:32
  • \$\begingroup\$ my question is mostly about implementations. the most relevant tools to implement that. for example what kind of connection can do all challenges comments. does a simple www do that? just when player started the game, get the challenges and show comments? or server should acces to all clients? \$\endgroup\$ – virtouso Jul 13 '18 at 15:19
  • \$\begingroup\$ @virtouso I edited my answer with more information \$\endgroup\$ – TomTsagk Jul 13 '18 at 15:30
1
\$\begingroup\$

You should really look Asset Bundle on Unity documentation. You'll need a server that can store an asset bundle to do this. Asset bundle are made for the kind of things you want to do, it allows you to download new content from online.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

While TomTsagk covered most of the basics in his answer, there are a few other points to think about;

You can use procedural generation to generate challenges. This may have the result in repetitive or boring challenges, however, if implemented badly, or even problems with difficulty (too easy, impossible, ect). Whereas creating by hand will ensure this won't be a problem.

If you want everyone to have the same challenge but would rather not have a server, you can use something like the following to decide which challenge to pick:

var rand = new System.Random((int)(DateTime.UtcNow.Date.Ticks >> 10));

(Note; not tested this code. May throw a conversion error. The basic idea is to create a local random using todays date in UTC, then use it to choose which challenge to run).

Do you want challenge highscores shared? Then use a server.

A server does not necessarily need be implemented in Unity. In fact, if it does nothing more than serve challenges made by yourself and highscores, Unity is overkill. A restserver can serve just fine. One thing to watch out for is the potential for cheating on the highscores, since you are relying on the client to accurately report them.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.