Giter Site home page Giter Site logo

undergroundfootball's Introduction

== Underground Football

This is a project I created to experiment with. It's not a functional app by any stretch of the imagination. I used Bloodbowl (the board game) as a basis, and decided to try out a method of implementing functionality on models using autorequired modules.

The main meat of the project so far is in lib and models. The basic idea is that when you instantiate a Player class, it makes a database query to retrieve his skills, and requires modules based on those skills in. In speed testing, for instantiating a single class, it provides around a 100% slowdown (so taking twice as long to instantiate due to the requires and DB call).

This method is being used, because skills in Bloodbowl stack on top of each other, and interact with each other in very complicated ways, whereas the core game mechanics are very simple. Current clients all use a mass of conditional statements inside the code to dictate what skills are being used when, whereas my method should allow for better encapsulation and testing, as requiring the module in can then re-write the methods associated with that player. 

For example, a dodge requires a rand(6) + 1 + Agility (stat) roll to be greater than or equal to 6. The Dodge skill allows you to reroll the skill, hence, if a player has Dodge, the implementation of the method "dodge" is overridden with one that takes the roll, and rerolls it if it fails, while storing the fact that the skill cannot be used again this instantiation.

Obviously, when using a method like this, it will be important to ensure that speed of instantiation doesn't become a big issue. I don't think these should be, as at any one time, there are only a maximum of 22 players on the pitch, meaning that you will not be instantiating more than 22 models.

The entire lib/model structure works..so you can instantiate a player, add skills to him and he uses those skills appropriately. The next stage of the project is to knock up a UI for it, in order to test how those skills work, given as the experiment appears to have been successful.

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.