Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Use Wordpress as your game's database

Discussion in 'Assets and Asset Store' started by MrDude, Feb 17, 2014.

?

If I were to build the kits in order of preference, which kit would you like first?

  1. Friends system: Invite friends and see what they are playing. Include PM and chat services

    44.9%
  2. Online privacy: Protect your info select exactly who can see what

    16.7%
  3. Message boards system: Categories for author, clan leaders, groups personal

    19.2%
  4. Online market place: Trade with NPCs or real players. Includes gifting service

    37.2%
  5. Custom character system: Create a character in one game and take him into other games

    19.2%
  6. 2D narrative game template: Write a story, build a game in a day...

    14.1%
  7. Clan system: Access your friends arsenal during your own battles

    9.0%
  8. Wordpress Games portal: Display available games, sell them and show stats (ratings/reviews)

    24.4%
  9. Other: Please specify...

    5.1%
Multiple votes are allowed.
  1. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    406
    Thanks for the clarifications!
    I just want to make sure if its okay to use it in a competitive game, but turns out there isn't really any protection against tempering/cheating. But that's alright, since I am not working on a competitive game. (Perhaps its alright with enough local protection and countermeasures, but it still isn't, and will never be 100% safe unless server authoritative model are used.)

    I purchased MBS Core, and WordPress for Unity : MBS Core Edition.

    I imported the project into a clean Unity Project to test it out, upgraded the scripting runtime to 4.6, and I encountered a lot of line ending warnings.
    Here is 1 example :
    And there were 1 other scripting warning, and a red error.
    For the warnings, I prefer if my project is clean from all the yellow warnings, as they make things harder to see for my own script's warnings. I hope these can get cleaned up in the future.

    I don't know if I am doing something wrong by simply importing it.

    Thank you :)
     
    Last edited: Jul 8, 2018
  2. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Regarding cheating, totally agree. It's like I said in my previous post, the only way for you to prevent cheating is to add the anti-cheat measures into your game then run an instance of your game as the server people connect to. Only if it's YOUR binary running on YOUR server hardware and IT decides what data is updated for who and when, that is the only way for you to be 100% sure that nobody cheats.

    Simply have a couple of instances of your game running on a VPS or a couple running on a couple of VPSs and now you have yourself a system where YOU decide how many CCU you have and all it costs you is your VPS rental. As a bonus you know nobody can cheat because it's YOUR binaries on YOUR hardware that decides what can and cannot happen (no XP more than 1000 at once is allowed. XP is awarded after battles so no XP allocations allowed within 5 minutes of each other. Notice a consistent stream of XP allocations from one user? Lock the account using the function in the WordPress Login kit, etc etc etc).

    Only a server side game is safe from code injection and if the binary is not hacked then cheating is only as easy as you make it for them to cheat. I make it hard to simply arbitrarily call random functions on the server but I can't prevent them from modding whatever they want on the client side i they try to modify the binary. If I recall correctly, though, I think the Anti Cheat Toolkit can. I won't presume to have a clue HOW it does what it does ( :p ) but if I recall correctly, it can... So between the two of us your game should be safe :)

    The line endings thing is simply because I started working on these assets on a Mac (which uses \n as a line ending) and then traded in my Mac for a PC (which uses \n\r as a line ending). I do intend to get rid of them, though, cause persistent warnings suck big time.Agreed :(

    The explosion light warning is a remnant from the Unity project that the demo was built on top of. I got the warning also but it still worked fine so I left it be. I suppose I could add the "new" in front of it if it would make you feel any better but, like I said, that was in there from the start and everything still worked so I didn't want to mod Unity code that works. Seemed pointless. Mod it to work differently, absolutely, modify what works to still keep on working exactly the same... ummm...

    But yeah, I get where you are coming from. I also like to keep my projects as warning free as possible. I have reported an issue to Unity multiple times and they have actually come back to me and said they are able to reproduce the problem but still I have to live with it to this very day. So annoying. If you do this:
    Code (csharp):
    1. [SerializeField] Image img1, img2, img3;
    and then set those values in the inspector (or not, doesn't matter), then Unity will spit out (in this example) 2 warning messages about the last two values never being set and always remaining null. My login kit has sooooooo many of those warnings and it annoys the daylights out of me but they simply refuse to fix the bug so I have to go modify my syntax to add the "SerializeField" to each individual variable in order for the "You never set this value" warnings to go away. It is super annoying to see all those warnings. I fully get you!

    As for the error. THAT is new! That I haven't seen before. With me not receiving that error and with Unity instantly rejecting any thing I submit when they see any red errors (including them not restarting Unity for .NET4 to go into affect) it is odd that neither I nor them saw it but you do... Hmmm... I can think of only one reason why and will go test that now...

    Apologies for the hassles. I am on it like white on rice! Expect feedback soon!
     
    Last edited: Jul 9, 2018
  3. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Odd... I just downloaded both assets from the asset store and installed them into Unity 2017.3.0f3. I got the warnings but I didn't get the error :O ???? What's THAT about? :O

    I fixed the warning messages and submitted the new package. Hopefully it will be available on the store soon. Touch wood

    As for the error, if it is true that it is finding the definition of the System.Threading.Tasks namespace twice for some reason then it stands to reason that if you remove that using clause at the top of the script that the error should go away. Thus, I would recommend you doing so and seeing what happens but, like I said, I am not getting that error on my end so that is truly odd... I can't imagine why you are :O Nevertheless, try commenting that using directive at the top and see if that fixes your issue.
     
    Last edited: Jul 9, 2018
  4. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    406
    Whoops, sorry that was my error, :oops:
    Seems like I imported an asset that contains System.Threading.dll right after I imported yours in a clean project, and a google search says its causing a clash because your asset is using .Net 4.x, and imports System.Threading as well, so it gets confused.

    I never thought it would cause an error, because both asset is on a very different usability. (Perhaps the other asset chose to not have the user upgrade to .Net 4.x, and instead just import the dll that it needs for compatibility and less installation complexity.)

    Sorry about that, issues fixed! (But the warnings still persist, I will wait for the new uploaded fix!) :D
     
  5. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    The updated package is now available on the store.
    Enjoy! :)
     
  6. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    Hey MrDude!

    Can you show me a proper way to connect wordpress money and wordpress mycred?
    I want to let people buy credits and earn rewards both on my wordpress site and through their smart phone game.
    I'll use wordpress money for mobile and mycred for the website, but they seem to have different currency system. so...

    Btw, your wordpress mycred asset has errors, is it still working?
     
  7. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    The myCred system and WordPress Money are in deed two completely different systems. MyCreds is made by someone else and has all manner of website related functions (including buying the currency via WooCommerce). My asset simply gives you read and update access to player's balance from within Unity. Apart from that everything else is the author's baby.

    WordPress Money is a system entirely on it's own and has it's own set of uses, none of which has anything to do with myCreds. You might be better off using one or the other, not both.
     
  8. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    I was facing a bit of a conundrum with the myCreds asset. It hasn't been updated in years (it still uses OnGUI in the demo scene !!!) BUT it still worked just fine all this time. As is the case with all the other assets in my store, this asset relies on MBSCore and MBSCore recently received an update which broke support for all kits and required me to upload new versions of all assets.

    At this point I decided to not update the myCred asset but rather remove it from the store completely seeing how it hasn't been updated in years, now needs a compatibility update and,of course, there is WordPress Money which is the official virtual currency system of my assets. Just before I deleted it from the store I got an email from someone saying that they are starting a new project now and they will be using myCred. This just reminded me that the kit IS actually still of use to people...

    It's free, requires no maintenance at all and people find it useful... but I want to get rid of it... but some people find it useful... but I don't want to waste my time on updating an asset that hasn't required any maintenance in years... I want to get rid of it. So what to do?

    Well, I figured that the only errors people will run into is that some of the class names have been changed so just replacing cmlData with CMLData and replace mbsStateMachine with MBStateMachine... it's not something that is going to take people any effort to fix so I figured I'd leave it on the store for the sake of people who want it but the asset is, for all sense and purposes, abandonedware now.

    After reading the comment above I finally decided once and for all what to do about themyCred plugin. I have updated the asset and uploaded it to the store. It should now be available in a matter of days. Since the asset has worked without maintenance for years already it is safe to assume that now that the class names have been updated the kit will continue to work for years to come. I have thus set the version number to "Final" and in the release notes I state that the kit is now compatible with the latest version of MBSCore and should continue to work for years to come.

    The asset is thus still available for all to download and with a bit of luck it will continue to work for years to come BUT the asset will not receive any further updates or support. When the day comes that it no longer works for whatever reason, I will then remove the asset from the store. For now, though, it's been updated and should continue to work for the foreseeable future so download and enjoy.
     
  9. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    I find myCred for unity useful especially when I build webgl games (because from what I read, Tapjoy and your wordpress money currency support only Android and IOS, am I right?). So for my webgl games I'll have to use myCred.
    And if I need I think I can make myCred and wordpress money buy eack other's point. For example, wordpress money can buy myCred point on mobile devices and myCred can buy wordpress money point on the website.

    Thanks for the update anyway:).
     
  10. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Tapjoy can only be used on mobile yes. That is one of the features I list on the product page to say that with WordPress Money you can now SPEND Tapjoy points on any platform Unity supports... even on your Smart TV if you want. Earn Tapjoy points via mobile and then spend them on any platform Unity supports.

    As for virtual currencies, that part you have wrong. WordPress money allows you to create as many currencies as you want and use them anywhere you want. There is no restriction at all. You can even buy/sell Tapjoy points if you want. Tapjoy points is merely ONE of the unlimited currencies you can create.

    The only thing that makes the Tapjoy currency special is the fact that If you use Tapjoy on mobile you can get real world cash for giving your players virtual currency. They watch a video, it costs them no money, it costs you no money,they get virtual currency, you get real world cash. That's it.

    Apart from that you can give and spend points to any currency on any platform.
     
  11. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    Ah, Now it's clear to me. thanks.;)
     
    MrDude likes this.
  12. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    big.jpg
    I turned that asset I provided on page 8 into an actual asset that you can download without having to go hunt for it. Since the very purpose of this is to provide something that I will never update I am not sure if Unity is going to accept the package but we'll see in a few weeks/months when they get around to reviewing it.

    In the mean time, though, the asset is available on here, free as always.
    https://mybadstudios.itch.io/wordpress-mycustom

    Note... I said that I will not update the WordPress plugin and with that being the case it makes sense that the C# code will thus require no updating either but since releasing the asset on page 8 I have updated the base kit of ALL my assets, MBSCore, to version 4 and that introduced a few class name changes. Someone recently complained to me about the plugin on page 8 throwing errors and, while the code will still work, you must first change a few variable types here and there. This updated asset already has these updates implemented.

    Right, NOW it will not be updated any more. ;) :p
    Download and enjoy. :)
     
  13. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    For those of you who bought the MBSCore editions of my kits, you are in for another very pleasant surprise as soon as Unity gets around to vetting the latest update to MBSCore. :D

    MBSCore just got 3 updates added free of charge! :D Is this the best $5 you ever spent or what? :D

    1. Convert a Texture2D into a sprite in 1 line of code
    2. Fetch a Texture2D from Gravatar directly from a string.
    Optionally set a. textures size b. Gravatar default type generated image and c. age rating

    I.e.
    Code (csharp):
    1. public Image avatar;
    2. string email = "me@myaddress.com";
    3. Texture2D graphic = await email.FetchGravatarTask();
    4. avatar.sprite = graphic.ToSprite();
    3. Every MonoBehaviour can have global events built right into them. Set and trigger events from any MonoBehaviour!
    Code (csharp):
    1.  
    2. void Start() {
    3.     this.TriggerEvent("eventname");
    4.     this.TriggerEvent(myenum.value1);
    5.     this.AddEventListener(myenum.value5, MyFunction);
    6. }
    That easy! :)

    Enjoy
     
  14. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    Hello, MrDude.

    I'm trying to simplify WULoginPrefab because I don't need things like user registration, localization etc..., so I removed all other subpanels except WULoginScreen and PleaseWaitScreen.
    The problem I'm facing now is, when I call WULogin.LogOut(), it's not logged out with this message "No data returned from the server". And when I call WULogin.LogOut() again, then it's logged out successfully. Do you know why?

    And when login and logout, PleaseWaitScreen is not activated...
     
  15. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Honestly speaking, I think you are going about this wrong. That prefab of mine was meant to cover all bases and effectively be a "handles everything" good-to-go system. That means it was designed to work with all of it's component parts and has lots of code that it determines when to use. If you are going to strip it down to the absolute bare bones system like that then I would dare say it would be best if you just start from scratch and build your own prefab.

    Look at the simple login-logout demo... It calls login, then it waits, after login it can call logout, then it waits, then you can call login, then you wait... That demo clearly demonstrates that one call to login is all it takes and one call to logout is all it takes and it all just works... so when you say to me: "Hi, I took a complicated, well oiled machine and I removed 90% of the code but now it doesn't work right. What is the problem with the code I have left?" my answer is "You have 10% of my code in place".

    Logging in is as simple as calling the login function. Logging out is as simple as calling the function. Knowing when to display the waiting screen is as simple as registering to the server's on status change event and checking if the status is Contacting or None. With that being the case, creating an entirely new prefab should take far less time than breaking mine and trying to figure out what went wrong.

    No data returned from the server means that my kit didn't return any response at all. Error or otherwise. That means something else big is going on because I ALWAYS send a response. The only times I don't send a response is if an unauthorised person tries to call a function in the kit. If you don't belong there, I ignore anything you try to do... If your presence is authorised then you will ALWAYS get a reply: Error or otherwise.

    Here is something you can try if you insist on continuing to use my modified version: Open up WPServer and inside the HandleResponse function Debug.Log the server response before I mess with it. That error you are seeing means that I received no data from my kit but it doesn't mean that your website didn't send back any data. It could be that you got a 404 Error page from an invalid URL as a response and thus you have the entirer HTML output for showing that page returned as the result of your logout call... That is invalid data and thus "No data returned from the server". Checking to see what output you received might give you a hint into what you are doing wrong.

    If you get a php error message or a few Kb of HTML then you should be able to use that to determine what you are doing wrong. If you are getting nothing at all then it would indicate that the server doesn't recognise you as a valid person for some reason. Either way, that should give you some insight but let's review the facts as they are right now:
    1. My prefab works if you don't change it
    2. The simple login logout scene shows you that a single call to login and logout is all it takes
    3. When you change my prefab it no longer works
    4. With no idea what you changed in what way to bypass what and do what instead of what now to go from this instead of that, you are asking me "Why does something that used to work no longer work in the modified script I created?"

    Based on that I can only say that somewhere in point 3 you must have done SOMETHING wrong (something big or small, no clue) but when asked the question in point 4 the only possible answer I can give you is "I don't know". For me to figure out the answer to that question would mean sending em the entire prefab and making me read through the entire logic of your entire script to find out what it is you might be doing wrong at some place... That is going to eat up my time like Naruto eats ramen... i.e. no end in sight :p

    Two options:
    1. Start from scratch and build a custom prefab - by far the best option
    2. Find every place in my script where I call a the function to display a panel and make sure that only ever goes to the login or please wait screen. Then just modify the logic so it makes sense where applicable - Much room for error.

    Afraid that's all the advice I got for you at this time, mate.
     
  16. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    Finally, I found the reason. It's was because of all these wordpress plugins for login, logout redirection. They are not necessary, so I just simply deactivated them, and all things work like a charm.

    Thanks as always.:):cool:
     
  17. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Huh? I did something? Oh, um, wait (!) I'm getting credit... I mean "Sure. No problem!". ;)
    Now to strike a pose and bask in the glory of receiving credit for fixing your custom prefab.....errr...somehow ;) :p

    Always happy to help :)
    Enjoy!
     
  18. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    That free asset that I tried to place on the store to make it easier to find, yeah that's been in pending state for over 2 weeks now. Still waiting...
    The MBSCore update silently went live at some point, though, so at least that's available now.

    Just download the update and enjoy :)
     
  19. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    Hey!

    Is there any way to check if a certain "Category" exists in WUData?
     
  20. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    2 ways:

    1. WUData.FetchCategory("the_one_you_want", errorResponse:HandleFailure);

    Basically, just try to fetch it. If the category is found then it will run the code to parse it. If not, the server will return an error so you can then run custom code when that error is received.

    2. WUData.FetchGameInfo( ParseData );
    void ParseData(CML results) => Debug.Log("Category FOO exists? " + ((null == results.NodeWithField("cat", "FOO") ? "No" : "Yes") );

    Basically, fetch the game info (thus all categories) and then just see if the category is among the results. This method is definitely overkill if you want to check various categories often. If, however, you do what I do and fetch the game info at the start of the game, store it and use that throughout the game and only update the server from time to time without ever actually fetching anything from the server again, then this method is definitely the way to go.

    Option 3. At the start of your game (only need to do this once per game) set WUData.WUDataPro to true. All those wrapper functions I explain in the documentation will no longer work since you are now in pro mode. Pro mode uses CML directly rather than the bloated wrapper functions with the easy to remember names. Chief difference being that all categories are not called "__CATEGORY__" like it is now but, instead, each category is called by it's proper name. I.e. category FOO will now be called FOO so you can then do this:
    void ParseData(CML results) => Debug.Log("Category FOO exists? " + ((null == results.FirstNodeOfType("FOO") ? "No" : "Yes") );

    I.e. This is my recommended way of working (not tested):
    Code (csharp):
    1. public class MyData : MonoBehaviour {
    2.     static public MyData Instance;
    3.     static public CML database;
    4.  
    5.     void Start() {
    6.         if (null != Instance && this != Instance)
    7.         {Destroy(this); return;}
    8.         if (null == Instance) Instance = this;
    9.         WUData.WUDataPro = true;
    10.         WULogin.onLoggedIn += GetGameData;
    11.     }
    12.     void OnDestroy() => WULogin.onLoggedIn -= GetGameData;
    13.     void GetGameData(CML ignore) => WUData.FetchGameInfo(ParseData, errorResponse:GenerateFirstData);
    14.     void ParseData(CML response) => database = response;
    15.     void GenerateFirstData(CMLData ignore) {
    16.         database = new CML();
    17.         database.AddNode("FOO", "field1=bar; field2=9; field3=Hallo world");
    18.         WUData.UpdateCategory("FOO", database.Last);
    19.     }
    20.     static public bool CategoryExists(string cat) {
    21.         if (null == database) return false;
    22.         return (null != database.FirstNodeOfType(cat));
    23.     }
    24.     static public void SaveGame() {
    25.         if (null == database) return;
    26.         foreach(CMLData category in database)
    27.             if (category.data_type == "Global")
    28.                 WUData.UpdateCategory("", category);
    29.             else
    30.                 WUData.UpdateCategory(category.data_type, category);
    31.     }
    32. }
    And there you have yourself a complete bare bones in-memory database with all your game's data available in one place, complete with online saving of all your data at any time with a single call to MyData.SaveGame();

    Now you can access your game's data at any time using MyData.database or test if a category exist by just checking MyData.CategoryExists("some_category") whenever you feel like, from wherever you feel like in whichever script you feel like :)
     
    Last edited: Aug 20, 2018
  21. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    Oh Thank You, I'll try it!!!:D
     
    MrDude likes this.
  22. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    Finally... WordPress myCustom is now live on the Asset Store

    A quick recap:
    ► WordPress myCustom is a free asset that shows you how to add your own custom actions to my kits
    ► WordPress myCustom implements a sample subscription system to demonstrate this and WooCommerce integration
    ► WordPress myCustom ADDS custom actions and thus requires the WordPress Login kit in order to work
    ► The demo shows how to integrate WooCommerce into custom actions but for it to actually integrate with WooCommerce you will also need WordPress Money. If you don't care about WooCommerce integration then you don't need anything more than WordPress Login and this kit.

    Enjoy! :)
     
    obstudio likes this.
  23. Leunam

    Leunam

    Joined:
    Jan 30, 2013
    Posts:
    4
    Is there a way to use any of these packages to write a post on wordpress from Unity?
     
  24. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    The WordPress Login demo actually writes a post to the database. Reading and writing posts is part of a future package I am releasing but I have no e.t.a. on that. In the mean time I would suggest looking at the WordPress Login kit to see how to do so then get the WordPress myCustom and create a function specific to your needs by copy-pasting what I already do and then modding it as required.

    Basically, on the WordPress side you will need to duplicate the function I use and then change the post_type from 'wuss_game' to 'post' and that should do it. :)
     
  25. Leunam

    Leunam

    Joined:
    Jan 30, 2013
    Posts:
    4
    Thank you for your quick reply, I'm gonna try!
     
    MrDude likes this.
  26. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    For the first time since it's release the price of MBSCore is finally going up. Looking at the features list it only makes sense. People keep on asking me what the difference is between MBSCore editions of the assets and in the new product description I made it abundantly clear now:
    1. If you buy the standalone version then you pay full price and you get SOME of the code from MBSCore
    2. If you own MBSCore then you get discounted versions of my assets which are exclusive to owners of MBSCore

    I don't think I can put it more simply than that! :)
    For those of you who own MBSCore, the new update includes a vastly simplified alternative to Unity's ECS system. If you have ever looked at it and said "I wonder what that is" or "I would like to get started with that'" then you looked at the process of installing the preview package, having to define custom classes derived from said packages and then having to get used to this new way of doing things and just said "Never mind", well you are gonna love my alternative :p

    My system just requires that you change one MonoBehaviour on your game object to inherit from MBSEntity and you are done. You can now do what Unity allows you to do with Hybrid ECS. Here is the full code I used for the demo scene:
    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class EntityController : MonoBehaviour {
    4.  
    5.     public GameObject prefab;
    6.  
    7.     void Awake () {
    8.         for ( int i = 0; i < 20; i++ )
    9.             Instantiate( prefab );
    10.     }
    11.  
    12.     float Rand => Random.Range( -20f, 20f );
    13.     float RandColor => Random.Range( 0f, 1f );
    14.     Vector3 RandomPosition => new Vector3(Rand, 0f, Rand);
    15.     Color RandomColor => new Color(RandColor, RandColor, RandColor);
    16.  
    17.     void Update () {
    18.         foreach ( EntityClass entity in EntityClass.Entities )
    19.         {
    20.             entity.Timer += Time.deltaTime;
    21.             if ( entity.CanChange )
    22.             {
    23.                 entity.Timer = 0f;
    24.                 entity.Randomiser = Random.Range( 0.5f, 2f );
    25.                 entity.TheRenderer.material.color = RandomColor;
    26.                 entity.transform.position = RandomPosition;
    27.             }
    28.         }
    29.     }
    30. }
    31.  
    and for the actual entity...
    Code (csharp):
    1. using UnityEngine;
    2. using MBS;
    3.  
    4. public class EntityClass : MBSEntity<EntityClass> {
    5.     public Renderer TheRenderer { get; private set; } = null;
    6.     public float Timer { get; set; }  = 0;
    7.     public float Randomiser { get; set; } = 0f;
    8.     public bool CanChange => Timer > Randomiser;
    9.  
    10.     private void Start() => TheRenderer = GetComponent<Renderer>();    
    11. }
    How simple is that? :)

    Unity ECS:
    Define a collection of Components
    Unity will find all game objects that have those components and call them an entity
    During OnUpdate do a Find operation to get the entities you want
    Loop over them and do whatever it is you want...

    MBSEntity
    Don't FIND, just SPECIFY a game object as an entity
    It's auto loaded into a list for you so just loop over them and do whatever it is you want...

    Simple as can be

    Enjoy
     
    Last edited: Sep 19, 2018
  27. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    MrDude joined this forum in September 2006...
    ...and got kicked off in October 2018.

    All things inevitably come to an end and after more than a decade on here, that end has come... MrDude has left the building and now dwells over on our website instead.

    Please join me in saying:
    Sayonara MrDude...
     
  28. Ceciphar

    Ceciphar

    Joined:
    Jan 21, 2017
    Posts:
    51
    This is so sad. What happened to him?
     
  29. obstudio

    obstudio

    Joined:
    Sep 30, 2016
    Posts:
    52
    Hi freshman ;)
     
  30. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    That is actually the wrong question to ask...

    Don't ask "What happened to him?".
    Rather ask "What happened to everything we bought from him?". That is a far more interesting question.
    The simple answer is: It's all gone.

    The longer answers is: The last time you downloaded the assets was the very last time you were able to download the assets. You will not receive any more updates and won't be able to download anything anymore. Everything is gone.

    Most customers still have no idea that everything they bought from myBad Studios over the course of the past 8 years (even the free assets) has all been ripped out from under their feet hours before MrDude even knew about it... but since he wasn't able to access this site any more he wasn't able to tell anyone either. Since all customers are left in the dark about this matter I came here to warn you to make backups of everything and inform you that the assets ARE still being maintained / developed on our website.

    Existing customers take note: You can choose to download your assets from our website but unfortunately they are no longer available to download on the Asset Store. Updates will be available on our website.​

    Speaking of which, MBSCore and WordPress For Unity have received updates already...
     
    Last edited: Dec 10, 2018
  31. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    14,277
    On the contrary it's a perfectly valid question to ask, and I'm suddenly curious too, because there is nothing in his most recent posts that would lead him to getting "kicked off in October 2018". Very few actions will result in a ban on these forums and getting a complete account ban generally requires you to have done something illegal.
     
    Last edited: Oct 20, 2018
  32. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    lol @ that. The simple fact of the matter is that Unity doesn't like to admit to their mistakes and he got banned for calling them out on it. The very reason cited on the ban message is "You kept behaving unprofessionally by posting negative things about the vetting staff" so if I explain to you what happened in full then they will most likely ban me also. A gag order is thus in effect.

    I'll give you the short version: The vetting staff suck at their job. He asked "What am I supposed to do?" and without even a single person from Unity answering his post, they just upped and banned him instead. Simple as that. The thread should still be in the publisher section of this forum if you wanna go read it for full details. Me, I'm too afraid to say more... I've seen what happens...
     
  33. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    What happened here?, I have 2 more assets from you to give 5 stars. Are you done with Asset Store?
     
  34. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Unfortunately you will have to go look in the private publishers section of this forum for that answer. I've issued strict instructions @ myBad Studios to only say nice things about Unity or to shut up... which is why I am hardly ever on here. Too busy with other things to spend my time watching my tongue. :(

    But, if you get to there you might actually know more than we do. Last thing he knew the other publishers were backing him. Then he was gone. Since then he has gotten 13 more alerts which are presumably further discussion on the subject but neither of us have access to the thread so we have no idea what's been going on in there since he made that post asking Unity for their help. He asked for help, they banned him for it and we have no idea what's been happening there since. If you can get to the thread you will know more than we do. Good luck with that! ;)

    Anyway, that's all ancient history. The Asset Store was fantastic for visibility but it pretty much sucked in every other way. Sure, the eyeballs will be missed but apart from that, meh... Honestly, from our end this whole debacle just caused us a lot of work to get you guys back the stuff you already paid for on the Asset Store. I don't know if anyone here actually knows that Unity is now denying everyone access to everything they ever bought from us. You paid for it but cannot download it. Isn't that nice of them?

    We could have said "Not our problem. Take it up with Unity" but instead we have been working towards getting you guys access to what you paid for. Apart from working on protecting what's yours, being off the store has been no sweat off anyone's backs over here. We just miss the eyeballs so if you guys won't mind giving us a shout out on social media from time to time that would be great! Thanks! :D

    That's it from me !
    Peace out!
     
    Last edited: Dec 10, 2018
  35. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    @dittt
    I see you created an account but you never completed the signup process. You should have received an account creation email explaining the last step to prove you are human. You have not completed that step. Not to worry about that, though. MrDude is the one deleting bot accounts and was the one who ported the reviews over to the website ... meaning he remembers struggling to match your review to your username until he discovered you have one extra "t" in your username on our site. Thus, you are remembered and we know you are human so we will not delete your account! :)

    Please log in and then claim your products so that you can download it from our site in future. I see you created the account but haven't claimed any assets as yet. Please do. :)

    @ everyone else
    As I mentioned above, MrDude migrated the reviews from the Asset Store to our website. In order to do so he created accounts for a couple of users who haven't yet done so themselves. Generated accounts are clearly marked as such. If you intend to create an account on our site and find that your username is not being accepted, before you choose another one, just check to see if your account isn't already created. If so just contact us to claim ownership thereof and then you can remove the "this user was generated [bla bla bla]" message and use the account as normal.

    To check, just use the username you use(d) on the Asset Store when you left the review and go here (replacing 'myusername' with your username):
    http://www.mybadstudios.com/myprofile/?username=myusername
     
  36. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    Oh I see.
    When I registered at your site with this nickname, activation email didn't come to my hotmail account, so I used another email to register while this nickname was taken. That's why the extra 't' is added.:)

    Congratulations to the myBadStudios 2.0!

    But I have a problem with login now with these messases.

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'set_wuss_logged_in_cookie' not found or invalid function name in /homepages/34/d721980664/htdocs/mybadstudios.com/wp-includes/class-wp-hook.php on line 288

    Warning: Cannot modify header information - headers already sent by (output started at /homepages/34/d721980664/htdocs/mybadstudios.com/wp-includes/class-wp-hook.php:288) in /homepages/34/d721980664/htdocs/mybadstudios.com/wp-includes/pluggable.php on line 920

    Warning: Cannot modify header information - headers already sent by (output started at /homepages/34/d721980664/htdocs/mybadstudios.com/wp-includes/class-wp-hook.php:288) in /homepages/34/d721980664/htdocs/mybadstudios.com/wp-includes/pluggable.php on line 921

    Warning: Cannot modify header information - headers already sent by (output started at /homepages/34/d721980664/htdocs/mybadstudios.com/wp-includes/class-wp-hook.php:288) in /homepages/34/d721980664/htdocs/mybadstudios.com/wp-includes/pluggable.php on line 922



    One more word.

    Login button (upper right on the main page) is not shown in my chrome browser. In edge no problem.


     
    Last edited: Nov 25, 2018
  37. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Thanks for the feedback. We removed all of our WordPress plugins from the site yesterday and replaced it with the new combined Unity For WordPress plugin. One of the scripts in it had a space before the opening <?php tag and thus caused the headers issue. It was sorted out within 10 minutes. You must have accessed the site at exactly the wrong time :p

    As for the missing button... that is something we need to implement a fix for still. the problem is not with the browser but with our responsive code. The button disappears when your browser is at a specific width. Make it wider or smaller and the button returns. We've been trying to fix that but failed thus far. :( Still working on it.
     
    Last edited: Dec 10, 2018
  38. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Today is the last day of the half price sale. The new look website is finally done with the cosmetic makeover and will now just receive new features moving forward.

    Site awards are already active, free advertising for people who release(d) projects that use any of our kits is next on the to-do list so if you want in on that let us know and also, myBad Studios finally has a blog :p After all these years of running a WordPress site it finally has a blog! :p

    http://www.mybadstudios.com/blog/
    The latest entry tells you how to get your hands in the pot for over $300,000 worth of Unity assets that will be given away for free over the course of December, $3,000 worth coming from us! Be sure to check it out :)

    Annotation 2018-11-30 045410.jpg
     
    obstudio likes this.
  39. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Good news all. It only took Unity 7 weeks (and enough complaints from enough of you) to finally fix their mistake (yes, yes, i know they don't make any so call it whatever you want, they fixed it)

    You are now able to download the outdated versions of the assets from the Asset Store again. This means all those people who had lost everything they bought, they now have it back again! Good news for all of you! :D It's now showing up as deprecated rather than just not showing up or giving you an error when you try to download it.

    This means signing up on mybadstudios.com is optional now and only required if you want updates and access to the new features. Also, be aware that MBSCore on the Asset Store is broken. Do NOT download the latest version from there. Unity refused to let us fix it and closed down the entire store instead of accepting the bug fix. Everything else is fine, though.

    For updates, new features and new assets, come to the website. To continue using the "then-current" versions of everything, you can download that from the Asset Store.
     
    Last edited: Dec 10, 2018
  40. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44


    Congrats to all the winners!
     
  41. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,334
    Offtopic chatter does apply to topic authors in their own thread. If you want to criticise Unity, it's welcome and allowed but do it in general discussion, not the assets forum. It's not optional - this is so the focus is on assets. Thanks everyone.
     
  42. dittt

    dittt

    Joined:
    May 29, 2013
    Posts:
    20
    Hi Magasenakwa,

    I read your reply above before you edited it, but couldn't post reply at that time. I remember you mentioned real time database with wordpress and wanted to say it sounded very interesting!:D
    Keep going!
     
    Last edited: Dec 27, 2018
    Magasenakwa likes this.
  43. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Last edited: Mar 10, 2019
  44. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Has anyone used the Wordpress Money asset? I am curious how exactly this integrates Unity and Woocommerce. For example, lets say I have some in game equipment that can be purchased as Woocommerce products. So can the player only purchase these products on the Wordpress website or is there a way they can purchase directly from inside the Unity game? Also, once the product is bought, how does it then become available to the player inside Unity?
     
  45. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Hi Hamesh

    WordPress Money has a hook into the WooCommerce transaction completed callback so whenever the transaction is complete you can call any custom code you want to run. You will receive the item and quantity bought as part of the parameters passed to that function.

    Out of the box WordPress Money has support for virtual currency only. Each time you buy currency and the transaction completes the hook is called to update the user's currency inside the wp_usermeta table. WordPress Login supports fetching currency (well, anaythng inside wp_usermeta, to be precise) during login so as soon as the player has logged in you will immediately have your balance(s). After that WordPress Money gives you functions to spend or gain currency directly from within Unity.

    If you have the requried PHP skills you could also make your website give sutomers currency by updating the wp_usermeta table whenver you deem it appropriate (first visit for the day/ liking your page/ clickingon "get money" ;) ). Next time the game asks for the currect balance it will obtain the current balance irrespective of what updated it...

    WordPress serials comes with a custom function to call during that hook also, extending WordPress Money to now support game sales. You could write as many of these custom functions to support as many types of items as you want. In this case, when the trtansaction completes it creates an instance of the serials object and then tells it "Register a serial for this game to this customer" and thus automatically linking a customer to a serial inside the custom built serials table.

    Whenever they start a game with WordPress Serials installed, WordPress Login is setup to auto check for serials during login and WordPress Serials then includes function to interact with the serials online (try to register one if the user supplies one, fetch it, test if the game should continue or halt if not found etc).

    One kit uses the native usermeta table, the other a custom table. One just writes directly to it via the included WP functions, the other calls a custom class to do it. How the transaction is finialized depends on each individual item type being sold but at the end of the day it boils down to this: Save the data somewhere in the database and later, inside Unity (or on the website), just ask the database to return that data. This way it doesn't matter if the data is stored via the website or Unity, both of them have access to the same end result be it a new addition or an update of an existing item.

    WordPress myCustom demonstrates how to customize this system for your own custom needs. It does this by demoing how to create a game subscription service. If you want to use WordPress Money to sell potions or collectables or whatever else you just need to decide for yourself "How do I want to store these items in the database?" and then write the code to store the data there/that way and then to fetch it back. (WordPress myCustom demonstrates this but it is explained on the website also)

    For example, you COULD just update the wp_usermeta table (super easy to do and then WordPress Login can fetch specific items automatically during login... but it's not practical for all cases) OR you could create a custom table in your database and store your data to there.
    If you have WordPress Data installed then it's even simpler! Just use THAT to keep track of your items! It's what it was built for, after all ;)

    If this all sounds very complicated, allow me me dumb it down a tad to exactly how simple this really is:
    1. When someone buys something (in the game or via WooCommerce), save the result of that transaction to a table in the database
    2. When you want to use that item/ see it inside the game/website, simply fetch the data back from where you saved it to

    Essentially, that's all there is to it... Doesn't matter how the data gets saved to the database (via plugins or games), anything that fetches that data back again will receive the same data.

    Best advice I can give you is to download the free WordPress myCustom asset and see for yourself exactly how little work it is to create a new item type to sell via WooCommerce. The code is kept to a bare minimum so it's easy to follow along and since it's all so compartamentalized it means you can easily copy paste most of it to create your custom behaviour.

    Play with that for about 30 minutes and it should all make perfect sense. The demo there shows you how to sell a subscription using Woo and then checks the results inside Unity. To customize it for an inventory (for example), just change where the item is saved to and fetched back from... Example, save it to "ITEM_{$item_name}" and when you fetch it back just use
    Code (csharp):
    1. $items = $wpdb->query("SELECT * FROM $wpdb->usermeta WHERE meta_key LIKE 'ITEM_%'");
    Job done!

    If you run into problems, just contact customer support via email and we'll be glad to help you out!
     
    Last edited: Apr 15, 2019
    Hamesh81 likes this.
  46. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    !!! WARNING TO ALL OLD CUSTOMERS !!!

    Unity is discontinuing version 1 of the Asset Store. If you check your invoice numbers in the store you will notice that the new store only lists your invoice numbers starting from a specific date ( I think March 2017 if I recall correctly ) and anythng bought before then, your invoice number is hidden from you. If you go to the old store and check your invioce numbers there you will find your older purchases invoice numbers listed there.

    If you bought something from myBad Studios on the Asset Store and want to continue receiving updates and support via our website you will need your invoice numbers for the products you bought in order to qualify for support. If you don't have it then you will need to buy the asset again on our site so you can get a new invoice number. As such, if you haven't done so yet I would highly recommend you go to the old store and take a screenshot of all your older purchases so you have a record of all your invoice numbers for future record. Our products and others. Play it safe and keep your invoice numbers safe!

    If you do NOT store your invoice number and Unity closes the old store, hiding your invoice numbers from you, our hands will be tied at that point and you will need to buy the assets again in order to continue receiving updates.

    So please get your invoice numbers while you still can and register your products with us before it's too late..!
    Thanks
     
  47. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Hamesh81 likes this.
  48. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Magasenakwa
    Thank you @Magasenakwa , does the Wordpress Money asset have a demo showing the woocommerce purchasing working from inside Unity? Also does it have a way of displaying the woocommerce products that the player has already purchased? This would be a very useful example for me to see.
     
  49. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Hi @Hameshi81

    As stated above, WordPress Money as a standalone asset includes support for virtual currency only and DOES come with functions for manipulating currency from within Unity, yes. You are able to fetch currency during login using WordPress Login but you can also fetch thebalance at any time using the included functions.

    In fact, since one user could be playing the game on multiple devices at the same time and might try to game the system by starting the game with a million gold, buying stuff for 900,000 gold on one device, getting the stuff added to his inventory and then buying something for 1 gold on the other device in the hopes that his balance will then be 999,999 even thoughall the bought items are now stored to his inventory, WordPress Money does payments server side to prevent this.

    Inside Unity you say "Dos he have enough cash to buy this sword? Yes? okay, well then do the purchase". On the server side the kit checks to make sure he REALLY has enough and that the games aren't out of sync due to cheating (modding the binary or just playing on two devices). If the cash is enough then the amountis deducted and you are given the go ahead to update his inventory however you deem fit but whether he had enough cash or not, the kit always returns the current balance after every transaction so you can display whatever value is returned with confidence, knowing it the the true and accurate balance. They are free to try and game the system but on the WordPress plugin end they are blocked from doing so.

    Now, as for seeing what items they bought... That is another story. It surrports currency and the currency balances are visible, yes. If you buy WordPress Serialsthen it supports serials and you can see if he has a serial, yes. To buy custom items you need to write a custom function to do that. Can you see what items they bought via your custom function? that depends entirely on whether or not you choose to let them...only you will know the answer to that question.

    As part of the WordPress for Unity combined asset customers get a customized version of Unity's shooter demo. This game includes all the WordPress assets integratetd into it, including WordPress money for the weapons shop. In this demo weapons start with a level of 0 to indicate you don't have it and once bought your level is stored using WordPress Data. Each time you buy ammo the quantity is stored using WordPress Data also. Thus, each time you play the game your unlocked weapons, how many times you've upgraded their level and how many ammo youhave for each of them, all that is fetched and displayed inside the store.

    This is an example of how this custom store was implemented. How you choose to do yours is 100% up to you. In the following post I'll post a code sample of how you could do what you asked (untested code but it should work and should give you a good idea of the process)
     
  50. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    44
    Inside WordPress myCustom's unity_functions.php
    Code (csharp):
    1.  
    2. < ?php
    3. add_action( 'wuss_purchase', 'MyWOOIventoryItem' );
    4. function MyWOOIventoryItem($args) {
    5.    if( $args['type'] != "MYINV") return;
    6.  
    7.    global $wpdb,$current_user;
    8.    $ID = intval($args['uid']);
    9.    $amount = intval($args['qty']);
    10.    $sku = $args['fields'][0];
    11.  
    12.    $items = get_user_meta($current_user->ID, 'MYINVENTORY', true);
    13.    if ($items == '')
    14.    {
    15.        update_user_meta($current_user->ID, 'MYINVENTORY', $sku);
    16.        update_user_meta($current_user->ID, $sku, $amount);
    17.        return;
    18.    }
    19.  
    20.    $stock = $amount;
    21.    if (strpos($items, $sku) === false)
    22.    {
    23.        $items .= ",$sku";
    24.        update_user_meta($current_user->ID, 'MYINVENTORY', $items);
    25.    }
    26.    else
    27.    {
    28.        $current = get_user_meta($current_user->ID, $sku, true);
    29.        $stock += $current;
    30.    }
    31.    update_user_meta($current_user->ID, $sku, $stock);
    32. }
    33.  
    34. function GetPurchasedItems()
    35. {
    36.    global $wpdb, $current_user;
    37.    if (!is_user_logged_in()) return false;
    38.    $items = get_user_meta($current_user->ID, 'MYINVENTORY', true);
    39.    if (trim($items) == '') return false;
    40.    return $items;
    41. }
    42.  
    43. function customGetPurchasedItems()
    44. {
    45.    $items = GetPurchasedItems();
    46.    if ($items === false)
    47.    {
    48.        SendToUnity( PrintError('No items purchased') );
    49.        return;
    50.    }
    51.    $response = SendField('products', $items);
    52.    SendToUnity( $response );
    53. }
    54.  
    55. function customGetInventoryStock()
    56. {
    57.    global $wpdb;
    58.    $products = Posted("inventory");
    59.    if ($products == '')
    60.    {
    61.        SendToUnity( PrintError('No valid items specified') );
    62.        return;
    63.    }
    64.  
    65.    $results = $wpdb->get_results(
    66.    "SELECT meta_key, meta_value
    67.    FROM $wpdb->usermeta
    68.    WHERE user_id = '$current_user->ID'
    69.    AND meta_key IN('$productst')");
    70.  
    71.    if (!$results)
    72.    {
    73.        SendToUnity( PrintError('No valid items specified') );
    74.        return;
    75.    }
    76.  
    77.    $response = '';
    78.    foreach($results as $item) {
    79.        $response .= SendNode('ITEM', "name={$item->meta_key}; qty={$item->meta_value}");
    80.    SendToUnity($response);
    81. }
    82. ?>
    83.  
     
    Last edited: Apr 21, 2019