StarMade Admin site

    Joined
    Aug 11, 2013
    Messages
    86
    Reaction score
    9
    Hi again,

    You maybe remember I've published the StarMade Log Panel project some days ago. Even before this project started I've been working on a bigger one. It's in a early stage, but I've wanted to share it with you to get some feedback before going one step further, let me explain myself.

    There are two real projects, a frontend developed with AngularJS that consumes the second one, a REST API developed in symfony. Now the REST API is nearly developed in a first iteration (more of this later), and the next step is to develop the frontend, which is now in a useless state, only an implementation of the official AngularJS tutorial.

    The idea is to ask you, specially server administrators, what functionalities you may find useful for an administration page that (for now) will only let you read the game data.

    For those who want to see code: https://github.com/thecko/starmadeadmin

    Abstract

    StarMade admin site is a web based tool to read and, in a future, manage your servers data. It allows you to list (and filter) several entities (ships, players, shops, etc.) and view the entity details.

    Note: I've started this project to learn Symfony and AngularJS. Expect some oddities due to the ignorance of the programmer.

    The REST API

    I'm using Symfony Rest Edition (SRE), but for the particularities of StarMade data, I've developed an abstract repository to get the server data.

    As you may know, StarMade stores the database entities in the server-database folder, a file per entity (with some exceptions like factions or the catalog). Reading directly the files for every query from the app will be slow, and may break something between the game. That's why I've developed a "cache" to store the game data, the Symfony app will query this cache and eventually will clear and regenerate it.

    The SRE demo bundle uses a file in the symfony cache folder to store the demo data. My first iteration of the project used the same approach and creates a file per entity type (f.e. a file for all the ships). It worked, but it's not the best approach if you want to filter it because it stores all the data in memory.

    Then I've decided to implement an abstract entity repository to let everyone to implement different database implementations. It's formed from two parts, the repository itself and an entity builder.

    The repository is an abstract class that defines the methods to get the data (findAll, findById, etc.) and implements some methods to retrieve the data. For each file of the given type (ship, planet, etc.), it uses the builder to decode the data, build it, and then persists it.

    The builder is a class that knows the internal structure of the file, decodes it (with the SMDecoder from BlackCancer), and returns a model filled with the entity data. By creating a builder per entity we can handle the special cases like the factions that works different.

    First of all I've changed my previous code to use this new class hierarchy, storing the data in the Symfony cache folder, and once it worked, I've developed an ElasticSearch implementation. I think it's a great option because Elasticsearch is document oriented and created to perform searches, what's exactly what we'll do in the API.

    Current state

    The API can read the following entities:
    • Ships
    • Players
    • Catalog
    • Factions
    • Planet
    • Shops
    • Server

    Not all data is used now, I'm starting with some basic data and I expand the fields when necessary.

    The API will work with an api key system, but it's not completely implemented (it needs an apikey param, but will work with any value).

    The repository only implements the findAll (with pagination) and findById methods. Next I'll implement some kind of filtering to allow searches like "all ships whose name contains XXX".

    My idea is to maintain both elasticsearch and file repositories to let any server admin to use for their server even if you don't want to use elasticsearch, but take into account that may fail if you have a lot of entities. Performance may be an issue with the searches also.


    Frontend (AngularJS)

    At this moment, this part is broken. I've started with the AngularJS tutorial and once implemented the service (the part where you connect to the REST API), I stopped working on it.

    When the first file based version of the API was developed, I've started working in the ship list to allow pagination with the API (originally it retrieved all the rows and then you paginate client side, what was horrible for performance) and added the Angular UI Bootstrap dependency, a project that allows to link Twitter Bootstrap with AngularJS (and implements a pagination plugin).

    At this point I'll implement the search function in the API and then in the frontend. From this point, the real app development will start.

    My idea is to provide a generic solution to query the game files, then I've planned those modules:
    • Entity list: For every entity type listed above, you'll be able to list with filters (initially by name)
    • Entity detail: A page with the data from the entity
    • Reports: TBD, see next.

    Reports

    Every server have rules. Some of them are related to limitations on entities. For example, we have a max mass rule for ships. But in the current state of the game, it's really hard to control, you need to check manually, you need reports from your users to know that there's a massive titan in the game, because there are not tools to detect some special cases.

    The idea for the report part of the application is to generate some special reports that will let server administrators to detect easily those infractions, but it's not limited to this use case, and now is when I need you.

    I need you to know what kind of reports you need to be able to create a report framework that allow to create those custom reports. Think in sentences like "I want to be able to list all the space stations that are X km from this sector".
     
    Joined
    Apr 21, 2013
    Messages
    1,714
    Reaction score
    650
    • Top Forum Contributor
    • Legacy Citizen 3
    • Councillor Gold
    BLESS YOU, kind sir. Will you implementing a way for logs to not be shit?
     

    wat

    Joined
    Dec 25, 2014
    Messages
    19
    Reaction score
    13
    Sounds cool and +1 for Angularjs. I'll have to check this out on github later to give this anything more feedback than an initial "Like".
     
    Joined
    Aug 11, 2013
    Messages
    86
    Reaction score
    9
    Today I've been working on a basic filter support. The controller receive a field and term params that will let us search entities that contains that term in the given field.

    After some problems with Symfony annotations and cache, and some research about elasticsearch queries, I've managed to filter ships by name. Then I've done the same with the other controllers, but for some reason, it does not work. I'll have to take a closer look because the code is the same and I don't see an apparent reason to fail.

    On the other hand, when I've tried to filter by another field, power, it failed. It may be because the field is numeric meanwhile name was an string.

    In any case, after this first approach, I've realised I'll need to check again how would this work because I'll need to filter not only by a "contains" type of query. For example, I want to retrieve all the ships which mass is greater than a certain number.

    I think I need to resolve those questions first before starting with the AngularJS part. Also, I'll not develop the other controllers because it's a lot of work every time the API structure changes, and I'll focus on ships until it's in an stable form. The same occurs with the file repository implementation, I'll wait until the elasticsearch repository is finished and then, I'll implement the final methods in the other one.
     
    Joined
    Aug 11, 2013
    Messages
    86
    Reaction score
    9
    I've advanced with the search problem, and now I know I need to learn more about elasticsearch.

    What happens when you try to query by a field with the "match" method is that it only matches complete words. Then, if you search for "pirate" you'll find strings like "pirate station 001", but if you search for "pir" it will not return any matches.

    Then I've tried with the 2query_string" method. It does the same, but if you use wildcards, it works and matches partial searches. Then, when you search for "*pir*" it'll return "pirate station 001". The "bad" part, query_string method searches in all the fields, not only the name.

    I've quoted bad because for the actual purposes (the entity search) it's perfect, it's better to search in all the fields because some times you'll want to look for example for ships by their creator's name or something like that.
     
    Joined
    Aug 11, 2013
    Messages
    86
    Reaction score
    9
    Yesterday I've been working in the AngularJS part to adapt it to the last changes made in the API part.

    Initially the ship collection exposed a "ships" property. I've developed an abstract EntityCollection class and changed the property to a more generic "data" name. Also, I've changed what findAllBy returns. Now it returns a container named EntityResutset that contains the data and the "count" value; before it was two separated method calls but with filtering, they need to be executed at the same time.

    Once the AngularJS services and views were updated to work with the data property, I've refactored the service to be able to send the "term" parameter for the filter part. Then I've modified the AngularJS ships controller to link a text input to the query call. Additionally, I've changed the list markup to a table because it looks far better.

    Now I have the first working implementation of an entity list (ships). Next, ship detail page works, but it needs some more coding love, and specially app navigation in general is not yet implemented (when you go back from the detail, you've lost the filter and pagination).
     
    Joined
    Aug 11, 2013
    Messages
    86
    Reaction score
    9
    Two weeks since the last update, wow.

    Last week I've been able to talk with a friend who uses AngularJS daily and I've added Router UI, a new dependency to handle the app like an state machine, with child states. This component will help a lot with some dependencies.

    I've spent this time changing how the app works to handle some variable propagation with Router UI (current page, query, order) and a first version of the ship list and detail is nearly done. This is time to show some screens.

    The list lets you filter the list or change the field of order. The list adds a pagination to ease the task and I want to add an option to change the number of items per page.



    When you click in a ship, you'll be able to see the details. Now it's limited to some fields, but the idea is to expand sooner or later them.



    Now I need to fix a bug with the text filter. Today I've added a delay to filter only when the user stops to type for a second, but later I've realized that the pagination is broken due to the watcher being fired constantly. Then I want to add the number of items per page option and then I want to change how the variables are stored using cookies/local storage.

    Once those tasks are achieved, I want to add an identification layer to manage users, login, etc. and then I think I can extend to the other entities.

    Many thanks,
    Theck
     
    Joined
    Oct 19, 2013
    Messages
    14
    Reaction score
    0
    Hi, i like so much your idea!
    I wona just ask something to you: there is a way to see the last time of "ship use" and if the ship is docked or not?
    Last things: is possible add a button for delete the selected entity? (and in case automatize the thing. Like: 2 day no one use a undocked ship => delete this ship)

    Tnkyou, have a nice game...
     
    Joined
    Jun 20, 2013
    Messages
    293
    Reaction score
    48
    • Purchased!
    Can you document your decoding stuff? I'd like to write some software that needs to read all of the SM files.
     
    Joined
    Aug 11, 2013
    Messages
    86
    Reaction score
    9
    ...last time of "ship use" and if the ship is docked or not?...
    For the moment, only name, current sector, mass, power and shields are retrieved. Once the basics fully works, extending the data retrieved will be relatively easy. I don't remember if this data is present in the file, sorry.

    ...is possible add a button for delete the selected entity?...
    In the initial phase the app will be read only. I've done some research and I have a very basic script that allows me to send commands to the server from within PHP and what you want it's teorically possible meanwhile there's an existant admin command to do so (for example /destroy_entity is not valid because it need to "select" an entity and the app it's not "ingame" to do it).

    But before I want to take a look to Doomsiders' Shadow because I think it'll be better to integrate to such a decent script.

    ...automatize the thing. Like: 2 day no one use a undocked ship => delete this ship)...
    I've started to plan something like this, a kind of "jobs" system. The basic idea is that a job is a list of commands that will be executed on the server. You'll be able to program the execution and so on.

    Can you document your decoding stuff? I'd like to write some software that needs to read all of the SM files.
    I use SMDecoder class from the StarOS project from blackcancer ;)
     
    • Like
    Reactions: blackcancer
    Joined
    Jun 20, 2013
    Messages
    293
    Reaction score
    48
    • Purchased!
    For the moment, only name, current sector, mass, power and shields are retrieved. Once the basics fully works, extending the data retrieved will be relatively easy. I don't remember if this data is present in the file, sorry.


    In the initial phase the app will be read only. I've done some research and I have a very basic script that allows me to send commands to the server from within PHP and what you want it's teorically possible meanwhile there's an existant admin command to do so (for example /destroy_entity is not valid because it need to "select" an entity and the app it's not "ingame" to do it).

    But before I want to take a look to Doomsiders' Shadow because I think it'll be better to integrate to such a decent script.


    I've started to plan something like this, a kind of "jobs" system. The basic idea is that a job is a list of commands that will be executed on the server. You'll be able to program the execution and so on.


    I use SMDecoder class from the StarOS project from blackcancer ;)
    Does SMDecoder work for the latest format introduced.
     
    Joined
    Oct 19, 2013
    Messages
    14
    Reaction score
    0
    Tnkyou for answers.
    Have a nice day and a good game!
    I like very much your work.
    Good luck!