Skip to content

Commit

Permalink
Initial commit with partial game code
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown authored and Unknown committed Mar 22, 2018
1 parent 2978a72 commit cfee6d0
Show file tree
Hide file tree
Showing 501 changed files with 42,665 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .env.dist
@@ -0,0 +1,24 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=488c94bcc9246b36f0c8fb5440805084
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@

###> symfony/framework-bundle ###
.env
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
75 changes: 75 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,75 @@
# Ultimate Warfare Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [admin@frankprojects.com](mailto:admin@frankprojects.com). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

142 changes: 142 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,142 @@
# Contributing to Ultimate Warfare

Thank you for considering contributing to Ultimate Warfare. This document contains some guidelines to explain the contributing process and hopefully answer some common questions.

Do note that almost nothing is set in stone. Feel free to even contribute to this document!


#### Table of Contents

- [Before getting started](#before-getting-started)
- [Prerequisites](#prerequisites)
- [Vision](#vision)
- [How can I contribute?](#how-can-i-contribute)
- [Joining the community](#joining-the-community)
- [Participating in the beta](#participating-in-the-beta)
- [Reporting bugs](#reporting-bugs)
- [Collaborating with development](#collaborating-with-development)
- [Local development](#local-development)
- [Setting up](#setting-up)
- [Directory structure](#directory-structure)
- [How to run tests](#how-to-run-tests)
- [How to update](#how-to-update)
- [Style guide and standards](#style-guide-and-standards)


## Before getting started

### Prerequisites

- For code contributions, make sure you have a [GitHub account](https://github.com/signup/free)
- Make sure you read, understand and agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

Collaboration and contributing will be primarily done through GitHub.


### Vision

XXX TODO

## How can I contribute?

### Joining the community

XXX TODO

### Participating in the beta

XXX TODO

### Reporting bugs

You can report bugs to the [issue tracker](https://github.com/FrankProjects/UltimateWarfare/issues).

Please search the issue tracker first if the particular bug already has an open issue. If it does, add your message to the existing issue instead of opening a new issue.

If a closed or resolved issue exists for your particular bug, reopen it. If in doubt, just open a new issue.


### Collaborating with development

First, make sure the changes you're going to do adhere to the [vision of UltimateWarfare](#vision).

Fork the repository on GitHub, make a new branch off develop and start from there. Separate features isolated from each other should go in their own branch. Branch names should preferably adhere to the Git Flow workflow using a `feature/FeatureName` or `hotfix/HotfixName` notation.

When making changes, add or modify relevant tests with your changes if it involves game mechanic-related code.

Once you're satisfied with your modifications, send me a pull request. I will review it, edit it as needed and merge it with the develop branch.


## Local development

### Setting up

##### Assumptions:

- You have [PHP](http://www.php.net/) 7.1 or higher installed and in your path.
- You have [Composer](https://getcomposer.org/) installed and in your path.
- You have a basic understanding of the [Symfony framework](https://symfony.com/).


##### Languages, frameworks, libraries and tools

Ultimate Warfare is built on the Symfony 4 framework, using PHP 7.1 as language and twig as templating language.

I'm developing Ultimate Warfare in PhpStorm myself, but you're of course free to use whatever you see fit.


##### Cloning the repository:

```bash
$ git pull https://github.com/FrankProjects/UltimateWarfare.git UltimateWarfare
$ cd UltimateWarfare
```


##### Setup

```bash
# Composer stuff
$ composer self-update
$ composer install --prefer-source

```

TODO: Add database seeds


### Directory structure

XXX TODO


### How to run tests

You can run tests with:

```bash
$ vendor/bin/phpunit
```

There are two test suites, named as follows:

- Feature Tests
- Unit Tests

Feature tests can be seen as user stories if you're familiar with Agile.

Unit test classes are tests that generally correspond to a single source class to test the implementation of the business logic. Unit tests methods **should** correspond to a matching source class method under test using a `testNameOfMethodUnderTest` naming convention.

Consult [PHPUnit's manual](https://phpunit.de/manual/5.7/en/index.html) for running specific test suites or individual files.


### How to update

For updating your local development environment, do a `git pull`, optionally followed by a `composer install`, depending on which files have changed.


### Style guide and standards

PHP code should be in PSR2-style with a few additional rules. See [.styleci.yml](https://github.com/FrankProjects/UltimateWarfare/blob/master/.styleci.yml) for the defined [preset](https://styleci.readme.io/docs/presets#section-psr2) and [additional rules](https://styleci.readme.io/docs/fixers).

Please add relevant unit tests or feature tests if possible.
73 changes: 71 additions & 2 deletions README.md
@@ -1,2 +1,71 @@
# UltimateWarfare
Ultimate Warfare is an online multiplayer browser based strategy game
Ultimate Warfare
================

*Note: Ultimate Warfare is still in development. Some features of the game have not been implemented yet.*


## Introduction

Ultimate Warfare is a free and open-source online multiplayer browser based strategy game where you compete with thousands of others for world domination.

Grow powerful and nuke your enemies! Send sniper teams or special forces demolitions teams to wreak havoc! Watch your enemy with spy satellites and send a squadron of stealth bombers to knock out his key infrastructure! AND MUCH MORE!

Ultimate Warfare is written in PHP on the [Symfony 4](https://symfony.com) framework.

## History

I'm Frank Schreuder, a Software Engineer, Web and Game Developer and enjoy working on my own projects.

I started programming at around 2005. Ultimate Warfare was one of my first projects. I started working on Ultimate Warfare after years of playing [Imperial Conflict](https://imperialconflict.com). The joy of playing a game declined over time and the joy of finding out how a game works and how it's developed, started to gain my interest.

After years of working on Ultimate Warfare I think it's time to share it with everybody. I don't have much time to work on it and I care about learning and sharing.

Over the years I saw a decrease in browser based strategy games. With open-sourcing this game code I hope to inspire other people to build awesome games like this.

Most strategy games are 'tick' based, as so was the first version of Ultimate Warfare. Later the game engine of the game was rewritten to make it real time. I used this game as learning project, as I was looking for more technical challenges I decided to make it real time. This adds more complexity to the code to ensure a consistent game state.

The old game code dates back to 2005-2012 and contains a lot of legacy PHP, for example:
- Not object oriented
- Html in PHP
- PHP 5

In 2017 I started porting the game code to Symfony 4 and twig templates. To learn the symfony framework but also with the idea in mind to publish to game code later.
While porting the game code to symfony, I used more modern development techniques.
The new code base is PHP 7.1 compatible with PHP strict typ hinting.


## Missing features

Missing features compared to old game code:
- Avatar system
- Federations
- Chat
- Forum
- Bank
- News
- Sending aid
- Market system
- Moderator panel
- Missions
- Change password in account settings
- Password reset
- Profile
- Battle system
- Special operations
- Surrender


## Contributing

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.


## Links

- [Old game](https://ultimate-warfare.com)
- [Issue tracker](https://github.com/FrankProjects/UltimateWarfare/issues)


## License

Ultimate Warfare is open-sourced software licensed under the [MIT License](https://opensource.org/licenses/MIT).
39 changes: 39 additions & 0 deletions bin/console
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php

use FrankProjects\UltimateWarfare\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;

set_time_limit(0);

require __DIR__.'/../vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev');
$debug = ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption(['--no-debug', '']);

if ($debug) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($env, $debug);
$application = new Application($kernel);
$application->run($input);

0 comments on commit cfee6d0

Please sign in to comment.