Tag Info

Hot answers tagged

2

What you will need to do is replay the entire game on your sever. If you use randomness in your game then store for each player the random see you send them on your server and then have the server play the game to validate that their moves do indeed lead to a victory. This has the advantage that other types of cheating won't work either. If it's multi-player ...


2

You can use websockets to resolve this problem. To be short, a websocket provides a way to exchange messages between several clients and your server. Principles Your websocket application could behave like this : Whenever someone opens your game web page, javascript will open a websocket connection with the server (You don't need any library on the ...


2

Handling negative values There are ways to handle negative values aside from healing the high-defense enemy with your sword strike (which is weird). You could introduce a block mechanic, where if target defense > attack power, the damage is nullified. But this is imbalanced. This might mean you might encounter an opponent who you will never hit. Of ...


1

Actually using the overloaded construct that take a WWWForm as second parameter, WWW class is automatically considered as an http post request. Your code can be something like: WWWForm form = new WWWForm(); form.AddField( "NUMBER", aNumber ); WWW postRequest = new WWW( server_url, form );


1

These things still usually work with SQL. Each saved game state gets a unique ID - usually a long string of hex characters - that identifies the entry in the DB. You then share this string. You could do it without SQL using Mongo or the file system or something, of course. Simpler games can get away with just encoding all of the game state into a string, ...


1

tl;dr The resources should only be controlled by the Server (securely) as a decision making entity; The actual work could be offloaded to Clients and later verified lazily by the Server. Long story: How often you update the resources is up to you, your hardware and desired gameplay experience. I don't see why it requires you to update every second? What ...


1

You will need some client Javascript and run AJAX regularly so you can run server-side PHP and check if there are any battle requests, or during combat turns to check for any player actions.


1

It looks like you might be better off with some formula: // keep the sign separate int sign = enemyLevel > playerLevel ? 1 : -1; // Calculate the xp as 1 xp per 20 level differences // Ensures that no negative xp is given int givenExp = math.min(0, 3 + (sign * math.floor(math.abs(enemyLevel - playerLevel)/20.f))); What this does is clamp each 20 levels ...


1

Neither JS nor PHP are very suitable for what you're trying to do. You can define transparency in PHP (http://www.php.net/manual/en/function.imagecolortransparent.php), but I'm not sure if you can actually read it out. Also understand that PHP is a server side language, so for any real-time interaction of on-screen elements it's not very suitable. You bets ...



Only top voted, non community-wiki answers of a minimum length are eligible