Results 1 to 6 of 6

Thread: Some guidance needed...

  1. #1

    Some guidance needed...

    Hey fellow programmers,

    So, you have this game in your head since the 90s. You played it twice on an Amiga and was never able to win...

    Many moons pass and you finally decide you're gonna do the game yourself. You've been thinking about it for so long you think you can remember all the stuff that needs to be done.

    You've been a programmer of other stuff for so long that you feel confident you can pull this off. But, since you never programmed a game, just read a lot about the basics of getting one off the ground, you go really slow and over think A LOT!!

    You finally bite the bullet and have all the classes you think you'll need all laid out in code. You structure the code to be your future programmer self friendly and, also, over think it A LOT...

    AND you get stuck on a basic thing... How to manage resources, ARGHHH!!!

    Well it's a bit more than that but this is the first hurdle that's beginning to eat out my resolve.

    Ok, let's talk a bit about the game. It's not a game that most gamers are on to. It's all I like about Simulators and RTS. BUT, without all the things I hate, like the swift need to go to battle...

    The whole game is on a solar system. I'm modeling it around our solar system, since the original game was also modeled around it. And besides, I'm doing this for the future self fun. I can't really waste time inventing names for planets and shit... And besides, naming things has always been our kryptonite...

    You start on the third planet from the Sun, that's Earth... You have some resource gathering machines to start and they begin gathering them immediately.
    You also have a limited tech library. This library will be "enbiggen" by both an R&D/University kind of building and from timed "random" archaeological finds.

    The first thing you wanna build is a ship that allows you to build an orbital station. This orbital station will then allow you to build scouting ships, long range mining ships that will gather rare minerals from the asteroid belt, and finally ships that will make other orbital stations on planets that you previously scouted.

    The original game's objective was to beat the Martians with a bigger amount of battle drones. You would have to manage resources and build drone ships fast enough before you triggered the Martian attack. You would be quite oblivious of that objective right until you triggered that attack because every scouting ship or other kind of ship would be completely lost without any clue of what happened.

    Ok, onwards... I've done all my classes with the least inheritance possible since that would not be advised.

    I have a Timed base class that is the father of all things that needs time to build.

    I have a Game class that I'm thinking will have most of it's mechanics. Unless I see that it's unmanageable or you guys send me elsewhere.

    I then have a Planet (singular) class that will contain the resource numbers. I also have a Planets (plural) class that is a basic wrap around a FPObjectList with a custom Enumerator. It manages the many planets.
    This Planet (singular) class has a member for the resources, the buildings and the machines.

    I have a Resource and Resources set of classes with, also, a custom Enumerator (I prefer the "for x in y" kind for cycle ). This manages groups of resources.

    I have a Research and Researches class, ditto as above. This will be the container for the tech library. Yes it's quite basic and probably needs a bit more thought!

    I have a Building and Buildings class, as above. The Building class is extended to make the more specific buildings like Storage or plural, Factory or plural and R&D/University.

    Lastly I have a Vessel and Vessels class, as above. The Vessel class is extended to make the more specific classes that I've mentioned above: Scout Ships, Long Range Mining, Orbital Station, Orbital Builder, Cargo Ships.
    I'm still stuck on how I'll attach the vessels to the other things. Like the orbital station to the planet and the cargo ships to the orbital stations upon docking and all that... But that'll have to be after the bloody resource management predicament I'm in, is resolved.

    In terms of GUI, well, that's an after thought. My real pleasure is to manage the whole thing. Make plans with the small resource count or just wait and then go on a splurge. I'm doing it as detached from GUI as I can, since I'm also planning a server side.

    ATM I'm just gonna use good old Buttons, Edits, Drop-Downs, Grids and all the basic widgets from a windowed system. If I see any interest in having a proper game engine with 2D or 3D stuff, that will be another post requesting more guidance

    I know I should be thinking of a way to avoid race conditions/data loss and all that between the game class and the GUI. One thing at a time. I wanna focus on game mechanics first, then I'll figure out how to peek and mod the data inside the game environment safely.

    First Question: Apart from the contained classes on those lists have a pointer to the planet class how should they "know" about each other?
    Second Question: Should I implement a messaging system? If so, could you direct me to a good one that can be thread safe? I know that this answers Q1 but I'm stuck. The over thinking again...
    Third Question: What's a good model for game time. I'm a bit stuck on this model, since I'm thinking about "pause", so storing TDateTime with system time will not work.
    Four Question: This is where I'm stuck, so I'll ask: Can you guys give me links, docs, and other stuff on the most basic resource management algorithms, so I can figure it out?

    Sorry for such a lengthy post and I appreciate and thank you from the bottom of my heart if you could get me unstuck!!

    Cheers,
    Gus

  2. #2
    How did they do things on Amiga? Did they have OOP or was it all structured?

    I would recommend simplifying everything, start from the start. Divide into smaller and smaller problems and solve them one at a time. Once you have something that is bigger and more complex you will see which if any of the more complicated stuff you need to implement. It maybe more work than just 'doing it' perfect the first time, but that way you have excellent understanding of why things like object lists exist and what problems they solve and what the game needs in order to work.


    1) Separate data and logic. Pass the data to the logic step(s) as parameter, for each game turn to be processed. a) Process unit initiative b) Do communication c) Move and battle and physical activities d) tally resources e) AI thinks... and so on.

    2) No. And no multithreading either.

    3) Go turn based and you do not need to think about time. Again, you can add real time later.

    4) You should look for tutorials in other languages and see which ones work for you. Once you find a good one it is worth the trouble to try to decipher the (foreign) code.
    Last edited by Thyandyr; 15-12-2017 at 09:54 AM.

  3. #3
    Making games from scratch is good learning experience but if you already know how to program and want to make a game rather than never finish it then pick one of available game engines. Saves a ton of trouble.

  4. #4
    tl;nr but may be your problem is you started too big. Try to simplify your idea and implement it. Once it works, add stuff, implement and repeat.
    No signature provided yet.

  5. #5
    It'd be a nice idea to show the game prototype - the name of the Amiga game you're trying to implement, best if youtube link too. Because I can't grasp the game mechanics from your description except that: There are planets, each has some resources. Player builds ships and mines resources to get new tech and build other ships and battle drones.
    Seems like Reuinion, right? That was a nasty game

    About your questions:
    1. Why would all planets want to know about each other? You have X, Y of the planet, you have the ships, you move ship to X, Y and if it coincides with any of the planet it mines resources.
    2. Why do you need a messaging system? Each ship just comes to X, Y and if there is a planet there, it mines resources.
    3. Read a bit about "game cycle". It's usually fine to have T: Double and adjust it by dT := now - LastTime each frame if not paused.
    4. What do you mean by "resource management"? You mean Lazarus resources, or planetary resources?

    What experience do you have in programming?
    My free and opensource games: http://decoherence.itch.io/
    Sources are here: https://github.com/eugeneloza?tab=repositories

  6. #6
    Quote Originally Posted by eugeneloza View Post
    Seems like Reuinion, right? That was a nasty game
    The game which gacarreno is descibing is named Deuteros: The Next Millennium
    https://en.wikipedia.org/wiki/Deuteros
    https://www.myabandonware.com/game/d...millennium-72y

    Deuteros is actually a sequel for Millennium: Return to Earth
    https://www.myabandonware.com/game/m...rn-to-earth-pi

    I have played Millennium: Return to Earth in the past but I haven't played Deuteros because unlike Millennium it is not available for PC.

Bookmarks

Posting Permissions

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