Jump to content
MakeWebGames

gamble

Members
  • Posts

    348
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by gamble

  1. PHP Version 8 (I believe. Ill double check later - working on an update for it right now). PDO - If you use the Database class (as is intended) i force prepared statements for the obvious security benefits Free version now available! Not sure how well it will work, but all my testing seemed to be good. There is one module that does not have a link anywhere, but i included it for a detail module example. It is the pointsMarket. Any issues let me know!
  2. I replied to your comment on it, but I'll state it here publicly too. The sole purpose of that license notice is to say do not purchase this engine then resell it as your own somewhere else (this is kinda obvious though). I will remove this notice to avoid further confusion. If you make a game or whatever, you can resell that without issues. That is no problem. Link to demo: spade.makeweb.games Yeah, i honestly expect the price tag to put some off. Its a project i believe in though and i will continue to develop whether people purchase it or not. I am going to try and create a stripped version today, and release that for free. Thanks for the feedback!
  3. SPADE Engine is finally available for purchase on the marketplace! If you check it out and notice anything missing, any bugs, or anything worth noting please let me know! I am sure i missed something or another, but i tried my best to capture everything! If you need any help or support (especially during these first couple weeks) please do not hesitate to contact me on here or via DM on discord (Head.Clicker#0238). I will be creating more an more documentation on this forum in order to aid anyone who is struggling! Mod Developers: Mod developers! If you are interested in creating mods for SPADE I have a special offer for you! If you purchase SPADE, and develop 3 mods for it and publish them to the marketplace (free or paid, i do not care which), contact me and i will refund the full $50 purchase price as a thank you for the support!
  4. I respect that you're trying to improve this, but for simplicity reasons I specifically chose to use globals. DI would be complicated to someone who is not too familiar with OOP. Not to mention that since this is PHP it's not that big of a deal since the server side of things is essentially recreated with every API call - it's not persistent between calls. If you could provide me an actual example why it would be beneficial in something like this I'll gladly reconsider, but it seems pretty pointless for server side code that runs for under 1 second at a time and is already self decoupled by the API calls themselves.
  5. Right now is a terrible time for me to release anything. I am reworking crons entirely so some key functionality will be missing...but i will let you in on a secret: I am planning to release the engine tomorrow. Not sure if it will be tomorrow morning or evening. I still have to message @Dave to try and get a SPADE Engine category in the marketplace, but im hoping to wrap up the code tonight, tomorrow morning, or tomorrow evening.
  6. Quick update: Crons (actually timestamps) management started, but may have to rework them...spent all day reworking player regeneration queries (crons). Player regenerations now only occur when the user is fetched through the User class. This will greatly reduce resources over having 1 giant query for all users. Currently problem solving on how to sort the order the timestamp crons run in. Either a number based system, groups (primary and secondary group), or just order of creation. The current issue is im trying to make the engine dynamic, which make having a "clean up" cron necessary (Meaning a cron to specifically check for energy, health, brave, etc over max and setting it to the max value so we are not over it). This creates the need for 2 crons...which is not "intelligent" Maybe set min and maxes value on crons... sorry thinking out loud. Any input is appreciated
  7. This is good input. I chose the way I did due to readability, but a function that runs parallel to these that's more dynamic isn't a bad idea at all! Easy to had too, so I may slap that in before release! Thanks for the feedback!
  8. Its all good! I think i came off meaner than i intended. Welcome to the community! There are tons of helpful people here, but spamming the forums is not a good way to get help. Again, welcome and hopefully you get the help you are looking for!
  9. Summary of Steps: Create Client Side script (Javascript) Add Client Side script to assets/js/config.js Create Client side API links (if needed) Include Client Side script and API links to index.html Create Server Side API (PHP) Create Client Side Script (Javascript): 'use strict'; class NewPage { constructor() { } generateMenuLink(button) { button.div.setAttribute('jailRestricted', 'true') button.div.classList.add('menu-button') button.icon.classList.add('menu-button-icon', 'fa', 'fa-hospital') button.text.classList.add('large') button.text.innerHTML = 'Hospital' button.div.append(button.icon) button.div.append(button.text) button.div.append(button.label) } generateContent(content) { } start(params) { params.menuLink.div.classList.add('menu-button-active') } stop(params) { params.menuLink.div.classList.remove('menu-button-active') } } Above is an example of the basic code that can be found in a Client sided script. Now lets go through each function and some notes of some thing inside constructor **OPTIONAL** - This is just a basic javascript function that is called when the class is created. Throughout the engine this class is used to initiate variables and API link classes generateMenuLink **OPTIONAL** - This will automatically create a link in the main menu...you just need to specify some things button.div - this is the entire button - we associate the menu-button class with it because it is our basic styling Notice the atttribute "jailRestricted" is set to true...this means that the menu link is hidden when in jail We also have a "hospitalRestricted" attribute that can be set button.text - this is what text appears in the button Notice the "large" class - The "large" class is only visible on desktop, it is hidden on mobile A "small" class exists to hide on desktop, and only show on mobile button.icon - this is what icon will appear on the button The engine uses Font Awesome, so take a look and find a icon you like for your page! Be smart with the icon choice...if you choose to hide the text on mobile, they will only see the icon generateContent - This is the content generate on load of the page DO NOT USE THE DATABASE IN THIS FUNCTION Trying to access the database in this section can result in an error occurring thus, making the site not work Typically in the engine we create a class variable and store the "content" parameter so we can draw the page later start - this is called whenever the menu link is clicked, or the module is loaded in any other way You can pass parameters to this by creating a link - for example if we wanted to load a profile on a link click: modules.load("profile", {id: userID}) I always use this to "activate" a button with styling stop - this is called whenever the "start" function of another module is called AKA whenever the page is stopped being used I always use this to "deactivate" a button with styling From here you are free to create whatever you want Add Client Side script to assets/js/config.js: Open assets/js.config.js You will see a object created called "config" with a list of modules stored in the "modules" key Add your new module to this list "newPage": new Page(new NewPage()), Update the key of this with an alias you would like to use This is used with modules.load() Within the new Page() add the class name you used in your client sided script Create Client Side API links (Javascript): Go to assets/js/apis Create a new file with an appropriate name to what your module is 'use strict'; /* * */ class ModuleAPI { constructor(){ this._file = 'module.php' } getSomething(){ return { url: api.buildURL(this._file+`/getSomething`), headers: api.authHeaders(), method: 'GET', } } postSomething(data){ return { url: api.buildURL(this._file+`/postSomething`), headers: api.authHeaders(), method: 'POST', body: JSON.stringify({'data': data}), } } } There are a couple things to note here: getSomething - will request {DOMAIN}/module.php/getSomething We will cover what this does on the server side later We need to pass the headers in order for the users data to be validated on the server No data can be passed with this method... postSomething - will request {DOMAIN}/module.php/postSomething Will will cover what this does on the server side later Again we need to pass headers - this is necessary for everything we want to do in game...we need to make sure you are logged in Data is passed in the body We can use this to request info about a certain user, update information, or whatever Basically this file is how the UI communicates with the server Include Client Side Script and API Links script to index.html: This is simple enough so we will not go into much detail Open index.html Add the links to the new files you just created Make sure API is before the Page script so that you can access the API script from the Page script Where you should put the links is marked in index.html Create Server Side API (PHP): Open the /api/ folder Create a new file for the module Create the API call responses <? require_once('core.php'); $getSomething = function(){ global $api; $loggedInUser = new User($api->getHeader('user')); $loggedInUser->enforceHospitalRestriction(); global $db; $db->query("SELECT * FROM users"); $allUsers = $db->fetchAll(); $api->output($allUsers); }; $postSomething = function(){ global $api; $loggedInUser = new User($api->getHeader('user')); $loggedInUser->enforceJailHospitalRestriction(); $userID = intval($api->getPostData()['data']); global $db; $db->query("SELECT * FROM users WHERE id = :userID", ['userID' => $userID]); $singleUser = $db->fetch(); $api->output($singleUser); }; $installer = function(){ $installer = new Installer(); $installer->checkTable('users'); }; $api->addRoute('/getSomething/', $getSomething); $api->addRoute('/postSomething/', $postSomething); ?> As you can see, the server side of this engine is stupid simple (as it should be!) In this example you can see how we fetch and validate the user in each API call. The User class auto validates the user. If the user appears to not be valid it will automatically terminate the script and return and error forcing a log out of the UI The User class is built into the engine and can be used to fetch ANY user. It will auto detect if the logged in user is being requested and run the appropriate checks, but any user can be fetched using new User($userID). The users database fields can be accessed using $userClassVeriable->username or whatever you are trying to fetch Example: $user = new User($userID) $user->username - would return the username of the user $user->money - would return the money of the user Another thing you can see is we enforce a restriction for jail and hospital! This functionality is built in with the following functions enforceJailHospitalRestriction - both Jail and Hospital enforceHospitalRestriction - Hospital only enforceJailRestriction - Jail only In the postSomething function you can see we fetch the "data" we passed in our API links script using: $api->getPostData()['data'] $api->output() This is what returns a message to the UI. We can return a string, array, whatever we cant. It will all be encoded into json, and auto-decoded on the UI through the QReq class When this function is called it kills the entire script using the PHP exit() function. Meaning whenever you see this the function will terminate at that point - no need to return anything after or exit afterwards. As an alternative if we run into an issue we can easily send a error message using $api->outputError(errorCodes, otherParameters) otherParameters can be sent as a string or array, this will be passed to the UI automatically and you can use it with the error handlers located in assets/js/core/errors.js - you can add your own codes here and handle them how you please Parameters will be stored in errorResponse.info in erros.js List of built in Error codes: 999 - this is a general error that will be displayed in a pop-up (can be used to say we do not have enough money or whatever) You can specify a string to be displayed in otherParameters 400 - forbidden access for when someone is trying to access something they should like staff panel This will log user out and log the event... 997 - User tried to access something they should have while in jail - redirects to jail and displays error 998 - User tried to access something they should have while in hospital - redirects to hospital and displays error $api->addRoute() This is how we tell the server what to look for. In the example above we are looking for /putSomething/ and /getSomething/ on the end of our file. For example if this is module.php these routes will be used when we try to access module.php/getSomething/ or module.php/postSomething/ The second parameter is obviously the function we are trying to call when the URL is visited The $installer function in this example is unused...this will be covered in a different post. This is for creating a module for other users to download and use 🙂 Thats pretty much all there is to it. We need a Page script, a client sided API script, and a server sided API script that tells the server what to do with information or what to fetch for us. One last quick note. In order to access an API link from the Page script use the following to make a request: QReq.request((new ModuleAPI()).postSomething(userID)).then(resp => { //what we do with what we return using the $api->output() function in the server code }) The above will call our postSomething function for the API links script we created earlier...it will pass the parameter we require as you can see. If anything is confusing or you need some assistance feel free to drop a reply below and ill gladly help clear up any confusion. I will update this as clarification is needed! Reserved for updates or other information Preparing for release so making documentation. As of writing this the engine is not released
  10. Do you mind not spamming the forum with the same shit over and over? I look at recent posts and 4 of them are you with the exact same question. Stop. If someone is interested they'll contact you on the other posts you've made.
  11. Crimes management in Staff Panel completed. Beginning work on Crons management soon. Looks like i could be done with this in a week or two. End of month is worst case scenario. I also have to write some forum posts about creating mods, and general information about working with the engine.
  12. After fighting and getting over covid + the holidays, this project is back in full swing. Crime Management is close to being complete, and Crons are still being planned out for the management portion - they are a bit more complicated to manage, so im trying to simplify them a bit. After that SPADE should be good for release - i am hoping for the end of this month or early next month
  13. Quick update: First off happy Halloween! This project is getting super close to release. I've reworked a couple systems to make them a little more modular. Here is my list of things to do: -Points usage options control in staff panel -Awards control in staff panel -Crimes management in staff panel -Crons management in staff panel That's right! All remaining things to be done are staff panel related. This is taking me a bit longer, since I'm not used to creating or even using staff panels.
  14. ob_start() At line 2 of file (right after the php opening brackets) Should fix it. If not move session_start() to line 2 of file
  15. This wouldn't be too bad to implement with mccodes. When it comes to interfacing with a database in JavaScript I would look into http requests. This will help because you can use JavaScript to request a page such as: dealornodeal.php?action=open&case=2 You can then use php to update the database and send a response back. Keep in mind that the responses can only be JSON. Fortunately php and JavaScript both have JSON functions such as json_encode in php and JSON.parse() in JavaScript. If you need help feel free to send me a message
  16. Actually it is coded in php. It uses php and JavaScript. I was hoping to release the engine sooner, but a lot of stuff has come up in my personal life so it's been hard to work on it lately. Hopefully it'll be finished soon though
  17. Good eye! I hadn't actually noticed that. I'll definitely look into that and get it fixed.
  18. Out of curiosity, has anyone checked out the mobile site at all? Thoughts on that?
  19. I really appreciate that. I've spent a lot of time on it trying to perfect different aspects of it.
  20. Good morning/afternoon everyone! Over the past couple of weeks I have been developing an advanced game engine that utilizes many different technologies that have not previously been used in game engines (to my knowledge). The engine uses a series of helper functions and a custom built template manager to create a single page web app (no refreshes or page loads except for the initial load). S - Single P - Page A - Application D - Designed for E - Efficiency I will not go into detail during this post, due to this not being an official release. With that being said below are a couple of the technologies and features unique to SPADE: Uses HTTP API requests (limited by PHPs lack of REST API support) Uses CSS Grids to make a very dynamic user interface Includes a full mobile site - this goes hand in hand with the CSS Grids A full UI templating engine that will build the entire app for you...assuming all the appropriate functions are defined Custom error handling via the UI templating engine Current plan for release: Price: $50 Release Date: TBD - It is hard to have an exact date due to having a family to spend time with, and work to attend to So you may be asking "If this is not a release what is this post about?!" Well today i would like to invite you to come check out the UI and features that will be released with this engine. The UI as it stands right now is 95% complete (I have plans to add a couple minor feature, and there are always bugs to fix). The staff panel is currently in development - early early stages (which is why this is not ready for release). Feel free to come check out the game engine: https://spade.makeweb.games/ I ask that everyone please create their own account, due to the current token system being a single token at a time (if you log in and someone else was already logged in to that account it will kick them out). If you have any questions or want any clarification please leave a reply and i will answer you as soon as i can!
  21. Guys I think you're beating a dead horse at this point...he's long gone by now I'm sure
  22. https://en.wikipedia.org/wiki/Category:Samurai_weapons_and_equipment
  23. gamble

    New Game Engine?

    I'd do a public development so people could see progress and ask questions as things come up
  24. Good afternoon all! Just curious if there would be any interest in a modern game engine. I was considering creating one using a hefty amount of JavaScript to make it more dynamic. Just curious before I order hosting and spend a lot of time.
  25. I haven't tested this or anything, but I think the below will work: window.onerror = function(msg, url, linenumber) { alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+linenumber); return true; }
×
×
  • Create New...