bpetetot / pongmmo

A MMO based on pong game's concepts
2 stars 0 forks source link

Code structure refactoring #54

Open bpetetot opened 7 years ago

bpetetot commented 7 years ago
global/            # global configuration and constants
  config/
  constants/

modules/          # all business modules
  ui-common/      # common ui components
  player/
    lobby/
    ingame/
    events.js
    physics.js
    graphics.js
  score/
    ingame/
    gameover/
    events.js
    physics.js
    graphics.js  
  entity.js        # entity prototype
  db.js            # db init
  graphics.js      # graphics renderer prototype
  physics.js       # physics engine prototype

states/
  state.js         # phase/state prototype
  lobby/           # example of 'lobby' phase/state implementation
    events.js      # socketio events used during the phase/state 
    physics.js     # physic engine used in 'lobby'
    graphics.js    # graphics of 'lobby'
  ingame/
    events.js      # socketio events used during the phase/state 
    physics.js     # physic engine used in 'lobby'
    graphics.js    # graphics of 'lobby'    
utils/             # utilities

client.js          # client phasing loop
server.js          # server initialization
fabienjuif commented 7 years ago

state.js

fabienjuif commented 7 years ago

Entity Each entity (by instance player/lobby) has theses files :

The abstract of entity.js will glue all parts. If there is a need of common implementation, by instance player/lobby has sames physics that player/game :

Player/lobby/physics.js

export default from '../game/physics.js'