• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=AtomiCal;45547533][URL="http://docs.unity3d.com/ScriptReference/PlayerPrefs.html"]http://docs.unity3d.com/ScriptReference/PlayerPrefs.html [/URL] Deleting the game will remove the preferences, but updating the game will not.[/QUOTE] Ah, didn't know that, thank you.
[B]So to anyone who was wondering about Bolt.[/B] I recently bought it, about a day ago. I'm following the tutorial, (there's really only one at the moment) and it's covering the basics and fundamentals of Bolt. But through my experience, I'll give the rundown. In it's current stage, I BELIEVE it could make a game (and when I say game, I mean a fully done networked game) however, for beginners like myself, the interface can be a bit intimidating. Such as my problem now, every networking solution I've used in the past uses RPC's to send game events/updates etc. Bolt uses Events, which are quite different. But it seems like you have more control over them. My other problem, which isn't terribly bad, is the documentation for it. Now, fholm has stated that by the middle of August, he will be quitting his job to work full time on Bolt, and it's documentation. (So that's pretty impressive) So, in conclusion, should you buy Bolt? Well, to be honest. It has it's flaws, and bugs. But just using the examples included, and following the tutorial. If you have the $65, get it. Get it now. It's not perfect right now. But there's also a huge update coming pretty soon. And the future of Bolt is looking pretty bright. So I say again, if you've got the cash to spare. Buy it, as it's only gonna go up in price. I'll see if I can post some of my workings on it later.
Is it possible to save variables on a mysql tables using php and then retrieving only some information about the player. Like name , score etc.
[QUOTE=BoowmanTech;45549416]Is it possible to save variables on a mysql tables using php and then retrieving only some information about the player. Like name , score etc.[/QUOTE] yeah, use some php script to get the data and expose it and then you can use the unity WWW class to get the data & then parse it.
been making some assets for a really tiny silent hill type game [unity]https://dl-web.dropbox.com/get/ghostgrill/ghostgrill.unity3d?_subject_uid=127109041&w=AACn9m-mi1cFDLBdnwTdIfPm8vCuL1Zv-PemtjYXDBsJ1A[/unity] it's probably unity101 but how would I go about making her walk while she is in her hitting stance? (hold the spacebar)
[quote]Is it possible to save variables on a mysql tables using php and then retrieving only some information about the player. Like name , score etc.[/quote] [QUOTE=Adam543i;45550758]yeah, use some php script to get the data and expose it and then you can use the unity WWW class to get the data & then parse it.[/QUOTE] Why use php and make a request? Just us C# to get the values from the database
[QUOTE=Arxae;45551580]Why use php and make a request? Just us C# to get the values from the database[/QUOTE] Only if you're writing a C# server. Never do this for clients. Ever.
hey I gotta question So I'm going to make a 3rd person player controller for a cube, I can figure out how to do that nicely myself- however I need help with part2. These 3rd person cuber players need to exist in a multiplayer environment where they can hit eachother with a melee attack and die (also probably very simple, I feel like I can figure this out on my own too), but [I]the key point is:[/I] only some classes can kill another class. For example: Class A can melee whack class B and C and kill them, but class B can only whack A, etc. I don't have much knowledge in coding at all so I don't know where to begin, but I feel like this would be a simple point to start.
[QUOTE=Perl;45551585]Only if you're writing a C# server. Never do this for clients. Ever.[/QUOTE] Good point, was ignoring security for a second here xD
If I save variables through Prefab using PlayerPrefs.SetInt("TEXT",1), and then unlock things using GetInt would it be easy for players to mess the prefab up so they set it to 0 somehow. Something like hacking into it. I want to use this for player customization for a mobile phone and It should only display it one and I don't want them to set it somehow back to 0.
[QUOTE=BoowmanTech;45553140]If I save variables through Prefab using PlayerPrefs.SetInt("TEXT",1), and then unlock things using GetInt would it be easy for players to mess the prefab up so they set it to 0 somehow. Something like hacking into it. I want to use this for player customization for a mobile phone and It should only display it one and I don't want them to set it somehow back to 0.[/QUOTE] "Never trust the client" is a good rule to live by. People will break your game no matter what. If you're running a client - server game then move stuff to the server.
[QUOTE=AtomiCal;45553271]"Never trust the client" is a good rule to live by. People will break your game no matter what. If you're running a client - server game then move stuff to the server.[/QUOTE] It's client based and only my score is kept online. My variables are going to be stored in prefabs, by variables I mean(score,some variables to display certain things once, name) [editline]31st July 2014[/editline] Would it be a good idea to store all the PlayerPrefs in 1 script? Using that 1 script as the main script for them and use that to put update all values in that script when I have to.
Yeah, to reiterate.... If your client directly accesses the database, expect to see your database deleted by some chucklehead, because it WILL happen. Also, if you use PHP to access your data, I highly recommend using prepared statements - they execute faster, and they're safer than SQL escaping strings. Otherwise, again, expect to see your database deleted by some chucklehead embedding a DROP command in the SQL string. Ah, security ;) Anyway, on Bolt... Yeah, when he says "without writing complicated networking code", I'm not sure that's entirely accurate. Bolt does a lot for you, but you are GOING to be writing plenty of code. Plus, you really should have a good understanding of what's going on behind the scenes just so you can have an idea of where things are going wrong when they go wrong. Plus, having all of the things done by Bolt itself makes for somewhat harder debugging sometimes. Otherwise, it's a pretty solid networking engine and definitely MUCH cheaper than uLink.
[QUOTE=BoowmanTech;45553304] Would it be a good idea to store all the PlayerPrefs in 1 script? Using that 1 script as the main script for them and use that to put update all values in that script when I have to.[/QUOTE] Yes, it's a good practice to have a global class which makes the things done. You can create a static class, or use global-access patterns. PS: Singleton is not a global-access pattern :)
[QUOTE=KillaMaaki;45554907]Yeah, to reiterate.... If your client directly accesses the database, expect to see your database deleted by some chucklehead, because it WILL happen. Also, if you use PHP to access your data, I highly recommend using prepared statements - they execute faster, and they're safer than SQL escaping strings. Otherwise, again, expect to see your database deleted by some chucklehead embedding a DROP command in the SQL string. [/QUOTE] I only use the current database to display and insert score and they are escaped
[QUOTE=BoowmanTech;45556318]I only use the current database to display and insert score and they are escaped[/QUOTE] You'd better pass your data to php script that will write data to (or will read it from) database. Give users the way to access your database - kind of bad idea. Even if your database account will only have permissions to write/read - what if someone will spam to your database? Or what if someone will write himself on first place of scoreboard? (or whatever?) Moreover, by using php script you can always update / improve your system without updating clients. And yes, moreover, by using php script you can implement anti-spam and data-filtering which will prevent your database from being spammed by "bad" data.
[QUOTE=BoowmanTech;45556318]I only use the current database to display and insert score and they are escaped[/QUOTE] If you are putting database details in your client, you are practically including a file with login details with your game to that database.
Oh my god, Unity's Navmesh system is a nightmare. I've spent three days on/off trying to get something workable with my current terrain setup. At last, however, I've done it. NPCs that actually move are now possible, which means I can do plenty more with this guy; [img_thumb]https://dl.dropboxusercontent.com/u/107588088/evil_guy.png[/img_thumb]
It may be a bit late for suggestions on it, as you've already put a bit of effort into your project but. If Unity's navmesh doesn't work out, you can try A*, I use it in my projects, and it's quite nice. [URL]http://arongranberg.com/astar/[/URL]
[QUOTE=sarge997;45558188]It may be a bit late for suggestions on it, as you've already put a bit of effort into your project but. If Unity's navmesh doesn't work out, you can try A*, I use it in my projects, and it's quite nice. [URL]http://arongranberg.com/astar/[/URL][/QUOTE] Heh, thanks for the suggestion man, but yeah I'm waaaay burnt out on path finding. I'll think about implementing something else in the future when I'm not sick of it. Mind you, doesn't mean I'm done; need to make a range of different AI behaviours that different NPCs can select between. Things like roaming around, attacking different power lines, destroying the big dome releasing the atmosphere and killing you, that kind of thing.
[QUOTE=date4o;45557224]You'd better pass your data to php script that will write data to (or will read it from) database. Give users the way to access your database - kind of bad idea. Even if your database account will only have permissions to write/read - what if someone will spam to your database? Or what if someone will write himself on first place of scoreboard? (or whatever?) Moreover, by using php script you can always update / improve your system without updating clients. And yes, moreover, by using php script you can implement anti-spam and data-filtering which will prevent your database from being spammed by "bad" data.[/QUOTE] [QUOTE=Skipcast;45557363]If you are putting database details in your client, you are practically including a file with login details with your game to that database.[/QUOTE] I am using php to insert values from the game into the database and retrieve it, the only reason I didn't specified I am using php is because I didn't know you can do it directly into the database without php. [editline]1st August 2014[/editline] Ifbi save values like name and score into PlayerPref would it be easy for someone to break through it?
[QUOTE=BoowmanTech;45558510] Ifbi save values like name and score into PlayerPref would it be easy for someone to break through it?[/QUOTE] Short answer - yes. Long answer - yes, because PlayerPrefs stored on client's device. At windows they (can i say "they" when mean prefs? :o) stored in registry, at Linux in /.config/, at mobile devices they typically stored in game data folder. Anything you can get access to - can be hacked :) By using php you, as i said before, can implement some protection from fake data. [QUOTE=BoowmanTech;45558510]I am using php to insert values from the game into the database and retrieve it, the only reason I didn't specified I am using php is because I didn't know you can do it directly into the database without php.[/QUOTE] Of course you can. There is a mysql-coonector is available for C# - [url]http://dev.mysql.com/doc/connector-net/en/index.html[/url] Using it for writing data from a server-side directly - not so bad idea, because it will be faster then http -> php -> mysql.
OK so if I only want to save values to display a form in game only once what should it be beat to use?
Create a service in php or whatever you want to interface with your database, make endpoints for submitting a score and retrieving scores. In your game, do requests to that service to do your database stuff. As people mentioned, letting the client access the database directly is a security risk
[QUOTE=Arxae;45561047]Create a service in php or whatever you want to interface with your database, make endpoints for submitting a score and retrieving scores. In your game, do requests to that service to do your database stuff. As people mentioned, letting the client access the database directly is a security risk[/QUOTE] The think is the score right now is inserted into the database and retrieved from the database using PHP. But when you play the game for the first time a window will open for character selection and I want to hide that once he clicks submit, and If he clicked submit I want to display a button in the main menu scene. So if PlayerPref is risky for doing the thing with the window should I store like the true/false value into the database and retrieve it and check if it true to display and if false hide? [editline]1st August 2014[/editline] PS: Sorry for being annoying but I don't want to have backdoors into my game or anything like that.
[QUOTE=BoowmanTech;45561070]The think is the score right now is inserted into the database and retrieved from the database using PHP. But when you play the game for the first time a window will open for character selection and I want to hide that once he clicks submit, and If he clicked submit I want to display a button in the main menu scene. So if PlayerPref is risky for doing the thing with the window should I store like the true/false value into the database and retrieve it and check if it true to display and if false hide? [editline]1st August 2014[/editline] PS: Sorry for being annoying but I don't want to have backdoors into my game or anything like that.[/QUOTE] This is very tricky question. Understand me right - if someone really try to hack your game - he will. The best thing you can do: write device UID, Account Name and maybe even IP into your database when player makes request. Then, when someone makes other request you should check - is this UID or Account Name or IP already exists? If exists - then reject request, or even better - wipe user's account or ban him or whatever. Btw if there is few users with same IP they will be fuckd. So, maybe checking IP is not a good idea. From the other side - use of database for this kind of things - stupid. You can use playerprefs for your window, but check request when player sends info about selected character. I think it's a better way.
[QUOTE=date4o;45561187]This is very tricky question. Understand me right - if someone really try to hack your game - he will. The best thing you can do: write device UID, Account Name and maybe even IP into your database when player makes request. Then, when someone makes other request you should check - is this UID or Account Name or IP already exists? If exists - then reject request, or even better - wipe user's account or ban him or whatever. Btw if there is few users with same IP they will be fuckd. So, maybe checking IP is not a good idea. From the other side - use of database for this kind of things - stupid. You can use playerprefs for your window, but check request when player sends info about selected character. I think it's a better way.[/QUOTE] Databases are fine, but for actual automated security you'd probably have to upload and verify replays (since they are more difficult to fake).
[QUOTE=date4o;45561187]This is very tricky question. Understand me right - if someone really try to hack your game - he will. The best thing you can do: write device UID, Account Name and maybe even IP into your database when player makes request. Then, when someone makes other request you should check - is this UID or Account Name or IP already exists? If exists - then reject request, or even better - wipe user's account or ban him or whatever. Btw if there is few users with same IP they will be fuckd. So, maybe checking IP is not a good idea. From the other side - use of database for this kind of things - stupid. You can use playerprefs for your window, but check request when player sends info about selected character. I think it's a better way.[/QUOTE] Honestly I've been trying to get look of other ways to save this but couldn't really find anything, I guess I will stick with the PlayerPrefs for that. Also what do you mean by "when player makes a request"?
[QUOTE=BoowmanTech;45561271]Honestly I've been trying to get look of other ways to save this but couldn't really find anything, I guess I will stick with the PlayerPrefs for that. Also what do you mean by "when player makes a request"?[/QUOTE] Anything that writes data into database is a "player's request". Before your player can start play the game, he must create account, right? So, the creating of account is a request. To create account you should pass username (or device UID), maybe password (or auth can be based just on device UID), character, IP and etc. So, you can show character-selecting window in depends of playerprefs value, but when player selects the character you should send request which will write a data into your database (will create a player's account), to provide correct character when payer next time enter to game, right? And when your php (or whatever you use) received request to create a new account you must check - is this account don't exists? If exists - it's a "fake" request. So, by this way you don't preform useless calls to database (you will open window in depends of playerprefs without any requests to database when player enters into game), but if playerprefs says that player should create account - you anyway check this on serverside. (I hope you understand my broken English. Sorry :) ) [B]--UPDATED--[/B]
[QUOTE=date4o;45561366]Anything that writes data into database is a "player's request". Before your player can start play the game, he must create account, right? So, the creating of account is a request. To create account you should pass username (or device UID), maybe password (or auth can be based just on device UID), character, IP and etc. So, you can show character-selecting window in depends of playerprefs value, but when player selects the character you should send request which will write a data into your database (will create a player's account), to provide correct character when payer next time enter to game, right? And when your php (or whatever you use) received request to create a new account you must check - is this account don't exists? (i explained this kind of protection before)[/QUOTE] Ok, thank you very much.
Sorry, you need to Log In to post a reply to this thread.