1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

CivOne - An Open Source remake of Civilization 1

Discussion in 'Civ1 - General Discussions' started by SWY, Oct 3, 2014.

  1. SWY

    SWY Chieftain

    Joined:
    Oct 3, 2014
    Messages:
    329
    Gender:
    Male
    Location:
    The Netherlands
    Layers, in CivOne, are screens that may overlap. So, there's the main gameplay layer. When a dialog opens or a menu is displayed, it is drawn onto a separate layer. Before, all layers were combined and drawn as one picture. Now, each screen layer is drawn separately. It's just a small step into a direction that I'll continue on later.
    The end goal will be to send drawing information along with the bitmap, and make it possible to replace certain drawing actions (like drawing text) with alternate drawing actions (like using a TrueType fonts instead of bitmap fonts). There's tons of complications to this, so I won't be able to implement this by the end of the week... but for a future version, I really want to be able to support plugins that can use higher resolution graphics.

    The game tile layers are just small byte arrays that are drawn over each other. Each tile 'layer' is only 256 bytes in size, and I use unsafe pointer for (nearly) all drawing actions so it's very fast. I'd love to go into detail on this, but it'd need some time to explain it all (with code samples). Just let me know if you're interested.

    I'm actually working at the player seperation code right now. Give me about a week, and CivOne will have support for AI plugins. Then, I will try to explain how to make your own AI plugin.
    But you're right about the stages and hooks part. The AI plugin will expose properties, methods and events that would be called upon on certain events (like movement required, research decisions or city actions) and the AI code will have to handle the event, make a decision or skip the action.

    I believe I currently use a very old Windows 95 folder selection dialog. Since .NET Core has no Windows Forms support (yet, it will be added in .NET Core 3.0), I need to use P/Invoke calls to open the dialogs myself. The current dialog works, but it looks dated, that's why I want to replace it.

    When I started working on CivOne, I used WinForms on Windows, GTK on Linux and Cacao/MonoMac on MacOS X.
    Then, I moved to OpenTK, because it was easier to maintain on multiple platforms.
    Now, all platforms use SDL for graphics, which is a lot faster.

    GTK is only used on Linux, and only for native dialogs. On Windows, the Win32 API is used. On macOS, there's a hacky implementation of Cacao using AppleScript, this needs to be changed to native Cacao. The macOS native calls are a bit cumbersome from C#, though... that's why I went with the AppleScript implementation at first.

    From my work, I've got a lot experience with adding/maintaining multi language support to existing applications, so I know exactly how I would need to implement this. It is a pain to do it within an existing application though, but fortunately CivOne isn't a very large project. I expect I will be able to transition everything to a references database in a couple of days.
    I will probably add/maintain Dutch translations myself, and leave the other translations to people with more experience with those languages. That's why I want to add the translation functions to the website.

    You are right, I know, but there's one thing about the website: I like working on it. It's low priority though.
    I will keep the main discussion in this thread.

    Edit:
    Actually, I almost forgot... I'm going on holiday this week and I don't think I'll be taking my notebook. So it's probably going to be two weeks, then...
     
    Last edited: Aug 13, 2018
  2. Quintillus

    Quintillus Archiving Civ3 Content Supporter

    Joined:
    Mar 17, 2007
    Messages:
    6,191
    Location:
    Columbus
    Thanks for the reply, I appreciate it! Graphics is one of those things where my personal projects could benefit, but my work ones wouldn't, and as a result I haven't dove into it much. SDL seems to support a lot of languages; might be a good excuse to try something like Rust. Although I've also managed to paint myself into a corner by my existing Civ-related projects being in Java, which SDL doesn't support... who would have thought back in 2009 that C# would in some ways have more convenient cross-platform support a decade later? But that's my dilemma in pushing the graphics forward - even if I could get the graphics working, I'd have tens of thousands of lines of Civ related code to move to a new language.

    The layers concept makes sense, particularly with the eye to replacement later on. I would be interested in the tile layers, if only as an example of something Civ-related with SDL.

    And definitely understand the website being something you like working on, and therefore receiving attention. That's the best part about personal projects for me - when I want to work on a part of it that's interesting, even if it's not high priority, I can do that. Well, maybe the second-best part after solving problems that are more applicable to me than the ones on my day job tend to be.

    No rush on account of me; I'm also traveling this week, and always have more projects than time for them anyway.
     
  3. rehn

    rehn Chieftain

    Joined:
    Nov 18, 2007
    Messages:
    3
    When testing my code for use of the AStar algorithm in the "goto" command I experienced 2 things.
    1. The barbarians (from ship) are really stupid, landed, killed the only defender in my capital but then just started to wander around randomly without entering the city.
    2. Disasters seems to be much too frequent.

    About the "goto": Have a pending pull request on that. If someone has a really large continent saved, please check it out
    The implementation is a bit slow since the algorithm is run for every step.
    It can easily be improved to be only run once for every turn if it is too slow as now.
     
    Last edited: Aug 16, 2018
  4. SWY

    SWY Chieftain

    Joined:
    Oct 3, 2014
    Messages:
    329
    Gender:
    Male
    Location:
    The Netherlands
    Hi rehn. Thank you for your contribution!

    The current AI is using random GoTo to any visible tile. It makes the AI really stupid. The correct logic for GoTo has been figured out and the details are somewhere in a forum thread here. I haven't been made time to implement it yet, though.
    The AI should get better with the current branch that I'm working on.

    As for the GoTo AStar algorithm: I've added a comment to your PR. Basicly, I want to pull your code, but it won't be made the standard, especially if there are performance issues. Can you make the appropriate changes to make the AStar algorithm optional, with a Patch setting to choose between the default and the AStar algorithm. If you need any help or pointers with that, please let me know.
     
  5. hospital

    hospital Chieftain

    Joined:
    Feb 8, 2018
    Messages:
    49
    I have been working on disorders and at the moment I am having some trouble with 'we love the president day'. My issue is getting the happy people to march right to left instead of left to right. If you have time can you have a look at my branch please @SWY ?

    https://github.com/cdonges/CivOne/tree/disorder
     
  6. hospital

    hospital Chieftain

    Joined:
    Feb 8, 2018
    Messages:
    49
    Never mind, I have worked it out.
     
  7. strategon

    strategon Chieftain

    Joined:
    Sep 3, 2015
    Messages:
    16
    Will the CivOne OS remake be moddable?
     
  8. hospital

    hospital Chieftain

    Joined:
    Feb 8, 2018
    Messages:
    49
    It already is to some extent.
     

Share This Page