GithubHelp home page GithubHelp logo

game's Introduction

Puzzle-based / survival mobile game

#How to set up this project

Project is shipped without third-party libraries, frameworks and datapack. That actually means developer has to complete some setup after project checkout to get software work.

Please follow these steps to build and run game on your machine:

  1. clone project to your local directroy, let's call it "game"
  2. install dependecies (please see Dependencies section for details)
  3. accroding to platfrom you use select correspnding path in "game". For example to build project for IOS device go to "proj.ios_mac" folder
  4. follow Cocos2D instructions to setup project

#Dependencies

  1. Cocos2d-x (http://www.cocos2d-x.org) version 3.9 (https://github.com/cocos2d/cocos2d-x/tree/V3.9)
  2. Download Cocos2d of specified version and copy it to your "game" folder as "cocos2d" folder
  3. Datapack is included as sub-module. Please read GIT manual how to checkout porject with sub-modules

#How to start work with repo

  1. Fork repository to your own github account
  2. Clone project to your local dir git clone https://github.com//game.git
  3. Init resource submodule git submodule init
  4. Update resources git submodule update

#How to sync with main repo

  1. For sync with main repository, use command add upstream (you need to do this step only once) git remote add upstream https://github.com/TopSecretGames/game.git
  2. Fetch all remotes git fetch -all
  3. Checkout to your local master git checkout master
  4. Merge remote changes with your local branch git merge upstream/master

#Code formatting:

We respect netty codding and that's why we use Google-code style. To keep code well-formated we preffer to util clang-format 3.8.0

#Change requests (CR):

We use CR's to:

  • add/mod/remove design-affecting components, that is those components which depend on, or dependent by other system components
  • add/mod/remove any public contracts

It's strictly prohibited to make any changes on mentioned above points without corresponding CR.

#Tests:

We are TDD adepts. We deny untested, fragile code. Please read about TDD carefully before you start.

#Forks:

Push to master directly is not allowed. We preffer forks. To make a contribution u have to fork firstly, make a change, push it to your fork, create pull request and wait for approve and merge. If your PR is conflicting with existing code or just can't be merge for some any other reason it will be rejected. We will be really happy, if you put issue numbers (via github hashtag) to yours commit messages.

game's People

Contributors

apocarteres avatar asabelnikova avatar stavenko avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

game's Issues

CR: MapEventListener is required

Change request objection:
Having worked on MoveController i require subscribing ability to 'map load' event.

Goal:

  1. Add 'MapController' which is responsible for map-related logic.
  2. Add 'MapEventListener' interface with 'onMapLoad' method with reference / pointer to loaded map as argument.
  3. Add method 'registerListener' to 'MapEventListener' with argument as pointer to 'MapEventListener' to allow controller users provide pointer to their listener implementation.

Continuous integration setup

We need to setup Jenkins or similar CI to build project automatically every time code pushed.
The major point is - run tests automatically and let everyone know if code is broken.

Add menu select character after "Start game" button click

Objective:
In our game, user will be selecting one of 3(or more) charater to play with.

Goal:

  • Lobby controller must show "select character screen" after "Start game" button click
  • For now, we will show three characters and two of them will be blocked
  • Clicking on not blocking character should trigger lobby event listeners with start game event

CR: lookAt() method is required in MapController

Objection:
MapController doesn't provide any method to arbitrary scroll the map.

Goal:
1.Add method lookAt(Vec2) to MapController
2. When method is invoked with some Vec2 value then game map should be scrolled to that Vec2 point to be exactly at center of the screen.

Related issue is #21

CR: Namespaces are needed

Objection:
In terms of improving code quality and readability we need put all modules into corresponding namespaces.

Goal:

  1. Create team-wide name space. Let's say: "tsg" (top secret games)
  2. Move GameController and related modules to the namespace "tsg/game"
  3. Move MapController and related modules to the namespace "tsg/game/map"
  4. Move MoveController and related modules to the namespace "tsg/game/move"

Example:

namespace tsg {
   namespace game {
      class T ...
   }
}

CR: remove Layer inheritance from GameController

I think, that GameController should not inherit cocos2d::Layer. It should just links all controllers with each other.

Goal:

  • remove Layer inheritance
  • create initGame() method, that will be called from AppDelegate.cpp

CR: Track internal game timing within MapController

Objection:
We need to track internal game time for:

  • day/night cycle control
  • time-dependent events (traps, doors state update)

Goal:

  • propose and implement changes within MapController / IMapEventListener classes to allow other components react on in-game events.

Roughly speaking, MapController ought to track game time such that 1h of real time is approximatelly equal to 1day of game time and 20m of real time is about a game night.

It draws game time on small piece of the screen and notifies listeners when time changes, for example: using IMapEventListener it notifies client classes when follow events happen:

  • day/night changed
  • game time is up (basically it's game over)
  • use corresponding sound/visual effect depending on time of the day

CR: AI support is required

Objection:
We need abstraction to control AI.

AI responsibilitues are:

  • control of executing game scripts
  • control NPC behavior

Goal:
Design and implement(optioanly) the functionality to make it happen

CR: Need instance to GameController class

Objection:
Viewport positioning requires calls of functions:

Vec2 cocos2d::Lawer::getPosition() & cocos2d::Lawer::setPosition(Vec2)

Goal:
Achieve access to tsg::game::GameController within tsg::map::MapController.
This could be done with:

  • Call Of Constructor of MapController with pointer to GameController Instance;
  • Call of onInit this pointer to instance of GameController.

TMX -> World coordinates projection

Seems that TMX and Cocos World coordinates distinct, that is if i do create some object on ObjectGroup in TiledD and move it to point 100, 100 it will be loaded in Cocos scene with completely different coordinates.

We need a function in move controller which can perform translation tmx -> cocos properly

CR: LobbyController is required

Objection:
There is no entry point to the game. When app is started we can see only black screen. We need to introduce the LobbyController which is responsible to handle app start event and let user click on "Start" button to essentially start the game.

Goal:

  1. Add class LobbyController
  2. Let LobbyController extend IGameEventListener
  3. Implement IGameEventListener#onInit() such that:
    a) show big clickable button with "Start" label on the screen's center
    b) on user click - hide the button and call MapController#loadMap("data/map1.tmx")

Please refer to "Zzzz" document for more details

NOTE: Don't forget about TDD and CR-based development principle to avoid leaks in design

CR: GameEventListener is required

Objection:
GameController is responsible for instantiating and managing game components and it has to be able to notify game-event subscribers.

Goal:

  1. Instantiate all existing controllers in GameController::init().
  2. Add GameEventListener interface
  3. Add method 'onInit' to the GameEventListener
  4. Add method "registerListener" to GameController with argument as pointer to instance of GameEventListener
  5. GameController must notify all registered listeners with 'onInit' event when before exit GameController::init() method.

Cocos assert failed

After recent checkout i noticed that Cocos complains about kinda inconsistency when i run tests:

cocos2d: fullPathForFilename: No file found at data/map1.tmx. Possible missing file.
Assert failed: Argument must be non-nil
Assertion failed: (child != nullptr), function addChild, file /Users/sandro/work/repo/topsecretgames/game/src/cocos2d/cocos/2d/CCNode.cpp, line 981.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
run-tests is a Catch v1.2.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
Tests that game event listeners got notified well
-------------------------------------------------------------------------------
GameControllerTest.cpp:12
...............................................................................

GameControllerTest.cpp:12: FAILED:
due to a fatal error condition:
  SIGABRT - Abort (abnormal termination) signal

===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed

CR: Create inertial touch map scrolling

Objection:
Implement cute scrolling, when speed of scroll slowly decreses after user untouched.

Goal.

  1. remember speed of last move
  2. update speed of scroll and screen position every update event.
  3. Make slow down customizeble via method setScrollFriction. Friction make it sooner to stop scrolling

MoveController: Display player's character sprite

After #21 is done it would be great to display player's character sprite on scene.

Some requirements:

  1. sprite should be always attached to playerPosition defined in MoveController.
  2. sprite should be added to scene as animated sprite sheet provided by Cocos.
  3. sprite config should be loaded from "wildmagic sprite generator" or as any other sprite animation spec.

Caveats:
Sprite should be rendered with taking care of zIndexing. For now just put sprite on new layer let's call it "player" and adjust zIndexing such that sprite is always on front of 'background' and with the same zIndex as 'environment' layers.

Implement obstacles support

MoveController should take care about correct moving objects around. One of correctness conditions is that characters are not allowed go through trees, buildings and other rigid bodies.

CR Create and implement Effects controller

Create class, that takes responsiblity over map effects.
Class must be available to have connection to mainloop. It must not know about any other controller and maintain only ability to add and remove in time effects, that we don't aware anymore.

Each effect must have IBaseEffect parent with overloaded:

  1. std::string getName();
  2. void update(float);
  3. bool isFinished();

This gives enough for each inherited child to maintain it's lifetime and make it able to produce effect on scene.

CR: Fog of the war is required

Objection:
Fog of War - hidden map area which can be revealed during player movement. Map must provide API to control FOW.

Goal:
Implement FOW with these rules in mind:

  • FOW covers whole map by default
  • FOW is being revealed in point occupied by player and some radius
  • Once FOW has been revealed it doesn't appear again

Add API methods to Map controller:

  • revealFow(Vec2 point, int radius)

NOTE: As example of similar FOW please see Heroes3 game series

CR Implement effect-full `lookAt`

Objection:
Transitions, after lookAt called are instant. This behavior disturbes ability to track global map position.
We need to make lookAt animated, and such, that we could choose type of transition effect.

For instance we will have:

struct effect{
  cocos2d::Vec2 from, to;
  double totalSeconds;
  double currentSecondsLeft;
  virtual void init(cocos2d::Vec2 from, cocos2d::Vec2 to);
  virtual cocos3d::Vec2 update(float timeDelta, MapController*);
}

This class could have subclasses, which implementing there own effects.

Also, we need to overload lookAt method, lookAt(cocos2d::Vec2, effect*);, which would be enough to play effect. within onUpdate method of IGameEventListener.

CR: remove Layer from MapController constructor

I think, that GameController should not inherit cocos2d::Layer. It should just links all controllers with each other.
So. I suggest that each controller (for now lobby and map) create there own scene and layers, when they need.

Goal:

  • remove cocos::Layer from MapController constructor
  • MapController create it's own scene and pass it to cocos2d::Director by startGame event

MoveController: Center map on player spawn after map loaded

  1. Catch up the onMapLoad event within MoveController
  2. Find spawn point on the map. It should be on "spawn point" layer with name "spawn1"
  3. Using MapController set up map position such that player spawn point ought to displayed at the center of screen.

CR: Dependency injection support for GameController

Objection:

  1. There is no way to replace implementation in tests
  2. There is no way to access operating instances of controllers

Goal
Implement two methods:

  1. injectControllers - used by default. Injects default controller setup
  2. injectControllers(MoveController *, MapController *) - used in other cases when some specific controller implementation is required (i.e for testing purposes)
  3. Add set of getter methods to access controller, such that: getXXXController

CR: Implement EarthQuake visual effect

Objection:
For some game scenario we need earth quake effect.

Goal:
Implement EarthQuakeEffect which follows rules:

  • screen is shaking for N seconds
  • user can't do any control during effect run

Add corresponding method to EffectContorller:

  • fireEarthQuakeEffect(int seconds)

CR: Water animating visual effect is required

Objection:
There are sprites which represent water on the map, but they do look pretty static and poor

Goal:
Design/propose and implement(optionally) functionality which can take about applying same OpenGL shader's on water sprite to animate them

Implement path finding algorithm

When MoveController receives command to move character to some point it should follow script below:

  1. take character which is going to move
  2. find the route from current player to target point

The goal of this task is to implement the route searching and draw some debug info on that, for example draw coins each path node

CR SoundController

Goal is to create controller, which could play sounds with loudness, dependent on distance of current position to sound source.

CR: Re-delegate scene management

Objection:
Currently, GameController takes care about scene managing, however it seems it would be better to delegate that responsibility to MapController and get it follow these rules:

Goal:

  1. MapController implements IGameEventListener and listens to onInit.
  2. When onInit happens MapController creates cocos2d::Scene and keeps reference to it.
  3. When loadMap is called on MapController it attaches scene to cocos Director

CR: Main loop is required

Objection:
There is no main loop now. We need it to sync all components.

Goal:

  1. Add main loop support to GameController and propagate it via IGameEventListener.
  2. Need to add method void onUpdate(float) to interface IGameEventListener.

This method should be called from void GameController::update(float).
this method allows to implement per-frame calculations.

This issue needed to implement #26.

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.