krballard94 Posted April 26, 2015 Share Posted April 26, 2015 Straight away, this will not be a game out of the box. To be able to make a game out of it, development will be needed. I'm looking at creating a basic open-source engine developed on the Laravel framework but first I'm wondering what the general opinion would be. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 26, 2015 Share Posted April 26, 2015 I think it would be fun. I don't know laravel and always kind of wanted to dig into it Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted April 26, 2015 Share Posted April 26, 2015 Decent framework, needs better error handling, me thinks! Quote Link to comment Share on other sites More sharing options...
CodingKid Posted April 26, 2015 Share Posted April 26, 2015 I've been planning on starting a project using the Symfony framework for sometime, just haven't got round to it. I wonder if there are many games out there using MVC frameworks? Quote Link to comment Share on other sites More sharing options...
Coly010 Posted April 26, 2015 Share Posted April 26, 2015 (edited) I've been planning on starting a project using the Symfony framework for sometime, just haven't got round to it. I wonder if there are many games out there using MVC frameworks? Mine is [MENTION=70715]krballard94[/MENTION] If you do this, make sure to have a basic user table at the very least, a login/register/forgot password system. Have it so that its easy to implement mods etc, without leaving the database or file system clustered. For me personally, objects and classes are your best friend when using MVC. So like for me, I'd have an Item class and an ItemLoader class. The item class would have functions and variables that store information from the database. Item loader creates a bunch Items and makes them accessible when you need them, that way you can get information easily, readily and without rewriting code all over the place in your game. That can be done for anything then: Shops - have a purchase function which accepts an Item as a parameter and it does all the checks then adds the item to your inventory and removes the money etc. Have it use the ItemLoader and Item class to list the items it sells. In other words... I love obejcts and classes :P Edited April 26, 2015 by Coly010 Quote Link to comment Share on other sites More sharing options...
krballard94 Posted April 26, 2015 Author Share Posted April 26, 2015 I think it would be fun. I don't know laravel and always kind of wanted to dig into it I've been using it quite a bit since I've come back to development and I think it is very good! Decent framework, needs better error handling, me thinks! Laravel encourages people to extend the framework to how they see fit! I've been planning on starting a project using the Symfony framework for sometime, just haven't got round to it. I wonder if there are many games out there using MVC frameworks? I believe that MVC is a good approach and we should start using it as it gives us great ability to separate our application logic. Quote Link to comment Share on other sites More sharing options...
Script47 Posted April 26, 2015 Share Posted April 26, 2015 Don't gear the engine to any specific game genre, that way people can be more open minded. Quote Link to comment Share on other sites More sharing options...
krballard94 Posted April 26, 2015 Author Share Posted April 26, 2015 (edited) If you do this, make sure to have a basic user table at the very least, a login/register/forgot password system. Have it so that its easy to implement mods etc, without leaving the database or file system clustered. The best thing about this, is Laravel ships with this. Don't gear the engine to any specific game genre, that way people can be more open minded. I'm open to suggestions on ideas through out. I don't plan on making a specific genre because it gets way to boring. So if you have any ideas, please let me know! To even avoid every game having the same currency, I've simply put currency and special and in the settings table I've made fields called game_currency, game_currency_sign and game_special. I even made it so when you reference the currency column all the formatting has been done already with the help of accessors from Eloquent $user->stats->currency // output: £1,234.56 Edited April 26, 2015 by krballard94 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted April 26, 2015 Share Posted April 26, 2015 $user->stats->currency // output: £1,234.56 I'd recommend a minor change $user->stats->currency // output: 1234.56 $user->stats->currency_formatted // output: [symbol]1,234.56 | output: [symbol][local currency formatting system] Quote Link to comment Share on other sites More sharing options...
krballard94 Posted April 26, 2015 Author Share Posted April 26, 2015 I'd recommend a minor change $user->stats->currency // output: 1234.56 $user->stats->currency_formatted // output: [symbol]1,234.56 | output: [symbol][local currency formatting system] Eloquent has a function to output the original state before the accessor touched it. $user->stats->currency // output: 1,234.56 $user->stats->getOriginal('currency') // output: 1234.56 Quote Link to comment Share on other sites More sharing options...
Coly010 Posted April 26, 2015 Share Posted April 26, 2015 I'd recommend a minor change $user->stats->currency // output: 1234.56 $user->stats->currency_formatted // output: [symbol]1,234.56 | output: [symbol][local currency formatting system] Yep, cause that way you can use the un formatted version in game logic :) Quote Link to comment Share on other sites More sharing options...
krballard94 Posted April 26, 2015 Author Share Posted April 26, 2015 Yep, cause that way you can use the un formatted version in game logic :) Refer to my previous post. Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted April 27, 2015 Share Posted April 27, 2015 Eloquent has a function to output the original state before the accessor touched it. $user->stats->currency // output: 1,234.56 $user->stats->getOriginal('currency') // output: 1234.56 Ah, fair play! Quote Link to comment Share on other sites More sharing options...
Dave Posted April 27, 2015 Share Posted April 27, 2015 I love Laravel, I think this will be an awesome project. Excited to see what you create. Quote Link to comment Share on other sites More sharing options...
krballard94 Posted April 27, 2015 Author Share Posted April 27, 2015 I love Laravel, I think this will be an awesome project. Excited to see what you create. I think it's very good to! I might even create a GitHub repo after I have the basics so the source is easily accessible.. Then people will also be able to fork it and make adjustments to make the whole engine better. Quote Link to comment Share on other sites More sharing options...
Dave Posted April 27, 2015 Share Posted April 27, 2015 I think it's very good to! I might even create a GitHub repo after I have the basics so the source is easily accessible.. Then people will also be able to fork it and make adjustments to make the whole engine better. If you do and I have any free time I'll try and help out! Quote Link to comment Share on other sites More sharing options...
Guest Posted April 29, 2015 Share Posted April 29, 2015 Decent framework, needs better error handling, me thinks! After seeing some of your code, in which you prepend every damn class with mtg_. How on earth can you see it needs better error handling? It's fine, I assume you know about environments in which to turn on and off errors right? Laravel is beautiful, full of everything you need to get started with a framework. - - - Updated - - - The best thing about this, is Laravel ships with this. I'm open to suggestions on ideas through out. I don't plan on making a specific genre because it gets way to boring. So if you have any ideas, please let me know! To even avoid every game having the same currency, I've simply put currency and special and in the settings table I've made fields called game_currency, game_currency_sign and game_special. I even made it so when you reference the currency column all the formatting has been done already with the help of accessors from Eloquent $user->stats->currency // output: £1,234.56 -1 in my opinion, you should always return the raw output. Then in blade or twig, write an extension which formats it correctly imo, you will only ever use the formatted amount a few times, but the original you would use across all mods surely that use cash? Quote Link to comment Share on other sites More sharing options...
SRB Posted April 29, 2015 Share Posted April 29, 2015 +1 for extending Twig and formatting there Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted April 29, 2015 Share Posted April 29, 2015 After seeing some of your code, in which you prepend every damn class with mtg_. How on earth can you see it needs better error handling? It's fine, I assume you know about environments in which to turn on and off errors right? Laravel is beautiful, full of everything you need to get started with a framework. [...] Prepending my classes with "mtg_" is just a personal preference. It makes no difference in the usage itself. And yes, I know about error handling. I've wrote and used many different error handlers for different projects. I like Laravel, never stated I don't. I just don't like the stock error handling system. There's normally far too much information being displayed to repair the more common errors. Whilst the highly-verbose output does come in handy, I find it a little overkill personally. I like clear and concise. Quote Link to comment Share on other sites More sharing options...
Dave Posted April 29, 2015 Share Posted April 29, 2015 Prepending my classes with "mtg_" is just a personal preference. It makes no difference in the usage itself. And yes, I know about error handling. I've wrote and used many different error handlers for different projects. I like Laravel, never stated I don't. I just don't like the stock error handling system. There's normally far too much information being displayed to repair the more common errors. Whilst the highly-verbose output does come in handy, I find it a little overkill personally. I like clear and concise. The amount of times I get hardly any information from an error and I cry a lot. You can never have too much information about an error, especially in agency life, even more so especially when it's not your code you're debugging. Quote Link to comment Share on other sites More sharing options...
krballard94 Posted April 29, 2015 Author Share Posted April 29, 2015 -1 in my opinion, you should always return the raw output. Then in blade or twig, write an extension which formats it correctly imo, you will only ever use the formatted amount a few times, but the original you would use across all mods surely that use cash? I want to keep my view files as clean and with minimal logic inside them so I disagree with this (And I'm not a fan of blade, but I am using it). However, as I'm going along I'm slowing documenting what I add. Personally for me, I know that I'll be using accessors in this project so I know that the getOrignal function will return the raw output. I've since added some methods to my logic in the model, and in my opinion it will make it easier update stats and currency in mods. // Within UserStat model public function decreaseStat($stat, $value) { return $this->attributes[$stat] = parent::getOriginal($stat) - $value; } public function increaseStat($stat, $value) { return $this->attributes[$stat] = parent::getOriginal($stat) + $value; } //Examples $user->stats->increaseStat('endurance', 10.10); $user->stats->decreaseStat('currency', .50); $user->stats->save(); So now, upon displaying the information it is still formatted but overall the editting of the stats are done with ease. Quote Link to comment Share on other sites More sharing options...
Script47 Posted April 29, 2015 Share Posted April 29, 2015 I want to keep my view files as clean and with minimal logic inside them so I disagree with this (And I'm not a fan of blade, but I am using it). However, as I'm going along I'm slowing documenting what I add. Personally for me, I know that I'll be using accessors in this project so I know that the getOrignal function will return the raw output. I've since added some methods to my logic in the model, and in my opinion it will make it easier update stats and currency in mods. // Within UserStat model public function decreaseStat($stat, $value) { return $this->attributes[$stat] = parent::getOriginal($stat) - $value; } public function increaseStat($stat, $value) { return $this->attributes[$stat] = parent::getOriginal($stat) + $value; } //Examples $user->stats->increaseStat('endurance', 10.10); $user->stats->decreaseStat('currency', .50); $user->stats->save(); So now, upon displaying the information it is still formatted but overall the editting of the stats are done with ease. Just a suggestion, you could have it in one function and allow an extra parameter which takes the math operator, instead of having two functions. So + (add on to current value) = (overwrite value) etc. I'm sure you get what I mean, so adjustStat("currency", .50, "+");. Named adjust stat as it's neutral to what is going to happen. That might help keeping the files clean. Quote Link to comment Share on other sites More sharing options...
krballard94 Posted April 29, 2015 Author Share Posted April 29, 2015 Just a suggestion, you could have it in one function and allow an extra parameter which takes the math operator, instead of having two functions. So + (add on to current value) = (overwrite value) etc. I'm sure you get what I mean, so adjustStat("currency", .50, "+");. Named adjust stat as it's neutral to what is going to happen. That might help keeping the files clean. I did actually toy with that idea just before I previously posted, but i decided against it. I believe the method names are more clear and concise. Quote Link to comment Share on other sites More sharing options...
Script47 Posted April 29, 2015 Share Posted April 29, 2015 (edited) I did actually toy with that idea just before I previously posted, but i decided against it. I believe the method names are more clear and concise. Fair enough, although I do wonder why you have to call the save function for it save? And why it is not called when a stat is adjusted. Edited April 29, 2015 by Script47 Quote Link to comment Share on other sites More sharing options...
krballard94 Posted April 29, 2015 Author Share Posted April 29, 2015 Fair enough, although I do wonder why you have to call the save function for it save? And why it is not called when a stat is adjusted. Because that's the way Eloquent is intended to be used. However for example, if it would update on each reference... What if you wanted to do more than one adjustment? That could be multiple queries! So why do more, when less is good? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.