Coder Social home page Coder Social logo

poortjes's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

poortjes's Issues

Parent-Child relationships for game objects

Continuing the theme of object composition, being able to nest game objects into each other will be a very valuable tool. Nested (child) objects would move, rotate and scale along with the parent, and exist in the parent's local coordinate space. This implies the need for a transformation stack, where transforms can be pushed and popped so transformation logic can be expressed in local coordinate spaces. Luckily, processing already has this functionality built in:

applyMatrix()
popMatrix()
printMatrix()
pushMatrix()
resetMatrix()
rotate()
rotateX()
rotateY()
rotateZ()
scale()
shearX()
shearY()
translate()

(source: http://processing.org/reference/)

Hierarchical gameobject not only provide spatial organization, but also logical organization. A single gameobject with 20 components is a lot harder to comprehend and maintain than a gameobject with several child objects that each have several components on them. In this sense they work somewhat like layers in a graphics editing package.

Vectors

It would be a good idea to get a comprehensive 2d/3d vector class to represent aspects such as scale, position, force, speed, etc. These are all inherently related physical concepts, and having each in a separate class will make it really hard to calculate with them. The concept of vectors was essentially invented to represent these things in the most elegant way possible.

Processing has a ready-made PVector class that could be used. It has most of the essential methods like addition and multiplication, and also the dot and cross products which will doubtlessly be needed for calculating things like reflections.

Transform

The position, rotation and scale components for each gameobject could be represented in a single transformation matrix, speeding up a lot of operations. Even disregarding matrix representation, if both scale and position are represented as vector quantities, it might be handy grouping them under a single moniker, along with rotation.

An somewhat extreme example is Unity's Transform component: http://unity3d.com/support/documentation/ScriptReference/Transform.html

While much more complex than needed for Poortjes, it does demonstrate some useful concepts and conveniences.

Wall collision

Propose a design for wall collision and make sure that:

  • Collidables can never move through walls.
  • Prevent them from moving through the wall without any other side-effects in their movement to allow for smooth gameplay.

Custom ActionEvents

Instead of implementing listener to listen to ActionEvent it is much nicer (and type-safe) to listen to specific events like CollisionEvent, Gametick etc.

Animation

Propose a design for Game Object animation.

Transform scaling isn't influenced by rotation

When rotating an object with a height that is bigger than its width (and vice versa) the scaling isn't applied on the rotated model but always on the initial rotation (0 radians) of the model, resulting in the objects height beign applied to its width.

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.