Coder Social home page Coder Social logo

tiptup300.slaam's Introduction

SlaamMono

SlaamMono is a port of Slaam from Zune XNA to MonoGame. It is based on an old publicly released copy.

I am converting it over to pc, recreating assets, and generally revamping all the programming as it was done years ago before I knew a lot about proper object oriented programming.

Current Plan

Right now I'm in the process of cleaning up the code. I want to pull out the general game engine stuff into it's own class library.

tiptup300.slaam's People

Contributors

tiptup300 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

tiptup300.slaam's Issues

IScreenState

public interface IScreenState { }
public interface IScreen<TScreenState> where TScreenState : IScreenState
{
   void Update(TScreenState state);
}
public BoardScreenState : IScreenState 
{
   public List<CharacterProfile> CharacterProfiles {get; private set;}
}
Public BoardScreen : IScreen<BoardScreenState>
{
   public BoardScreen(IResolver<TextureLoadRequest, CachedTexture> textureLoader>
   {
      _textureLoader = textureLoader;
   }

   public void Update(BoardScreenState state)
   {
      ...
   }
}

Hardcode Screen Lookup To Be Configured By Composer

Currently ScreenResolver uses IResolver (ScreenNameLookupResolver) to find a list of screenLookups. Instead of automating the listing of screens and their interfaces, we should hardcode them in the composition.

  • Remove ScreenNameLookupResolver
  • Create ScreenNameLookupConfiguration
  • Init the ScreenNameLookupConfiguration in Composition with MainMenu, LobbyScreen to match current functionallity.

Bootstrap Screens

  • The IScreenFactory needs to be removed.
  • The screens need to have interfaces created for each.
  • Each screen needs registered in the bootstrap.

Implement Render Graph Data Into Composite

public abstract class Graph 
{
  public float ZOffset {get; private set;}
}
Graph graph = new CompositeGraph(
    new TextGraph(
        font: _smallFont,
        text: $"FPS:{fps} ",
        position: new Vector2(5, 5), 
        color: Color.White,
        zoffset: 1f), 
   new BoxGraph(
         color: _semitransparentBlack,
         destination: _boxDestination,
         zoffset: 0f));

Renderer notes

So to start, the renderer should use render graphs while can be instantiated as data.

new RenderGraph() 
{
   new RenderText(
      font: "12pt",
      text: "Press Start",
      position: new RenderPosition(10,10),
      shading: RenderSolidShading.White
   ),
   new RenderRectangle(
      position: new RenderPosition(0,0),
      width: "100px",
      height: "100px"
   ),
   
   
};

Refactor Properties/Fields out of Screens Into State Instances

Each screen has different private/public fields that should be separated from their logic. In some instance these fields are accessed from other objects.

Screens To Be Fixed

  • GameScreen
  • StatsScreen
  • BoardSelectionScreen
  • CharacterSelectionScreen
  • LobbyScreen
  • CreditsScreen
  • FirstTimeScreen
  • HighScoreScreen
  • LogoScreen
  • MainMenuScreen
  • ProfileEditScreen
  • SurvivalCharacterSelectionScreen
  • SurvivalGameScreen

CurrentMatchSettings Needs Turned Into An Instance Class

CurrentMatchSettings is a static class, it needs to be an instance state class.

Current State Of The Class

  • It has fields which are all state.
  • It has logic that interprets data from mainmenu and zblade specifics.
  • It has logic that also writes out this data.
  • It has the logic to actually write that out to disk.
  • It has the beginning of transition by having a static Initialize taking in ILogger.
  • It also has logic on reading values from the harddrive.

To Fix this

  • Tear out loading/unloading logic outright.
  • Tear out zuneblade menu interpretation logic.
  • Make the fields into instance properties.
  • Implement DialogString methods using instance of CurrentMatchSettings as instance.
  • Change name to MatchSettings

Challenges

  • Screens using for their data (GameScreen, LobbyScreen, etc)
  • DialogStrings using these fields.

Implement Handoff of BoardSelectionScreen selected board through LobbyScreenState & a Request

Currently the loading logic of the boards is within BoardSelectionScreen, this is incorrect there should be a BoardService that gets board textures through IResources.

Once it's implemented this way, the default board can be pulled directly in lobby using a IResolver or through that service. Then when the user selects the board selection, it should create a request for BoardSelectionRequest() and pass in the LobbyScreenState as just an IState. When the boardSelectionPerformer finds the selected board, it should create a new request and pass in the IState, from there the requester should determine if it's a lobby screen or an options screen and what to do. If it's lobby screen it should return a LobbyScreenState with the board set correctly.

Note that one consideration is being able to set a default board texture in the options.

Implement changeable state

Public class ChangableState
{
Public TStateType State {get; private set;}
Public void ChangeState(TStateType newState)
{
State = newState;
}
}

Mutable Screen States and passing Imuttuable Data Types

The main thing I want to do is separate the behavior from the state data out right. It doesn't have to be immutable to start, just at the end. In refactoring its often impossible to cross boundaries without going to an objectively or subjectively worse state of the code.

Remove state construction out of Screen Constructors

I need to walk through each screen just as I have and build it out to be compatible with IResolver (maybe down the line, IQuery) , I need to remove any state data out of the constructor into a separate Initialize method that is passed in a Request Object. Then move those parameters into that request object.

I then need to move the construction of that class out of arbitrary consumer classes within the application and replace those with calling that IQuery and building that Request Object.

Then I need to create that XScreenResolver and build that to construct the XScreen and pass in the Request Screen.

  • GameScreen
  • StatsScreen
  • BoardSelectionScreen
  • CharacterSelectionScreen
  • LobbyScreen
  • CreditsScreen
  • FirstTimeScreen
  • HighScoreScreen
  • LogoScreen
  • MainMenuScreen
  • ProfileEditScreen
  • SurvivalCharacterSelectionScreen
  • SurvivalGameScreen

Detailed Notes

  • So I need the constructor to have no logic at all. (runs at launch)
  • I need the initialize method to pull in a request for putting in data or objects. (runs from resolver, from other logic screen)
  • I need the IniailizeState method to run the logic necessary to get the screen to a neutral starting state. (ran from ScreenManager) (THIS WILL BE REMOVED LATER)

Afterwards

I will be removing the InitializeState() method, and replacing it with the Initialize(IRequest request) method. Then it will first set the state objects based on whats passed into the request, and then it will run the initialization logic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.