Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Need some advice on how to build an resource-manager game.

Discussion in 'Scripting' started by Miyavi, Nov 16, 2012.

  1. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Hey guys,

    I would like to make a game similar to ogame, farmville, etc, in which you have to collect several resources in order to upgrade your main city or base.

    I'm actually starting up with the UML and the rules of the game (including costs of buildings, upgrades, what you can investigate if you build certaing buildings, and such), and I'm actually gathering some information on how to do this.

    I've done some work before, but I'm pretty much an amateur myself, and wouldn't like to mess it up from the beginning... so is there any tutorial-like documentation I could look at? (As for example, how to set up the incoming resources generation based on the actual time, how to make a grid map, and things like that)

    I also have to say that I'm not going to implement network just yet, so I'm going to make it work locally at first (my knowledge on networking is none), and then if things go well, we might switch to it.
    But that's it basically. It would be like an ogame game, but just single-player for now.

    Thanks for any future help or suggestions provided,

    Miyavi.
     
    Last edited: Nov 17, 2012
  2. Curzon777

    Curzon777

    Joined:
    Mar 17, 2012
    Posts:
    16
    Hi, I'm also working on something like that.... I'm on 2 Projects now and the strategy game is at the waiting position till I finish the first smaller project....

    Its alot of work (realy realy realy much work) You will think about networking right now, because those games require a good server and good software on it.

    Basicly if you want to do a game like Ogame you can realize it with MySQL and PHP on serverside and Unity as Client. But if you want some dynamic battles and a living world like EvE or lets say for Excample "Homeworld Online" (what I'm working on) there is no way without SmartFox Server or your own written TCP Server. Otherwise you get a big problem with cheating or if you do all the calculations like movement and attacking on the server, the server will burn after it reach their limit (And it will be verry quick)!!!!

    I think you will not find any tutorial-like documentation for building such game. The best Documentation is the Unity3d Script reference... I get 95% stuff I need from there. You just have to think like a coder ;)

    You are asking verry simple stuff. For Excample how to calculate the resources:

    lets say your income on cash or cristals or whatever is 100 pieces / hour
    your last check of resources was at 12.00 (you logged into the game and saw there 1000Credits)
    at 12.00 you build a warrior for 300Credits -> you save the time lets call this var: last_use_of_cash(its 12.00) and also the credits (700) to the server or local and logout
    at 15.00pm you are back and logging into the game: we call the last_use_of_cash variable for checking how much time is between last save of credits and we do something like that:
    current.time - last_use_of_cash = 3H
    3H * 100 credits/hour + the 700credits (you saved at 12.00)
    after the calculation you save again everything: last_use_of_cash (15.00) and credits(1000)
    you have to do this every time you acces to the credits, like building something or login...
    on the client to not hammering the server every earned credit or every second you just start a counter that update every second with you income
    you may synchronize the amount of cash when you build something...
     
    Last edited: Nov 17, 2012
  3. Miyavi

    Miyavi

    Joined:
    Mar 10, 2012
    Posts:
    58
    Thanks for the input!

    This project is going to be our current yearly project for this year at University. We are a group of 6 people (3 programmers and 3 designers).
    Designers can't animate object yet (we aren't taught that until next year), so combats are going to be really simple, chat based combats, only showing the results of such combat as a final log to the user, telling him how many units he lost, or how many resources he got from the combat in case he was invading a land or whatever.

    The same as our designers can't animate, us, the programmers, don't know anything about networking (again, until next year, when we will see Unity used in a network enviroment). Our goal for this year, is to hand in a demo showing of what we would like to do with the game.
    As this is a demo, a lot of stuff will be missing, and as we have to hand the demo in March or April, it's going to be quite basic.

    I'm currently aiming for the following for the demo:
    Mostly full progress within the city, as upgrading buildings, gettings resources, being able to form units, investigate upgrades in the lab, etc.

    That, at the very least. We also would like to create a global map (in which your city is supposed to be), where you can see other cities, attack them, gather info about them, etc. Aside from cities we're having some more units, which will provide different resources, as lakes, forests, etc.

    Again, this is just a demo, so not even all this has to be implemented. Indeed, maybe just a basic city and an attack sistem would do for now, and we might even fake some things, as for example, cities in the global map are supposed to be controlled by players, we could preset some cities, let's say one with every building at level 1, another one at level 3, etc.

    As we are not implementing network, we were thinking of doing the data set up via XML or simply with file storage. What we also want to achieve is that if we want to change it to a data base under MySQL later, make it organised so the change isn't that traumatic.


    Talking about resource earnings, that's also what I thought of: Simply comparing time, comparing the resources, and doing the maths.

    PS: Also, the best projects are being chosen for a much deeper develoment during summer, so that's why we aren't implementing it all right now. Simply because we don't need to, and it's not our goal to have a game 100% polished, but we might do it in the future ^^
     
    Last edited: Nov 17, 2012