Page 5 of 5

Re: Porting to C++

Posted: 13 Jan 2012, 03:57
by Chojun
Per wrote:Pumpkin created this game with several people working on it for years, full time. You are going to make it from scratch, alone, in your spare time? Perhaps it is time for a reality check?
How long did it take to invent the wheel?

How long did it take the 2nd time?

Re: Porting to C++

Posted: 13 Jan 2012, 04:11
by vexed
Chojun wrote:
Per wrote:Pumpkin created this game with several people working on it for years, full time. You are going to make it from scratch, alone, in your spare time? Perhaps it is time for a reality check?
How long did it take to invent the wheel?

How long did it take the 2nd time?
Image
:help:

Re: Porting to C++

Posted: 13 Jan 2012, 05:01
by stiv
How long did it take to make the first apples-to-oranges comparison?

Re: Porting to C++

Posted: 13 Jan 2012, 06:14
by lav_coyote25
now before this turns into a freaking flame war, lets just say all parties are correct. one persons working on the source will take years / decades. now if that same work were to be divided into team work, would obviously take less time. still, years. so there it is. 2004 till now is just a spit in the bucket. and the source is now better than it was. to those that disagree - fork it and prove me freaking wrong. now, the next one to start a discussion should remember that every one has an opinion and that opinion will surface. everyone is entitled to be wrong. right? :annoyed:

Re: Porting to C++

Posted: 13 Jan 2012, 06:35
by Chojun
lav_coyote25 wrote:now before this turns into a freaking flame war
I think your intuition and experience serves you well.
stiv wrote:How long did it take to make the first apples-to-oranges comparison?
I'll distance myself from this discussion.

:stare:

Re: Porting to C++

Posted: 08 Mar 2012, 10:12
by Lord Apocalypse
Seismo wrote:
vexed wrote:FWIW, last I heard, Chojun's code was given to Seismo who is working on a C# version.
While they both have project pages on SF, neither of them have anything in the repo.
I am still working on the c# version. I was under heavy load to finalize my engine all belongs to, now i implement the logic. It is sad, i can not use any line of orginal WZ sourcecode due to its old style. I have to code all new. I use the WZ code only to understand some specific parts like the game internal rules. For a first draft i would like to use the models and textures from orginal, but than i would have a dilemma, i do not want to share my engines source code... So SF seems to be not the best platform for this project and i need new graphic objects too. Oh man, still so many things to do... :augh:
Given a good understanding of the original source as well as the C++ source provided by Chojun plus a firm grasp of C# (and a good design) its possible to have a working engine in a short amount of time. From my understanding C# falls somewhere between C++/Java and Visual Basic in how the code is written and operates.

Quick code sample from a Master of Orion 3 clone Majesty of Omega

Code: Select all

namespace Majesty_of_Omega.Logic.GameConfiguration
{
    /// <summary>
    /// The game manager saves and loads games to the My Games folder of majesty of omega
    /// </summary>
    public class SaveGameManager
    {
        /// <summary>
        /// the standard save game extension
        /// </summary>
        private const string saveGameExtension = ".moosav";

        /// <summary>
        /// this value is true, if the SaveGameManager is operating in unit test modes.
        /// the variable changes the behavior of the MooGameFolder property
        /// </summary>
        private readonly bool _testMode;

        /// <summary>
        /// Initialize a new instance of  <see cref="SaveGameManager"/> class.
        /// </summary>
        public SaveGameManager()
        {
        }

        /// <summary>
        /// Initialize a new instance of <see cref="SaveGameManager"/> class.
        /// </summary>
        /// <param name="testMode">if set to <c>true</c> then the SaveGameManager is operating in unit test mode.</param>
        /// <remarks>the variable changes the behavior of the MooGameFolder property</remarks>
        public SaveGameManager(bool testMode)
        {
            _testMode = testMode;
        }

        /// <summary>
        /// Gets the last games, which resides int the my games folder of majesty of omega
        /// </summary>
        /// <value>The last games.</value>
        public List<SaveGameInfo> LastGamesInMooGameFolder
        {
            get
            {
                var gameInfos = from file in Directory.GetFiles(MooGameFolder)
                                orderby file
                                select LoadGameInfo(file);
                return new List<SaveGameInfo>(gameInfos);
            }
        }

        /// <summary>
        /// Gets the Majesty of Omega save game folder.
        /// </summary>
        /// <value>The moo game folder.</value>
        public string MooGameFolder
        {
            get
            {
                var mooGameFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                                    @"\My Games\Majesty of Omega";
                if (_testMode)
                {
                    mooGameFolder = Path.GetTempPath() + @"\Majesty of Omega";
                }
                if (!Directory.Exists(mooGameFolder))
                {
                    Directory.CreateDirectory(mooGameFolder);
                }
                return mooGameFolder;
            }
        }

        /// <summary>
        /// Saves the specified game to a file stream.
        /// </summary>
        /// <param name="game">The game.</param>
        /// <param name="path">The full path to the file system or a simple file system compatible game name.</param>
        public void Save(SaveGame game, string path)
        {
            Require.IsNotNull(game);
            // Assures the correct save game extension
            path = Path.ChangeExtension(path, saveGameExtension);

            // check, if the path contains a directory. if not, assign the standard
            // save game folder
            var directoryName = Path.GetDirectoryName(path);
            if (string.IsNullOrEmpty(directoryName))
            {
                path = Path.Combine(MooGameFolder, path);
            }

            var gameInfo = new SaveGameInfo
                               {
                                   GameName = Path.GetFileNameWithoutExtension(path),
                                   TurnNumber = game.TurnNumber,
                                   Time = DateTime.Now
                               };
            var fStream = new FileStream(path, FileMode.Create);

            // Create our binary formatter object.
            var formatter = new BinaryFormatter();

            // Serialize our data.
            formatter.Serialize(fStream, gameInfo);
            formatter.Serialize(fStream, game);

            // Close our data file.
            fStream.Close();
        }