Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by PinkPumpkin · Aug 25, 2016 at 05:38 PM · serversideonline gamesqldatabase

24/7 server side generation of ingame currency

Hello,

I'm currently developing a PC game in C# where you instantiate buildings to a terrain to build your own village. That works fine so far.

My problem: I would like to give those buildings different, specific tasks, e.g. building 1 is a bank and generates money (e.g. 100 money units per hour) which is used to build/ upgrade other buildings. But I would also like the bank to generate money while the player is offline. So I need something like a 24/7 online server that generates the money and the playerclient just gets this value from the server. This way I also prevent cheating, because the important stuff is handled not on the players local PC. I also thought about a register/ login system in future.

How can this be achived in the easiest way ? I don't think SQL databases can e.g. add a certain amount of money/ units to a specific playeraccount every hour, or do they ?

Thank you for reading!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by juicyz · Aug 26, 2016 at 04:47 AM

I don't think SQL databases can e.g. add a certain amount of money/ units to a specific playeraccount every hour, or do they ?

You can either have your database do that for you by a query statement or in your server code, you could have a loop for every X minutes to send a query to the database that would update their money based on their production amount. I know this is possible but for the syntax on how to write it, google that as I don't know your database.

You could also just save their log out and log in times, and when they log in - update their money based on the logout and login time and their production amount.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image PinkPumpkin · Aug 26, 2016 at 11:39 AM 0
Share

@juicyz thank you! Which database and/ or server configuration would you recommend ? I have never done something like that (networking, databases, setting up servers). Where can I put the server code to ? When I set up a unity server in a C# script attached to a GameObject, the server will be deleted as I close the game right ?

avatar image juicyz PinkPumpkin · Aug 26, 2016 at 03:10 PM 0
Share

I would like into something like $$anonymous$$YSQL using SQL or possibility $$anonymous$$ongoDB for NoSQL. I would compare the pros and cons and see which ones are the best for you.

I have never done multiplayer or SQL for a Unity Game yet so I couldn't tell you about that. That could be another question you ask here.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Is there anyway to use WebGl on a website without having users install a plugin? 0 Answers

Tanks!!! online question 2 Answers

Can I code the connection of my game to SQL Server the same way I would do with a web application? 0 Answers

mssql Integrated Security login failed 0 Answers

how can i use OnPlayerConnected ? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges