• Content count

  • Joined

  • Last visited

Community Reputation

104 Neutral

About WigglesMcMuffin

  • Rank
  1. Help with some basic OOP structuring

    [quote name='BCullis' timestamp='1338398044' post='4944729'] How about: A Town has a Government and a list of Citizens. The government class has a Tax_Citizens(list_of_citizens) method, and the list can be provided by the Town. It follows the object metaphor for how towns actually operate, anyway. The government of a town can be swapped out for another one, but the citizens (unless they move) are always members of that town, regardless of government. As far as making the Town responsible for government functions, why not just design an interface where every Town has a RunGovernment() method that calls it's local government's run function, where you can define whether it's currently time to tax citizens and any other gov't-specific parameters. Then, when the gov't changes, the new one also has a run function that will handle things according to the new regime's standards. All the Town is saying is "okay, gov't, do your thing at your own pace". Snippet: [CODE] class Town{ public: Government current_govt; List<Citizen> citizens; public void RunGovernment(){ //gets called once per frame current_govt.run(); //has internal time checks to perform functions at its own rate } }; [/CODE] [/quote] Perfect! That's what I was thinking I might end up doing, I just didn't know if it'd be better to house the Government at the top, so it would be able to call it's own functions when it wanted/needed. Thank you. [quote name='Dawoodoz' timestamp='1338384691' post='4944666'] Since the AI will be the hardest thing, I would start with a basic prototype of the game rules where the entire world's state can be duplicated and simulated. I would have a counter for each type of citizen so that the AI can simulate the game rules much faster when trying to predict the results of different actions. The game will not run fast enough to evolve an arbitrary neural net from scratch but you might be able to use the monte carlo method. [/quote] I've been looking into Neural Networking in general on account of your suggestion. I think it'll be really useful, once I wrap my head around it enough. Thanks for the tip.
  2. Where to start to program a game

    [quote name='Serapth' timestamp='1337968878' post='4943299'] [quote name='Rybo5001' timestamp='1337947348' post='4943203'] [quote name='Serapth' timestamp='1337431887' post='4941421'] learning C is not a great starter language [/quote] Totally disagree with this, C was my first language and learning the hard stuff first makes every language after that so much easier (especially since you understand what's going on beneath the syntax) [/quote] This is one of those baffling pieces of logic I see recurrent among ( pro and prospective ) game developers. Think about this for a moment, with every other topic you can imagine for which formal instruction exists... do you EVER start off hard to make the easier stuff later seem easier? No, you don't. You start learning math by learning your numbers and sums and progress from there. You don't start with calculus! When learning to cook, you don't start with a souffle. If you pick up a chiltons manual to fix your car, does it start off with engineering an engine? Do interns start with open heart surgery? You don't learn English by reading great literary works, you start with the basics, like Mr Muggs goes to School and Red Shoe, Blue Shoe, Green Shoe, MooShoo. This whole meme of starting with the hard stuff to make the easy stuff easier is so patently wrong in 99.999999% of endeavers, what exactly makes computer science so unique as to buck the trend. Here's a hint. Nothing. Starting hard is just a bad way to waste your time. Don't get me wrong, you can do it, it's just certainly not a productive way to go about things, as millennia of teaching experience has already taught us. Now, you could argue if C is hard or not, but that's a completely different conversation. [/quote] I agree whole-heartedly. I started with VBasic, for a little while, and was like "this is slow, I bet I'll get great much faster by going with C++!". I took a beating. For a beginner, something like Python, or VB, or a scripting language is great, because printing something to the screen. Is print "hello, world". You don't sit there and scratch your head trying to figure out what the cryptic method calls are, and what an include statement is. It's possible to do it. I probably could have. However I'm glad I stepped back from that and went to Python for a while. With the little time I initially spent with C++, I felt like I was backpedaling the entire time, just so I could glimpse the top of the mountain.
  3. Help with some basic OOP structuring

    I have some decent level of programming experience, I've been progessing along nicely (typically outstripping my courses, and being self-taught). I'm by no means anywhere near expert, but somewhere in this dillusional brain, I like to think I've passed some beginner milestones. That being said, I've moved on to my second visual game. The first I did in 6 weeks as a final for my last Programming class. It worked. Honestly it did a lot better than I'd expected, but I know it isn't what I'm really capable of. I think the reason, or one of them, is because I went in with good intentions, and a handful of useful skills, but no knowledge of [b]HOW[/b] I should be actually designing my game. I attempted to implement a main class, whose sole job was to change out states, like the projector operator at a cinema; but where I really feel short was just in the way I structured the game specific objects. The map, the tiles, and the pieces that went on top of that. Fast forward to today, I've gone from Java to C++ (partially so I can be closer to the SDL libraries, and hopefully OpenGL later on down the line). I'm working on a basis for the game to work off of. I'm attempting to create a more dynamic, cell-based, map model. Something to really breathe life into the towns and surrounding areas that the player might inhabit. The question I have (if you've managed to read this far down my rant [img]http://public.gamedev.net//public/style_emoticons/default/rolleyes.gif[/img] ) is on how to setup the couple of classes that I want to work with each other as far as "towns" are concerned. So far, I have a Tile Block, which will receive information on what type of tie it is (water, mountain, hill, etc), and then what sort of environment goes on top of that (forest, desert, etc), and it'll then be able to hold some sort of human inhabitibility, a town or settlement of some form. That part is 'simple'. As for the towns I've seperated Citizens out (I'll work on specializing them later), and then I have a town class, which will do things like manage all of the things that are pertainent, like which of the factors make the town succeusful, and what things it struggles with (i,e, timber if it's in a forest, and having a lack of metals for tools, or viable farm space, etc). Then, on top of that I have a Government class, which will manage things like taxing the Citizens, and maintain the towns strengths (funding a militia, etc). These governments will communicate amoungst one another, and vie for power, etc. I plan on having them being exchangable (i.e. if one town takes another, and installs it's own leader). With all of that said and done, what I'm looking to find an answer to is how should I structure the couple classes (Citizen, Government, and Town specifically). I want the Government to be able to tax all it's citizens, as well as any governments it's above (i.e. installed ones in controlled towns), but because it might be changeable I don't want to have the problem of "orphaned" towns. So I didn't know whether or not to place the Government at the top, and then just have a retool method (which would change out all of it's members) or set the town on top, and then have the town pass in it's Citizen list whenever the government attempted to run it's collectTaxes. However the problem with that is that it is then decided when it does so from the Town, which doesn't seem right. Does anyone have thoughts or considerations as to what I might be doing right/wrong with this model? Regards, WigglesMcMuffin