[WIP] Real Time CC Simulation

GREE

DECAGAMES Forum - Powered by vBulletin
Page 1 of 3 123 LastLast
Results 1 to 15 of 32

Thread: [WIP] Real Time CC Simulation

  1. #1
    Prominent Poet PawnXIIX's Avatar
    Member Since
    May 2012
    Post Count
    2,363

    [WIP] Real Time CC Simulation

    Hey guys.

    Like I said in the past, I program things when I get bored. So what I did was program a real time simulation of CC. It's still in the infancy stages.

    Here's what needs to be done:

    -Add data for all the buildings
    -Incorporate player money
    -Incorporate levels

    Right now it is taking the buildings that have been added into the data. The buildings that I added into the data are "Laundromat", "Pizza Parlor", and "Gas Station". It calculates the best ROI of every possible upgrade and construction. If there is no upgrade going on, it does that upgrade. If there is no construction going on, it will do the construction with the best ROI. The entire program runs off an infinite loop which updates every building a lot of times per second.

    Building collections run off milliseconds. The seconds for collection is multiplied by 1000 and added to the current time of the system. When the building is updated and the system time is equal to or greater than the collection time, the building is flagged for collection. When the update hits it again, the money is collected and a new collection time is calculated.

    The system is perfect in the fact that there are no glaring logical or semantic errors right now. The only problem is the tiresome input of data.

    Here is a string of data I use for defining a laundromat, and why it is so tiresome:

    Code:
    Laundromat 0 6 17 33 55 83 121 171 231 303 413 30 75 338 7200 21600 43200 64800 86400 172800 216000 100 167 278 465 777 1298 2169 3622 6049 10102 300
    The array locations are as follows:
    data[0] - name (String)
    data[1] - unlock level (integer)
    data[2-11] - payout (integer)
    data[12-21] - upgrade time in seconds (integer)
    data[22-31] - upgrade cost (integer)
    data[32] - collection period in seconds (integer)

    Every building is set into an array in java, 2 of each. A player is defined to have every building from the start, and buildings cannot be necessarily "removed" or "destroyed". The only way for them to make collection or be completed in any way is for the player to build them. This will increase their level to 1 instantly, allowing them to be seen by the update method which tracks if they're done or not.

    The program current spits out only about a little bit of useful data at the moment. Most of the program is jargon that lets me know if the timers are working correctly and that there are no logical errors in the code (Code that is semantically correct, but doesn't perform the necessary actions that were intended).

    The algorithm (as previously defined) is to pick the lowest construction/upgrade ROI and build/upgrade that particular building. While this is not a perfect simulation in that aspect, it will pick the lowest ROI and only pick the one that is the lowest. I am thinking of implementing a feature of only picking the lowest one that can be afforded at the time, or just saving up until the lowest ROI regardless becomes available.



    Like I said, there still needs to be the implementation of more buildings, and other features. I worked long and hard on this just for the sake of it, but if anybody who wants to see the code wishes, just drop me a PM and I'll be glad to share it if you don't mind a million debug areas commented out. Don't worry, my code is very neat and has very good conventions.
    Level: 238 - Mafia: 500
    Fights Won/Lost: 42,695/7,013
    Robberies Won/Lost: 22,601/587
    Attack: 53,285,488
    Defense: 42,211,410
    IPH: $14,972,834
    Syndicate: HTC White
    Updated: 5/21/14 11:21 PM EST
    Add me! - 544754891
    Add me! - 113853218

    .:|Twitter: https://twitter.com/Saw_JaD |:.
    .:|Help me get a partnership! - www.youtube.com/user/eQXIIX |:.

  2. #2
    Supreme Scholar Dipstik's Avatar
    Member Since
    Jan 2012
    Post Count
    8,520
    If only this sort of ingenuity could be harnessed for something useful...
    Quote Originally Posted by murf View Post
    Dippy, may be a little harsh in this thread, but he's right...
    Still mad at Bostick.

    I'll be back when the moderation is reasonable. Enjoy the forum you created, Gree.

  3. #3
    Prominent Poet PawnXIIX's Avatar
    Member Since
    May 2012
    Post Count
    2,363
    Quote Originally Posted by Dipstik View Post
    If only this sort of ingenuity could be harnessed for something useful...
    Dear GREE...


    ...Hire me.
    Level: 238 - Mafia: 500
    Fights Won/Lost: 42,695/7,013
    Robberies Won/Lost: 22,601/587
    Attack: 53,285,488
    Defense: 42,211,410
    IPH: $14,972,834
    Syndicate: HTC White
    Updated: 5/21/14 11:21 PM EST
    Add me! - 544754891
    Add me! - 113853218

    .:|Twitter: https://twitter.com/Saw_JaD |:.
    .:|Help me get a partnership! - www.youtube.com/user/eQXIIX |:.

  4. #4
    Banned
    Member Since
    Oct 2012
    Post Count
    223
    Quote Originally Posted by Dipstik View Post
    If only this sort of ingenuity could be harnessed for something useful...
    Couldn't disagree more. This could cure cancer you see...

  5. #5
    Prominent Poet PawnXIIX's Avatar
    Member Since
    May 2012
    Post Count
    2,363
    I'm about 2 years into a computer science degree. I hope there's a company around here offering internships, I would really love to get paid for this sort of stuff.
    Level: 238 - Mafia: 500
    Fights Won/Lost: 42,695/7,013
    Robberies Won/Lost: 22,601/587
    Attack: 53,285,488
    Defense: 42,211,410
    IPH: $14,972,834
    Syndicate: HTC White
    Updated: 5/21/14 11:21 PM EST
    Add me! - 544754891
    Add me! - 113853218

    .:|Twitter: https://twitter.com/Saw_JaD |:.
    .:|Help me get a partnership! - www.youtube.com/user/eQXIIX |:.

  6. #6
    Verbose Veteran Tomatoneverdie's Avatar
    Member Since
    Jun 2012
    Location
    Crime City #514175553
    Post Count
    677
    Create your own game, Pawn City? And make sht load of money....
    I'm a chick magnet, only problem, I repel....


  7. #7
    Prominent Poet PawnXIIX's Avatar
    Member Since
    May 2012
    Post Count
    2,363
    Quote Originally Posted by Tomatoneverdie View Post
    Create your own game, Pawn City? And make sht load of money....
    Ah, yeah I wish it worked that way
    Level: 238 - Mafia: 500
    Fights Won/Lost: 42,695/7,013
    Robberies Won/Lost: 22,601/587
    Attack: 53,285,488
    Defense: 42,211,410
    IPH: $14,972,834
    Syndicate: HTC White
    Updated: 5/21/14 11:21 PM EST
    Add me! - 544754891
    Add me! - 113853218

    .:|Twitter: https://twitter.com/Saw_JaD |:.
    .:|Help me get a partnership! - www.youtube.com/user/eQXIIX |:.

  8. #8
    Supreme Scholar Dipstik's Avatar
    Member Since
    Jan 2012
    Post Count
    8,520
    Maybe you could help me with my idea for a game. It involves people sending me money and me drawing penises for them in ms paint. The penises would be bigger if they send more money. Then they can show people how big their e-penises are... Or maybe fight with them somehow. I'll make a fortune.

    Gree, you better not steal this!
    Quote Originally Posted by murf View Post
    Dippy, may be a little harsh in this thread, but he's right...
    Still mad at Bostick.

    I'll be back when the moderation is reasonable. Enjoy the forum you created, Gree.

  9. #9
    Banned
    Member Since
    Oct 2012
    Post Count
    223
    Quote Originally Posted by Dipstik View Post
    Maybe you could help me with my idea for a game. It involves people sending me money and me drawing penises for them in ms paint. The penises would be bigger if they send more money. Then they can show people how big their e-penises are... Or maybe fight with them somehow. I'll make a fortune.

    Gree, you better not steal this!
    I think people might just be stupid enough to fall for it. Kinda like buying pixelated gold right?

  10. #10
    Master of Musings mxz's Avatar
    Member Since
    Jul 2012
    Location
    The 99%
    Post Count
    2,774
    Hasn't Ram already created this sim in C? Or C++? Either way, why rewrite it in crappy Java?

    C# could be interesting just from a graphing and improved GUI perspective.

    ...And ROI is a terrible attribute. [/troll]
    #smug

    Ready to build a Movie Theater, Loft or Night Club? Click here.
    CC Loot Drops 20130122_3
    MW Loot Drops mw20121214_1

  11. #11
    Prominent Poet PawnXIIX's Avatar
    Member Since
    May 2012
    Post Count
    2,363
    Quote Originally Posted by mxz View Post
    Hasn't Ram already created this sim in C? Or C++? Either way, why rewrite it in crappy Java?
    I was really bored! I'm not exactly happy with the IDE my school provided me for C++ class, so I used my much more enjoyable Java IDE I asked him if I could see his source code, but alas I have yet to get a reply. Maybe I'll just PM him.

    Quote Originally Posted by mxz View Post
    C# could be interesting just from a graphing and improved GUI perspective.
    I'll definitely look into that

    Quote Originally Posted by mxz View Post
    ...And ROI is a terrible attribute. [/troll]
    You're just asking for a fight xD
    Level: 238 - Mafia: 500
    Fights Won/Lost: 42,695/7,013
    Robberies Won/Lost: 22,601/587
    Attack: 53,285,488
    Defense: 42,211,410
    IPH: $14,972,834
    Syndicate: HTC White
    Updated: 5/21/14 11:21 PM EST
    Add me! - 544754891
    Add me! - 113853218

    .:|Twitter: https://twitter.com/Saw_JaD |:.
    .:|Help me get a partnership! - www.youtube.com/user/eQXIIX |:.

  12. #12
    Articulate Author
    Member Since
    Jun 2012
    Post Count
    284
    To save some trouble with making them, why don't you program in the multipliers for type a and type b buildings, and depending on the building name, you could make an instantiate building arrays method that does the simple multiplication to help you out...

  13. #13
    Prominent Poet PawnXIIX's Avatar
    Member Since
    May 2012
    Post Count
    2,363
    Quote Originally Posted by AFed View Post
    To save some trouble with making them, why don't you program in the multipliers for type a and type b buildings, and depending on the building name, you could make an instantiate building arrays method that does the simple multiplication to help you out...
    The incomes are no problem, the issues is the construction times. I'm pretty sure most of the buildings follow different functions regarding how their construction/upgrade times increase. I've seen the multipliers, and they're all defined separately.

    I've never really looked into the uniformity of the upgrade times, or the upgrade costs...maybe I'll do a study on it and figure out a formula or something.
    Level: 238 - Mafia: 500
    Fights Won/Lost: 42,695/7,013
    Robberies Won/Lost: 22,601/587
    Attack: 53,285,488
    Defense: 42,211,410
    IPH: $14,972,834
    Syndicate: HTC White
    Updated: 5/21/14 11:21 PM EST
    Add me! - 544754891
    Add me! - 113853218

    .:|Twitter: https://twitter.com/Saw_JaD |:.
    .:|Help me get a partnership! - www.youtube.com/user/eQXIIX |:.

  14. #14
    Prominent Poet Ramshutu's Avatar
    Member Since
    Jan 2012
    Location
    UK
    Post Count
    1,612
    Quote Originally Posted by mxz View Post
    Hasn't Ram already created this sim in C? Or C++? Either way, why rewrite it in crappy Java?

    C# could be interesting just from a graphing and improved GUI perspective.

    ...And ROI is a terrible attribute. [/troll]
    Ah yes. Java, the short bus of programming languages.

    My one is written in Qt/c++. Image revoking some bits of it now, it isn't nearly oo enough. Whacking on a ui and stuff too.
    Proud owner of a sense of humour - and is not afraid to use it.

    365 587 968

  15. #15
    Prominent Poet Ramshutu's Avatar
    Member Since
    Jan 2012
    Location
    UK
    Post Count
    1,612
    PS: You can PM me your email address and I'll send on the source; but at the moment i'm in the middle of fiddling (I'm not happy with the proceduralness of what I had).
    Proud owner of a sense of humour - and is not afraid to use it.

    365 587 968

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •