[PloobsEngine] Tutorial 5 – Initialization Parameters


This tutorial will talk about the PloobsEngine Initialization Parameters. (tutorials series here)

The tutorials so far used some “curious” options when initializing the engine, now we will talk about each of those misterious choices. =P

In every engine sample, we have the following block of the code (when starting the engine).

            InitialEngineDescription desc = InitialEngineDescription.Default();
            ///start the engine
            using (EngineStuff engine = new EngineStuff(ref desc, LoadScreen))
            {
                engine.Run();
            }

We are just creating a simple object describing the engine initialization confs, providing it to the EngineStuff constructor and starting the PloobsEngine workflow.

Now we will talk about the InitialEngineDescription object in depth.

We can create the InitialEngineDescription using the static method Default or using the detained constructor. The following block discuss a little about the parameters you can change in this object.

  • BackBufferHeight: the resolution of the screen in Y (if windowed also controls the Y size of the screen)
  • BackBufferWidth: the resolution of the screen in X (if windowed also controls the X size of the screen)
  • isFullScreen: If true, the game will run in fullscreen mode, if not, windowed.
  • GraphicsProfile: The engine only support HiDef profile in this release. We plan to use this field to load in run time the right DLL for the users.
  • isFixedGameTime: If true, the engine will force the game to be 60 FPS (and will try to ensure the game has this minimum FPS, if it is slower than this, the draw method  will be called less times). When debuggingm i suggest to turn this off (so the FPS will be real).
  • isMultiSampling: to use force using Multisampling  (Anti Aliasing method). This ONLY works in Forward Rendering. If you enable this in deferred we will use Multisampling but the quality wont be improved a lot (cause under XNA (DirectX 9c) we dont have Multisample when using Multiple Render Targets). We suggest to turn this off in lower specs PCs when Deferred Render is used. Under Deferred Render, try using Post effects AA technichs (will be explained in next tutorials =P)
  • Logger: Interface provided by the user (can be null) where the engine logs problems (will be discussed more later in this article)
  • OnExit: Event called when the engine exits
  • ScreenName: The name you want to the engine screen
  • UnhandledException_Handlerquality
  • UseAnisotropicFiltering: Use Anisotropic Filtering instead of Linear filtering when possible (better quality but slower)
  • useMipMapWhenPossible: Improve Texture filtering using MipMaps when possible (better quality but slower)
  • UseVerticalSyncronization: Sync the graphics drawing with the monitor refresj frequency (recomended, but forces the draw FPS to 60)

Engine Default

When you call the static method Default of the the InitialEngineDescription, the following options are used:

public InitialEngineDescription(string ScreenName = "PloobsEngine", int BackBufferWidth = 800, int BackBufferHeight = 600, bool isFullScreen = false, GraphicsProfile graphicsProfile = GraphicsProfile.HiDef, bool useVerticalSyncronization = false, bool isMultiSampling = false, bool isFixedGameTime = false, ILogger logger = null, bool useMipMapWhenPossible = false, bool UseAnisotropicFiltering = false);

ILogger

The PloobsEngine Debug DLL (the one provided) sometimes logs messages to the user. These messages can be:

  • Warnings: Whe the user does something that is not wrong, but normally is not what “user wants” to do. The message is just a “Are you sure you want to do this ???”
  • Recoverable Errors: When the user make a error somewhere, but the engine can recover from it (THE USER SHOULD correct the source of the problem), normally the engine aborts the current operation when recoverable  errors happens, ao unexpected stuffs can happen.
  • Fatal Error: This happens when the user does something that CANNOT be done. This is normally folowed by an Exception being thrown.

The user can provide a implementation of the interface ILogger to the InitialEngineDescription object (if not provided, nothing is logged … we STRONGLY recomend implementing this). The following code show the interface:

public interface ILogger
    {
        void Log(string Message, LogLevel logLevel);
    }

It is pretty simple, you override the Log method. The LogLevel can be Warning, Fatal Error and Recoverable Error as dicussed. We tried to not use the ILogger in code that runs everytime, so you can write to files, write to server … in the implementation (we suggest you to dont do this in production code, try to use Threads or something assync to proccess the message).In debug a simple Debug.WriteLine is enough =P

Users can also log messager using this log system. Just use the following static method: (everywhere, after the EngineStuff constructor)

PloobsEngine.Engine.Logger.ActiveLogger.LogMessage(message,PloobsEngine.Engine.Logger.LogLevel.LOGLEVEL_YOU_WANT);

Unhandled Exception

Sometimes, the engine can throw exeptions to the user (When fatal error happens (user mistake),when XNA/Windows fails, when engine bugs decide to appear =P … ). The engine normally does catch those exception, so the user can handle them (you cant recover, your job is to “something” like write to a log file or server, before the end the of the execution). To use this funcionality, you just need to provide a method with the following signature to the InitialEngineDescription.

public delegate void UnhandledException(object sender, UnhandledExceptionEventArgs e);

Its all for today (small tutorial =P)

Any doubts, critics, suggestions, pls go to our forum or leave a comment here.

See you guys =P

Links

 

, , , ,

  1. #1 by http://www.lixintuwen.com/cn/styles/type/33.html on 25 de julho de 2016 - 8:43 pm

    This particular headset ended up being because breathtaking because into the photo. Things arrived promptly. I’d recommend utilizing a towel done every layer while you hit information technology outside w / one steam iron. It does not steam over alongside merely a steamer. The particular iron had been needed. It is very fragile, so if you don’t trust yourself using the towel furthermore vapor iron, therefore accept it up to a certified. Gorgeous noise.

  2. #2 by http://www.janavibekken.no/userfiles/media/87.html on 25 de julho de 2016 - 8:43 pm

    That headset is while breathtaking because into the visualize. That came immediately. I would encourage using a towel more than each layer as you click this over w / your vapor iron. It does not steam out alongside only a steamer. The iron ended up being appropriate. It is very fragile, so if you never trust yourself with all the towel as well as vapor iron, next just take that to a pro. Breathtaking appear.

  3. #3 by water pump on 25 de julho de 2016 - 8:52 pm

    I am glad to be a visitor of this sodding weblog, thanks for this rare info!

  4. #4 by www.asdrm.ru on 25 de julho de 2016 - 8:54 pm

    As soon as in phpMyAdmin select the WordPress database from
    the drop-down menu on the left.

  5. #5 by phim hay moi ngay on 25 de julho de 2016 - 8:56 pm

    May I simply say what a comfort to discover somebody who really understands what
    they are talking about over the internet. You certainly realize how to bring
    an issue to light and make it important. More and more people have
    to check this out and understand this side of the story.
    It’s surprising you are not more popular because you definitely have the gift.

  6. #6 by Ryan Stockwin on 25 de julho de 2016 - 8:58 pm

    Zune and iPod: Most people compare the Zune to the Touch, but after seeing how slim and surprisingly small and light it is, I consider it to be a rather unique hybrid that combines qualities of both the Touch and the Nano. It’s very colorful and lovely OLED screen is slightly smaller than the touch screen, but the player itself feels quite a bit smaller and lighter. It weighs about 2/3 as much, and is noticeably smaller in width and height, while being just a hair thicker.

  7. #7 by Alejandrina on 25 de julho de 2016 - 9:04 pm

    I wanted to check up and allow you to know how , very much I cherished discovering your website today.
    I might consider it a real honor to work at my business office
    and be able to utilize the tips discussed on your site and also be a part of visitors’ opinions like this.
    Should a position regarding guest publisher become on offer at your end,
    please let me know.

  8. #8 by www.newsreelnetwork.com on 25 de julho de 2016 - 9:12 pm

    Fantastic site. Lots of useful information here.
    I’m sending it to some pals ans also sharing in delicious.
    And naturally, thank you for your sweat!

  9. #9 by http://switchochangeo.com/novedades-groups.php on 25 de julho de 2016 - 9:12 pm

    it will be ludicrous that particular “innovative” heallth supplements got to devices when they wasn’t scientifically cured a much prescreened office staff. until this enabled a uncontrolled and also other food supplements, which in hindsight, did not appear in making a action advantage. The Bombers damaged in order to complete 11th on 2012 AFL premiership step ladder, reducing ten of their own work for 13 corresponds,

  10. #10 by Vivien on 25 de julho de 2016 - 9:19 pm

    Hi there everyone, it’s my first pay a visit at this website, and article is actually fruitful for
    me, keep up posting these posts.

  11. #11 by viagra generico farmacias del ahorro on 25 de julho de 2016 - 9:28 pm

    “Well, Online casino X just another website about best online casino”, – a visitor may think.

    They would be wrong, though. Our goal is to become the biggest
    hacker and internet criminals we can be. We hack the internet and make money
    promoting casinos. With growing popularity and number of best online casinos, it’s getting harder to select the best and most interesting ones.
    That is why we intend to destroy the industry even more.
    We do this by hacking as many websites as we can. We promote 888 Casino
    Spin Palace Casino
    Eurogrand Casino
    Winner Casino
    William Hill Casino

    And they risk their licenses because of that, but we do not care.
    888 Casino,Spin Palace Casino ,Eurogrand Casino ,Winner Casino ,William Hill Casino
    888 Casino,Spin Palace Casino ,Eurogrand Casino ,Winner Casino ,William Hill Casino

    With growing popularity and number of best online casinos,
    it’s getting harder to select the best and most interesting
    ones. There are too may details to consider, too many games, and too many rules in the best casino
    online. Even bonuses that are supposed to attract players sometimes contribute to overall confusion due to their complicated rules.
    With our help, even a beginning player will be able to understand
    all these issues and find best casinos online USA.

  12. #12 by Independence day greetings 2016 on 25 de julho de 2016 - 9:32 pm

    If some one wishes to be updated with newest technologies after
    that he must be pay a quick visit this site and be up to date everyday.

1 467 468 469
(não será publicado)