Coder Social home page Coder Social logo

nenuadrian / secret-republic-hacking-browser-game-v3 Goto Github PK

View Code? Open in Web Editor NEW
25.0 5.0 20.0 80.24 MB

Secret Republic Hacker simulation ORPG - browser based PHP AND MySQL, text & image futuristic open-source game

Home Page: https://secretrepublic-v3.nenuadrian.com

PHP 44.81% CSS 8.27% JavaScript 6.66% Smarty 40.26% Shell 0.01%
php php-game browser-game php-blog php-forum game mmorpg open-source-game orpg php-browser-game

secret-republic-hacking-browser-game-v3's Introduction

Secret Republic - Browser Based futuristic PHP hacker game - V3

Cover

Creative Commons License

Live Demo: https://secretrepublic-v3.nenuadrian.com

Hosted on recommended provider DreamHost.

Audio Trailer: https://www.youtube.com/watch?v=6thfiGb-b7c

Read about the journey of this project in this Medium article.

Table of contents

  1. Overview

  2. Main features

  3. SecretAlpha v4

  4. Simple Setup

    • Semi-manual setup
    • Manual setup
    • Useful tips
  5. Screenshots

  6. Learning the platform

  7. Framework details

    • ~MVC Architecture
    • Routing
    • Creating new missions
    • Adding skills, ablitites or tutorial steps
    • New pages with minimal functionality
  8. Tests

  9. Sponsors and contributors

  10. License

Overview

Built from the ground up by a fairely inexperienced software developer at the time.

It's been through years of development with this being its 3rd full do-over.

A PHP & MySQL based browser based, mobile compatible, role playing game. The theme is post-apocalyptic futuristic hacking.

There are many features, enough for this to be a stand-alone game, ranging from guilds/organizations, to party system, single and multi-player missions, servers players can build and hack, wars between zones players can join and even be the president of, forums and blogs. And that is not even all.

Documentation is minimal and is being built as we go.

I am trying to actively contribute and solve raised issues, so please feel free to raise one, and more so please contribute with whatever you can!

Main-Features

Feature Description
Futuristic UI Bootstrap made. Custom build. Generally responsive.
Abilities Upgradeable, enhance player stats, take time to level up. Controlled by constants/abilities.php.
Skills Point based, where points can be earned by levelling up. Enhance player stats. Controlled by constants/skills.php.
Tutorial Multiple guiding steps, with rewards at each step. Players can skip steps. Quite advanced and flexible, easy to extend. Controlled by constants/tutorial.php.
Rewards The reward system allows the game to give players multiple rewards (stat points, money, etc.) in a packaged way (as a reward with multiple items). The players can then accept the reward at which point it will be applied, and they can review history of rewards.
Audio AI Audio cues have been pre-recorded for use in the game. They can be muted and play when specific actions take place.
Admin Panel Advanced administration interface, with user management, mission design screens, and more.
Mission Designer Part of the admin panel, allows for advanced design of missions, with multiple objective and sub-objectives, and custom BBCodes.
Missions Enhanced UNIX terminal-like missions, which can be leveraged across the game, including for guild daily missions, the hackdown competition, training, or story-drive missions. Easy to extend and re-use.
Servers Can build multiple, each with their own upgradable hardware (motherboard, ram, hdd, power source). And software which can be run and uses resources.
Forums Feature-rich integrated forum system. With the ability to create internal forums specific to guilds in-game.
Organizations Guild-like system. Owned by players. Can create multiple membership groups, there are missions specific for organizations and wars can be declared between them. They can have their own internal forums.
Messaging Ability for players to chat, in a thread based system.
Blogs Feature-rich player blog system.
Hackdown Mission based cron.php scheduled competition.
Friends Friend system for players.
The Grid Every players gets a starting node and can initialize/conquer other empty nodes or from other players. The world is split in multiple zones, which are divided into clusters with multiple nodes in each cluster. Damage and spy attacks can be triggered between nodes. There's an attempt at a simulator for attacks
Attacks Players can launch attacks using their nodes on other players.
Data Points Mined via cron.php and use resources and software.
Alpha Coins Premium currency, with custom in-game shop, coupons and more.
Rankings Generated via cron.php, they are at player and organization granularity.
Job Give players a mission designed in the mission designer to complete depending on level, for rewards.
Zones Splits the world, 6 zones, each with many clusters, each with a couple of nodes. Players can take over nodes, and they start with a random node.
Train Captcha and some other mini-games designed for players to complete daily for rewards.

SecretAlpha-V4

V4 is newer, more responsive made with mobile-first in mind, but with way less features.

https://github.com/nenuadrian/Secret-Republic-Hacker-Game-ORPBG-Alpha

Simple-Setup

Require steps

You need a webserver (e.g. MAMP/WAMP/XAMPP) able to run PHP (tested with 7.3) and an MySQL database (LAMP stack).

  1. Install composer (the PHP dependency management system - brew install composer for MacOS if you have brew) and run composer install

  2. Create an empty Database in MySQL. For MAMP, you would go to http://localhost:8888/phpMyAdmin5

Semi-manual setup

Screenshot

Visit http://localhost/public_html/setup - this may be different if you are using another port or directory structure, e.g. http://localhost:8888/sr/public_html/setup and follow the setup process

Manual setup

  1. Import includes/install/DB.sql to the database you have created.

  2. Rename includes/database_info.php.template to includes/database_info.php and update the details within accordingly.

  3. The game should be up and running. Go and create and account manually.

  4. Go to the user_credentials table and update the entry for your user, setting the column group_id to be 1. This will make your account a full administrator. Log out and log back in.

Useful tips

You may need to manually execute the following SQL if you see a GROUP BY related error on the missions page:

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

Cron jobs

https://en.wikipedia.org/wiki/Cron

These ensure processes run as required, that hacking competitions start, that attack reports are generated and that time based resources are given to players.

Set these up to run periodically as the parameters suggest. The resources one should run every minute.

Name Description URL Proposed schedule
Attacks localhost/cron/key1/MDMwN2Q3OGRiYmM4Y2RkOWZjNTBmMzA4MzViZDZiNjQ=/attacks/true Every minute
Hourly localhost/cron/key1/MDMwN2Q3OGRiYmM4Y2RkOWZjNTBmMzA4MzViZDZiNjQ=/hourly/true Hourly
Daily localhost/cron/key1/MDMwN2Q3OGRiYmM4Y2RkOWZjNTBmMzA4MzViZDZiNjQ=/daily/true Daily
Hackdown localhost/cron/key1/MDMwN2Q3OGRiYmM4Y2RkOWZjNTBmMzA4MzViZDZiNjQ=/hackdown/true Daily
Rankings localhost/cron/key1/MDMwN2Q3OGRiYmM4Y2RkOWZjNTBmMzA4MzViZDZiNjQ/rankings/true Hourly

Example:

*/2 * * * * wget -O - http://localhost/cron/key1/MDMwN2Q3OGRiYmM4Y2RkOWZjNTBmMzA4MzViZDZiNjQ=/attacks/true >/dev/null 2>&1

Or use the control panel your host may provide.

Screenshots

main page

Screenshot

player dashboard

Screenshot

mission

Screenshot

organization

Screenshot

skills

Screenshot

the grid

Screenshot

mission designer

Screenshot

Screenshot

Screenshot

forum

Screenshot

Screenshot

Framework details

Sadly it was built from scratch, combining vanilla PHP, the Smarty template engine and a few libraries (composer.json). It makes use of Smarty caching.

Lint:

./includes/vendor/bin/phplint --exclude=vendor  --no-cache -v

~MVC Architecture

TBC

Routing

Is done based on the includes/modules folder. Adding a new module file say helloworld.php, will allow http://localhost/helloworld to work.

Something such as http://localhost/helloworld/hacker/test will pass the value test in $GET["hacker"].

Any variables http://localhost/helloworld/hi?attach=2 would be passed in $GET["attack"].

This all happens in public_html/index.php.

Creating new missions

Please refer to the the GUIDES folder in this repository. In contains instructions of what can be used within the Mission descriptions to benefit from dynamic IP generation between missions and other useful instructions, tips and tricks.

Adding skills, ablitites or tutorial steps

Check the includes/constants folder.

Tutorial steps

Modify includes/constants/tutorial.php.

When adding or modifying a step also check if you need to add or modify a tutorial_step_N_check function in the same file, where N is the number of the step you have added or modified within tutorial.php.

New pages with minimal functionality

This is as simple as create a .tpl file in templates/pages.

The easiest starting point is creating a copy of the template.tpl file which is within the same directory.

As soon as it is created, the page will be available at /pages/NAME e.g. http://localhost/pages/template.

Tests

./includes/vendor/phpunit/phpunit/phpunit tests

Sponsors and contributors

Contributors

If your pull request is merged, I will add your name here. Thank you for your contribution!

Sponsors

Thank you all who bought credits when the game was active. Your name will appear here if you financially contribute to the open-source project. Get in touch to do so.

License

This initial version was created by [Adrian Nenu] (https://github.com/nenuadrian)

Creative Commons License

Please link and contribute back to this repository if using the code or assets :)

secret-republic-hacking-browser-game-v3's People

Contributors

dependabot[bot] avatar nenuadrian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

secret-republic-hacking-browser-game-v3's Issues

Weird long URL

https://hrpg.lscult.com/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/4/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/4/page/5/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/4/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/4/page/5/page/1/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/4/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/4/page/5/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/4/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/page/2/page/alpha_coins/history/alpha_coins/history/archive/page/alpha_coins/history/alpha_coins/history/archive/

Also it seems the history is not shown properly :))
There is nothing there
Steps to replicate: Go to base url, click on the page numbers. Slowly it will cause it to happen.

Nginx installation

Hi sounds good that you are back.
แ› love this game after long time แ› installed this game with little bugs.

Now how to set nginx rewrite rules?

And here is my error log.

2021/01/03 17:21:21 [error] 33041#0: *78405 open() "/www/wwwroot/secret-republic.ddnss.de/public_html/layout/css/Abel.woff2" failed (2: No such file or directory), client: 87.168.60.130, server: secret-republic.ddnss.de, request: "GET /layout/css/Abel.woff2 HTTP/2.0", host: "secret-republic.ddnss.de", referrer: "https://secret-republic.ddnss.de/layout/css/custom.css?t=fffff"
2021/01/03 17:21:24 [error] 33041#0: *78405 open() "/www/wwwroot/secret-republic.ddnss.de/public_html/register" failed (2: No such file or directory), client: 87.168.60.130, server: secret-republic.ddnss.de, request: "GET /register HTTP/2.0", host: "secret-republic.ddnss.de", referrer: "https://secret-republic.ddnss.de/"
2021/01/03 17:22:00 [error] 33281#0: *78408 open() "/www/wwwroot/secret-republic.ddnss.de/public_html/layout/css/Abel.woff2" failed (2: No such file or directory), client: 87.168.60.130, server: secret-republic.ddnss.de, request: "GET /layout/css/Abel.woff2 HTTP/2.0", host: "secret-republic.ddnss.de", referrer: "https://secret-republic.ddnss.de/layout/css/custom.css?t=fffff"
2021/01/03 17:22:04 [error] 33281#0: *78408 open() "/www/wwwroot/secret-republic.ddnss.de/public_html/register" failed (2: No such file or directory), client: 87.168.60.130, server: secret-republic.ddnss.de, request: "GET /register HTTP/2.0", host: "secret-republic.ddnss.de", referrer: "https://secret-republic.ddnss.de/"
2021/01/03 19:06:37 [error] 62196#0: *78423 open() "/www/wwwroot/secret-republic.ddnss.de/public_html/register" failed (2: No such file or directory), client: 87.168.60.130, server: secret-republic.ddnss.de, request: "GET /register HTTP/2.0", host: "secret-republic.ddnss.de", referrer: "https://secret-republic.ddnss.de/"

Fatal error on your website.

Fatal error: Uncaught Error: Class 'Server' not found in /home/dh_mtb3c6/includes/modules/servers/servers.php:47 Stack trace: #0 /home/dh_mtb3c6/secretrepublic-v3.nenuadrian.com/index.php(52): require() #1 {main} thrown in /home/dh_mtb3c6/includes/modules/servers/servers.php on line 47

array (
'errline' => 47,
'errfile' => '/home/dh_mtb3c6/includes/modules/servers/servers.php',
'page' => 'servers/servers',
'url' => 'https://secretrepublic-v3.nenuadrian.com/servers/build/hell/',
'errno' => 1,
'errstr' => 'Uncaught Error: Class 'Server' not found in /home/dh_mtb3c6/includes/modules/servers/servers.php:47
Stack trace:
#0 /home/dh_mtb3c6/secretrepublic-v3.nenuadrian.com/index.php(52): require()
#1 {main}
thrown',
'user_id' => 18151,
'backtrace' => '0',
)

This is just a suggestion issue.

As a feature suggestion, it needs an admin option to create a page which that page will be either displayed as an option in the menu, either on footer, either in header. And in that page we can create stuff like maybe a tos page, rules, credits page, and other stuff like that
Basically a pages creator.

Also as another suggestion, an announcement system. It would be helpful. I am just having this here for fun rn, but who knows? Maybe someone will find that sub-link and start playing it, and maybe they will call more ppl in. Besides that, i am having my friends have fun with this soon. We'll just be shitting around, because this is what we do.

Page errors

Those pages are containing errors.

Links:
https://hrpg.lscult.com/admin/view/tests < some kind of database error.

https://hrpg.lscult.com/admin/view/attacks < error, database i think.

https://hrpg.lscult.com/admin/view/errors < ironically enough errors show a database error :))

https://hrpg.lscult.com/profile <weird overlays?

https://hrpg.lscult.com/forum <forums with "n" threads. Where threads?

https://hrpg.lscult.com/admin/view/shop < 404

https://hrpg.lscult.com/admin/view/attacks/hacker/18150 < error with db, might be related to second link.

https://hrpg.lscult.com/admin/view/attacks/hacker/18150/logs/show <same as above

https://hrpg.lscult.com/support < where captcha?

https://hrpg.lscult.com/alpha_coins < smol error.

https://hrpg.lscult.com/admin/view/manageQuest/qid/82 < weirdly formatted on mobile.

https://hrpg.lscult.com/social < 404

https://hrpg.lscult.com/faq/?p=14 <404

https://hrpg.lscult.com/skills/// < skills not increasing when spending points.

database_info.php

I receive this error on php 7.1.7:

Warning: require(/includes/database_info.php): failed to open stream: No such file or directory in C:\MAMP\includes\class\cardinal.php on line 29

Fatal error: require(): Failed opening required '/includes/database_info.php' (include_path='.;C:\php\pear') in C:\MAMP\includes\class\cardinal.php on line 29

When I use an older php version (e.g. 5.6.0) it seems to work, but I receive different errors instead. The file is there, at the correct location, yet this part doesn't seem to work. The error on 5.6.0 is:

Fatal error: Uncaught --> Smarty: Unable to load template 'file:home/main_stats.tpl' <-- thrown in C:\MAMP\includes\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php on line 185

Fatal error: Uncaught --> Smarty: Unable to load template 'file:pages/error.tpl' <-- thrown in C:\MAMP\includes\vendor\smarty\smarty\libs\sysplugins\smarty_internal_template.php on line 185

Registration Error

Fatal error: Call to a member function isSMTP() on null in /volume1/web/game/hacking/includes/class/alpha.class.php on line 50

So im switching from nginx to apache2 sasm problem registration wont work.

Query_time: 18.809801 Lock_time: 0.000054 Rows_sent: 1 Rows_examined: 14948935

Rows_affected: 0 Bytes_sent: 97

use xyz_;
SET timestamp=1610783397;
select cluster from zone_grid_clusters zgc where zgc.zone_id = 1 and 10 > (select count(*) from zone_grid_cluster_nodes zgcn where zgcn.cluster = zgc.cluster and zgcn.zone_id = 1 and zgcn.user_id is not null limit 1) order by zgc.cluster asc limit 1;

i cant add hdd to my server

hello
when i buy ram and hdd and other parts for the server i cant connect the hdd and server together .. the slot is empty always
image

FAQ Issue

The FAQ site dont work.

When i click on Text design its not working.

Bug vendor

Hello,
I tried to install it but here is the problem
Sincerely
`
Warning: require_once(../includes/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/Jeux/Secret-Republic-V3/index.php on line 2

Fatal error: require_once(): Failed opening required '../includes/vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/html/Jeux/Secret-Republic-V3/index.php on line 2`

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.