Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Zeggy

Pages: [1] 2 3 ... 47
1
Coding Discussion / Re: Generate a Map with a seed
« on: October 02, 2011, 11:24:38 AM »
The seed is just used for random number generating.

When you use the same seed for your random number generator, it will always produce the same sequence of 'random' numbers.

So, if you have an algorithm for generating a map and pass the same seed to your rng, it will have the same result.

In PHP, you can use the srand function to seed the rand function: http://php.net/manual/en/function.srand.php

2
Game Management / Logging
« on: September 09, 2011, 06:11:23 AM »
What does everybody use for logging?

I want to share a logging service that I am using because it's just so great.

I use loggly: http://www.loggly.com

You can send individual logs via http post (or with their client libraries), or you can have your syslog automatically send everything over.

What's really great about it is that you can search through log events, graph them, compare them, etc very quickly and easily. There is also an API so you can have filtered logs on your own site so you can keep track of suspicious or emergency events.

3
Game Management / Economy analysis
« on: August 26, 2011, 06:55:48 PM »
I remember seeing this kind of site before, but I forgot the url.

Does anybody know of a website service that you can connect with your game, which will analyze currency sinks and incomes, and other economy related stuff?

I think the one I saw was a service of a micro payment processor.

4
Game Design / Re: Database of all games mechanics
« on: August 26, 2011, 10:02:26 AM »
Maybe this will give some ideas: http://i.imgur.com/MbDmL.jpg

5
Coding Discussion / Re: Skill check (with varied degree of success)
« on: July 09, 2011, 04:41:51 AM »
Well then, attempt number 2 :P

Create a table with the following columns:
skill (primary), chance0, chance1.. to chance5 (all ints with range 0 to 100)

The chance0..chance5 columns are the percentage chance out of 100 of getting that skill gain at that skill level.

Example data (from your post):
1, 30, 60, 10, 0, 0, 0
20, 20, 40, 40, 0, 0, 0
100, 20, 10, 40, 30, 0, 0
1000, 20, 0, 10, 30, 35, 5

Code:
//Select the first entry with skill below the player's skill (so 200 skill would select the row with 100 skill)
$chances mysql_fetch_row(mysql_query('SELECT * FROM skill_chances WHERE skill < ' $player_skill_level ' ORDER BY skill DESC LIMIT 1'));

$random rand(0100); //generate random number
$statgain 0;
$current_chance 0;

for (
$i 1$i 6$i++) {
  
$current_chance += $chances[$i];

  
//test random number against the chance of each skill gain
  
if ($random $current_chance) {
    
$statgain $i 1;
    break;
  }
}


Basically it just uses the data in your post above from a database table (but you could put it in a 2d array of course) and calculates the skill gain with a random number.

6
Coding Discussion / Re: Skill check (with varied degree of success)
« on: July 08, 2011, 05:27:51 PM »
Okay, here's my attempt:

First, we need a function to normalize the skill level.
Your mapping of skill level (1-5000) to skill gains (1-5) isn't uniform and is difficult to work with, so I found that log base 3 of the skill level works quite well. This gives a resulting range for normalized(skill level) of:
x -> log(x)/log(3)
1 -> 0.91
20 -> 2.72
50 -> 3.56
1000 -> 6.28
5000 -> 7.75

Second, we calculate the result of +0, +1, etc.
I used a sigmoid function for this (http://en.wikipedia.org/wiki/Sigmoid_function/), but any function will work as long as the y range is between 0 and 5, and the x axis is enough for the normalized skill level.

Here is the full function I used: (1/(1+e^(-x+4)*2))*5
It's adjusted a bit:
The +4 moves the graph right, so a player with skill level 1 starts off with 0 chance of getting +1 (I'm assuming here, maybe you don't want this in your game, I'll explain how to change this below).
The *2 makes the graph a bit less steep, so the gains with higher skill level are more gradual.
The *5 makes sure the y axis ranges from 0-5 (the return value).

You can adjust the +4 and *2 to change the chances of the results.
Increasing the +4 will reduce the chance of higher results.
Increasing the *2 will reduce the increase in chance as skill level goes higher.

Here's what the function looks like: http://i.imgur.com/Gnsd5.png
X axis being the normalized skill level, and y axis the skill gain of 0 to 5.

Putting these two parts together to generate a +0..5 value:
Calculate a random number between 1 and the user's current skill level.
Calculate normalized(random number) using the function in part 1.
Calculate the result of the function in part 2 to get a value between 0 and 5 (the value is a float).

After this, it's up to you how to interpret the results. If it's possible for a skill level 1 user to always get +0, then round to the nearest number. Otherwise, you could round up, then a player with skill level 1 will always get +1.


Example code (not tested):
Code: [Select]
function testSkill($skill_level) {
  $random = rand(1, $skill_level); //generate random number up to skill level
  $x = log($random, 3); //normalize the random value
  return (1/(1+exp(-$x+4)*2))*5; //calculate skill gain
}

$result = testSkill($x);

$gain = ceil($result);
//Or $gain = round($result);


Some data:
http://i.imgur.com/xn6T2.png

Then depending on how you round the result, that gives the possible range of stat gains for a player at that skill level.

7
Coding Discussion / Re: Selecting best items
« on: July 08, 2011, 04:17:15 PM »
Wouldn't you just use the built-in php sorting methods? http://php.net/manual/en/array.sorting.php

8
Coding Discussion / Re: Selecting best items
« on: July 08, 2011, 03:06:28 PM »
The kind of info you are trying to get just requires sorted data...

So you could either sort it in the query or sort it with php. Either way, once the data is sorted, you should be able to use $swords[0] for best sword, or sum $swords[0..4] for the total sum of the best 5 swords, etc..

9
Revenue & Promotion / Re: V3RTEX Gaming
« on: July 01, 2011, 02:38:25 PM »
Sounds like a cool idea, but most of the analytics stuff is already possible with normal analytics software.

Tracking cheaters across all games sounds pretty good though, and tracking the economy and spending/earning also sounds good.

I suggest you get a professional design for the website.

10
Coding Discussion / Re: Event notifications (multilanguage)
« on: June 16, 2011, 03:37:41 AM »
Dump the single string, and translate after you get it out of the database?

11
Coding Discussion / Re: Good coding practices
« on: June 12, 2011, 05:31:43 AM »
If you're going to auto-commit every x hours, you might as well use a backup tool and not git, since you are not using git the way it should be used. You're just creating copies of your working code.

Quote
You just commit bits and pieces of your code? I always commit all of my changes when I do a commit. If I have worked with 20 files, I commit the changes in all 20 files.
Yes, you separate your commits into distinct bits of which files you've changed for a particular feature. That's what the staging area is for. Otherwise you might as well use svn.


Quote
I made some really stupid mistake on my code, and wanted to go back to the last known working state. Well according to git, I hadn't remembered to commit in five days. So instead of attempting to work my way out of the mess. I threw away five days of work. Now I'll lose at most 12hrs, if I do something stupid again.
You should be making commits all the time. Forgetting to commit in 5 days is bad practice, version control should be well integrated into your coding process. You don't always need to commit only after a big feature is done. Make commits all the time, even for small stuff.

12
Coding Discussion / Re: Chat Polling Time
« on: March 16, 2011, 11:48:22 AM »
What about players that are using the chat for a long time? Eventually they'll just see their chat slowing down and finally stop updating even if they're not idle.

I'd rather do something like a chat timeout, where if the user hasn't typed or moved the mouse for > xx minutes, stop polling the chat. Then show a button that the user can press to reconnect to the chat.

13
Coding Discussion / Re: Game Code Structure?
« on: March 14, 2011, 06:05:21 PM »
Your includes are being repeated in every file (which isn't really a big deal, I know).

In my OO approach, I have the same kind of stuff in the constructor of the page object, so simply instantiating the class would automatically check for user authentication, session data, form data, prepare templating, etc. It's all subclassed so I can have public pages that don't bother checking for user authentication, or simple pages that don't require form processing.
So that is one way that using an object for individual pages can be handy.

14
General Chat & Entertainment / Re: Departure
« on: March 14, 2011, 03:26:06 PM »
You forgot to leave your email address.

15
Coding Discussion / Re: Game Code Structure?
« on: March 14, 2011, 07:13:34 AM »
I have a class for each page, and a url router that assigns URLs to a class.
The database is also handled like objects, where I have a Player class, Weapon class, etc.

Quote
ruby on rails and it's overly OOP approach
Well, everything in ruby is OOP, so of course the web frameworks will be OOP too!

16
I'd go with just one table with id, user id, message, and channel.

Have you considered maybe using a memory table or memcache?

For my own chat, I also use this idea of multiple channels. I use javascript push to push chat messages directly from user to users. The chat messages are not stored on my server at all.

You could use a javascript push service like http://www.pubnub.com/ for this. Although, for this particular use, I wouldn't recommend pubnub. Their pricing model doesn't encourage  mass broadcast apps. There are many other javascript push services though.

17
Revenue & Promotion / Re: Facebook monetarisation restrictions
« on: March 09, 2011, 04:03:45 PM »
Quote
I highly doubt that the FBcredits give you SMS payment for 30%.
Payment method is completely hidden to you because the user buys credits from facebook, not you. You get paid per credit spent on your game, not how many credits the user has bought. When a user spends credits on your game, those credits get transferred to your app, and then you can redeem your app's credits for payout.

Quote
I thought it is perfectly possible right now?
Nope, only canvas iframe apps can use the credits api.

I'm sure eventually facebook will open up the api to outside sources though.

18
Revenue & Promotion / Re: Facebook monetarisation restrictions
« on: March 07, 2011, 01:32:06 PM »
Basically, you are allowed to let users buy gold, credits, tokens, etc., any 'currency' you want, but they must buy it with facebook credits. They just mean that you don't need to call your premium currency 'credits' or 'facebook credits'.

Facebook credits are mandatory in the sense of a payment method, but not as a currency. It's your choice if you want to go with 'use facebook credits to upgrade your castle' or 'exchange/buy <premium currency> using facebook credits!'.

19
Revenue & Promotion / Re: Facebook monetarisation restrictions
« on: March 07, 2011, 12:10:33 PM »
I'm pretty sure facebook credits will be mandatory AND exclusive.

http://www.insidefacebook.com/2011/01/24/facebook-sets-july-1-2011-deadline-to-make-credits-sole-canvas-game-payment-option/

That's why it's such a big problem for game developers because facebook will start taking 30% from all sales.


Chris: If you only use facebook connect, then your game isn't hosted on the facebook platform and you can use whatever payment options you want.

20
I don't use mysql, but I do use transactions, yes.

21
Game Management / Re: To ban or not to ban....
« on: February 07, 2011, 07:44:58 AM »
Put him in a special category of users that are not allowed to socially interact with other players - mail, forum, chat etc are disabled/restricted.

This lets you give them the chance to play the game in case they actually want to play, but also stops any abuse between that player and other players.

22
Coding Discussion / Guide to Database Performance
« on: January 29, 2011, 03:08:09 PM »
Here's a free online guide to using database indexes: http://sql-performance-explained.com/

You can also download it as an e-book :)

23
Coding Discussion / Think you know javascript?
« on: January 22, 2011, 11:14:05 AM »
Do you recognize these?

Code: [Select]
($=[$=[]][(__=!$+$)[_=-~-~-~$]+({}+$)[_/_]+
($$=($_=!''+$)[_/_]+$_[+$])])()[__[_/_]+__
[_+~$]+$_[_]+$$]("hi!")

Code: [Select]
([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]])([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])+[])[+[]]+(![]+[])[+[]])[+[]])
Code: [Select]
゚ω゚ノ= /`m)ノ ~┻━┻   //*∇`*/ ['_']; o=(゚ー゚)  =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + ((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚o゚]) (゚Θ゚)) ('_')
Javascript is crazy :D

Edit: they are all equivalent to alert("hi!");

24
Coding Discussion / Re: [MySQL] TEXT
« on: January 20, 2011, 06:33:24 PM »
I found this table comparing storage engines, maybe others will find it interesting too: http://i.imgur.com/Tb9DL.png

25
Code Help / Re: Preventing Double Post
« on: January 19, 2011, 10:48:28 AM »

Pages: [1] 2 3 ... 47

SimplePortal 2.3.3 © 2008-2010, SimplePortal