Code Monkey home page Code Monkey logo

pdb's Introduction

PDB

This is a small web application to create a text game for browser. The goal of the game is to create something similar to Ogame, but with your own character and some good rpg elements to it.

How to Help

If you want to help, here's what you can do to contribute to the project :

  • Download and install dotnet 6
  • Clone or fork the project.
  • Go check the issue with the label help-wanted and start working.

You can always open an issue and ask question or give feedback if you want :).

What We Need

There is a great need to help with the layout and the aesthetics of the client (see the pdb-frontend project for more information).

There are also a lot of small easy things to do. Come chat with me in this chatroom if you have any idea or just create an issue here!

Running Database + PDB in Docker

docker run --name pdb-db -d -p 5432:5432 -e POSTGRES_USER=pdb -e POSTGRES_PASSWORD=password1 postgres
docker build . -t pdb
docker run --name pdb-app  -p 3000:3000 pdb

How to Setup the Database

If you didn't use the docker instance, you will need a postgresql installation either on your local machine or elsewhere. For Windows, you can follow this installation page and for Linux you can follow this page of instructions.

Once the installation is complete, you need to create a new db and a new user like so :

CREATE DATABASE pdb;
CREATE USER pdb WITH ENCRYPTED PASSWORD 'password1';
GRANT ALL PRIVILEGES ON DATABASE pdb TO pdb;

This will create a user and database to connect to. Those information can be changed in the appsettings.json file, if you changed any of the provided one :

"ConnectionStrings": {
    "DefaultConnection": "host=localhost;database=pdb;user id=pdb;password=password1;"
}

You need to run all the migrations to make sure you're database is up to date.

How to Run the Application

This is really easy, all you have to do is run the correct command :

dotnet run

If everything is setup correctly, the server should start up :).

There is 4 users account included in the seed data testtest, testtest2, testtest3 and testtest4 (all the passsword are testtest).

pdb's People

Contributors

marcandregirard avatar thomas-lepage avatar mrheaumeproulx avatar olamarche avatar dependabot-preview[bot] avatar thyrgle avatar waffle-iron avatar zomis avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

James Cloos avatar Viviane Orge avatar  avatar Thomas Lepage avatar  avatar

pdb's Issues

Player name in menu

When a new user create an account, he doesn't have a player. This cause an error in the menu because we are displaying his player name. I replaced it temporary until we find a solution.

Share the documents about the project

We should create the external folder to share the documentation about the project (list of features, layout and etc). It could be any of the following share services (DropBox, ShareDrive, Google Drive etc.).

We could have a board with features to develop. I know Waffle IO with GitHub Issue, but there are others alternatives ( Pivotal Tracker, JIRA etc)

Add check for uniqueness of User for Player

I need to add a validation that the User does not already have a Player created at the creation of the player. There is a db check for uniqueness but I'm not sure there is one on the application side.

I need to test and add a validation if it does not work as expected.

Devise integration break the tests

There are not many tests but 3 remaining tests are broken at the moment. I've not be able to fix the remaining three and it's related to the Devise gem. I need to fix it and add some tests.

Create an Heroku project

We should have an Heroku instance that always run, where we could test more complicated scenario and have a "production" environment.

Use of bcrypt or alternative for hasing pwd?

Just incase anything ever happens, it might be a decent idea to use bcrypt to ensure the passwords have that extra layer of protection (as some people use the same pwd for all games or all internet stuff...wise or not of them)?

Do we need more treble ? No drop the BASS!

Let's have a first try at creating a base for the player. First, we need to let the player to decide where the base will be located (that means the base should not be the first thing the player can do)., so we don't have to limit the player on location (unless he wants a base on water that's dumb dumb). The creation of the base will need resources to build it. You would start with only only one building that would enable to do some new actions (produce resources/ train soldiers). The player could gather more resources to create new buildings: A first list of buildings we could have : garden(food), fields, dorms, house for peasants, forge/blacksmith, windmill and etc.

Do we limit the number of slots of buildings we can build on a base or do we make the buildings level-able, I don't a clue! We could have a way to simulate reality by having a way to deteriorate building over-time. You would need to repair or destroy and recreate buildings to keep production up.

  • Create the action of building the base
  • Create the concept of buildings
  • Create the concept of reparation
  • Create a view for the base

At one point, we could make the base cooler by making the base shareable. Imagine we have quests and you need to travel a lot, who will maintain orders and repair buildings? Why not your friends or clan members?

We could let people conquer or raid people's base in a pvp server, but for the moment let's create something simple.

Improve the readme

We should improve the readme to add a complete description, how to setup the project and everything.

EntitiesControllerTest#test_should_destroy_entity

``
$ rake test test/controllers

Finished in 19.715514s, 2.1810 runs/s, 3.6519 assertions/s.

  1. Error:
    EntitiesControllerTest#test_should_destroy_entity:
    ActiveRecord::InvalidForeignKey: ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: update or delete on table "entities" violates foreign key constraint "players_entity_id_fk" on table "players"
    Detail: Key (id)=(1) is still referenced from table "players".: DELETE FROM "entities" WHERE "entities"."id" = 1
    app/controllers/entities_controller.rb:61:in destroy' test/controllers/entities_controller_test.rb:45:in block in test_should_destroy_entity'
    test/controllers/entities_controller_test.rb:44:in `block in test_should_destroy_entity'

I need a hero!

Currently, we only create an entity that fill the role of the "hero" of the player. We need to extend that concept with something better and with more depth (let's face it it sucks at the moment). The hero will be one of the big concept of the game. I suggest we go the "classic" with regular stats like hp/energy/experience/reputation (we need a name for those stats). Those stats can change regularly base on actions of the player : ex. fighting another player can make you loose hp but gain reputation. There could be another set of stats like : strength, dexterity, vitality, intelligence, charisma and similar stats that would not change often/easily (We need a name for this too). Those stat would be define at the creation of the account/player and would only be change/modified by leveling or by feat of strength. Those stats (like strength) would be factors in influencing the chances of actions to succeed or give bonuses on a result of certain actions. ex: Strength could make you carry more resources etc).

  • Create the hero class (a sub-entity ?)
  • Create different stats (hp ...) and name it
  • Create different stats (strength ...) and name it
  • Prepare leveling for the character

Optionnal

  • Creation of an avatar ? (optional)
  • Prepare items

Non-Authorize actions

We need to add validation and add restrictions to the controller to limit what a non signed-in user can do. I don't have a preferred way to show to the user that he can't do/access a resource (this is left at the discretion of the person that will work on this issue).

What sould the game be about ?

We had a brief discussion but what should do for a game ? Something like Battlecorps, Ogame or somethign new ? How would it be played ? What will be the timeframe/universe ? A lot of questions and not a single answer for the moment! Bring some ideas!

How are we managing resources

How do we manage resources in the game? I came up with two options:
1: Resources are associated the the player.
2. Resources are associated to an entity (ex: a base)

Pros & Cons: Resources associated to player

  • Resources are managed at a single place
  • All sources of resources are calculated into a single global resources
  • Easier management of resources

Pros & Cons: Resources associated to entity

  • Multiple entities resources to manage (multiple bases with their set of resources)
  • More complex system
  • Opens up a more tactical approach to the game. (ex: if base1 doesn't have enough resources, send resources from base2 to base1)

What are your thoughts?
If you have other options, don't hesitate to tell us about it.

Edge of the grid

When reaching the bottom or the right of the grid, the grid shrink. Ex: if we're at the far right we only have a 1 x 10 grid and if we're a the bottom right corner, only a 1 x 1 grid.

Add Gmail OAuth

In the login page, allow the user to login with a gmail account with Devise OAuth

Issue with sign in from facebook

When I try to log in from Facebook, I got the following error message :

App Not Setup: This app is still in development mode, and you don't have access to it. Switch to a registered test user or ask an app admin for permissions.

This is not too useful at the moment, since I can't test the sign in option.

Grid crashing when not signed in

The grid is accessible and does not react well when you're not logged in. On heroku, it display : Something went wrong. It's probably due because there is no user object. I'm probably not checking if the user exist before checking for the player.

Secrets in devise.rb

The question about the .env file made me look at the devise.rb and made me realize we're leaking the secrets from the facebook authentication at the moment. We need to convert the app_id and the secret to two keys in the .env file.

Error when sign in

if I sign in with Facebook -> The parameter app_id is required
if I sign in with Google Auth -> Missing required parameter: client_id

Did I miss something with my db migration ?

Map Tiles terrain

Create terrain class for map tiles. Assign a colour for each terrain. We leave it at that for the moment.

Create integration with Travis

We should have some automation to run all the tests on each commit on the main and develop branch (at least). I think it's fairly easy to setup.

Access key of .env file

My question is how to access the secret_keys in .env file. For example, in database.yml, you can access it via rails syntax <%= KEY %>. But now I need to access them in devise.rb, a ruby file.

I know Marc you made some changes in the application to make it work on Heroku. I'd like to know what is the whole process to access a key in the actual application, like what is the gem used, when are they loaded etc.

I have a general idea, but details would be helpful as I don't want to break the actual code when making my changes

Rendering of the map

At the moment we only have a static way of displaying the map with the grid. We need to be able to "zoom" the map around the zone of the player.

Find a way to create to have an admin user for the first installation.

We have a little problem at the moment. The controller that edit user is authorize for modification for anyone. That permit anybody to promote them to the admin role. We need to find a way to either have a default account that would be an admin and use that account to modify the real admin of the site or we find an alternative solution (I don't have anything else at the moment).

Share your ideas!

CSS file not loading for the site.

The main css file is not loading correctly and I'm not sure what the issue is exactly. I suspect either a security issue in the WebSecurityConfig.configure() method or it's path issue in the webjar.

I tried a bit to move the file around and it did not work correctly.

Player show page

When viewing the info of a player, the hero show the reference (#Entity:0x007f97486a73b8) instead of the info of the hero.

Account creation

At the moment, there is only one account creation possible (Facebook) and once the account is created, you're automatically sign in and redirected to the home page (root).

We need to insert a new step to this, creating the player and a hero (if possible). The new step would be create the user registration with Devise and the redirect to the player creation page. We will need to handle the player creation, hero creation and you should be able to logout without finishing the creation. The next login should redirect you to the creation.

EntitiesControllerTest#test_should_destroy_entity

The issue is it appears the on_delete: :cascade is not firing during the tests.

Checks against the schema.rb & the PSQL db do not show the code being saved.

Attempts to add the code via rails migration have failed to show in either PSQL or schema.rb

Note: original ticket - #61

$ rake test test/controllers

Finished in 19.715514s, 2.1810 runs/s, 3.6519 assertions/s.

Error:
EntitiesControllerTest#test_should_destroy_entity:
ActiveRecord::InvalidForeignKey: ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: update or delete on table "entities" violates foreign key constraint "players_entity_id_fk" on table "players"
Detail: Key (id)=(1) is still referenced from table "players".: DELETE FROM "entities" WHERE "entities"."id" = 1
app/controllers/entities_controller.rb:61:in destroy' test/controllers/entities_controller_test.rb:45:inblock in test_should_destroy_entity'
test/controllers/entities_controller_test.rb:44:in `block in test_should_destroy_entity'

Authentification module

Add an authentification module to the project that will enable the creation of account. We should try to create account with other authentifacation system like Google, and maybe Facebook ? We should not use any non-pertinent personal information, only what we need for authentification. Everything else will be provided by the user willingly.

Change the way Terrain define the backgournd color

We should have css classes instead of the bgcolor attribue on elements.

That way when we move to tile images we could simply use thoses css classes.

Adding a terrain would simply means adding a new css classes with the same name as the terrain.

Unless we find a way to store in db and do it dynamically!

Create map for the application

At the moment, the seed.rb create a random map for the game. The result is sometime a bit too much random to make something interesting. We could design a map that would the default standard. At one point, we could have generator to make it easier on our hand to create map.

Menu revamping

The menu should be revisited since at the moment it's well what word could I use ? Hideous! We need to hide certain option to non signed-in users. Those options are the grid and every link that lead you to modify the data of the app.

Feedback in the grid view

We need to rework the UI of the gridview. We need to find a way to show the current tile where the hero of the user is and some way to show which tile you can move on. There should be a place to know what kind of action we can execute on a tile, this is not supported yet but we can still plan ahead.

Player edit function

For the moment there's no verification made when we are editing the player. A player could edit another player. A verification of the id should be implemented. Linked to issue #41

Player id in url

The id of the player should not be in the URL. Ex: localhost:3000/players/1/edit

Are we collecting money now ?

We need to implement the resources system. We could start by implementing some basic resources: wood, stone, (animal/food), iron, gold and copper. We will need a way to generate those resources for the player to collect them. I think we could tie the availability of the resource with terrain type (Forest generate wood, mountain stone etc.). We need a way for the player to gather them (that could be tie with the hero issue). We need a way to transport/store the resources on the player hero and maybe a way to store them (like a building in the base, when the issue is complete).

  • Define resource
  • generate resources
  • gathering
  • storing
  • For the moment, we could make everything replenish-able, maybe some day we could have a limit on resources (like stone is 5000/moutain).

** I leave a lot of freedom on the conception, do your best and to be afraid to test a new concept. We can always remake things later.

Fix one to many

For an unknown reason, the one to many relation between MapPoint and Entity does not work.

Update the versions of the project

Github is warning me about the security issues in the gem. It's been a long time so updating the version should be done before the next "release".

If it's me I can look up the gems problematic but almost all the gems should be updated. There's probably a service to check for versions too.

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.