Hot answers tagged

28

What you implemented isn't Perlin noise. I'm not sure why Hugo Elias says it is, but he's confused. Here is Ken Perlin's reference implementation. It doesn't actually call any external random number generator, but uses a built-in hash function to produce the pseudorandom gradient vectors. Note also that Perlin noise consists of just one octave. Summing ...


16

PHP has the advantage that it is very widely supported by cheap webhosters. You can rent some shared-hosting LAMP (Linux, Apache, MySQL, PHP) webspace for peanuts. And that webspace can also host your website and the game client. The setup of most PHP applications is equally easy. Just copy the files to the webserver and you are done. This makes it very easy ...


12

For a real-time game, you want to minimize latency. Here's two tips for achieving it, with notes about PHP and Node: Use WebSockets. They allow fast two-way communication between the server and the client. Using node.js here has the advantage that you can use the same JavaScript API on both ends of the pipe. There's also the wonderful socket.io module for ...


11

That's a common misconception. What Hugo Elias calls "Perlin" noise is in fact fractal, or pink, noise. To better understand what Perlin noise is, you can read Perlin's article linked in Nathan Reed's answer, or libnoise docs (there's the same error there: Perlin noise is what they call Gradient noise), or CoherentNoise docs. Now, to actually answer your ...


8

Ok, currently there's 4 major options for browser based games. Java - Revived mostly due to Minecraft and Android, Java requires a plugin with about 75% market penetration (source). It's also a fairly complicated language that really isn't suited for first time programmers. There's advantages to using it, but it's probably not the best option. Unity - ...


8

One way to do this is not to change the actual values in the database in realtime. When the player logs on, you see how long it's been, and how much stuff he should have if he were earning during the time he was logged off, then update the value accordingly. One benefit of this is that if a player never logs on again, you're not spending server time and ...


6

I first thought I would simply put it in the (MySQL) database Sounds good! but I think it will be too much. Then you don't know the limits yet. Seriously, just throw everything in a database. Don't care about performance too much at this stage, if it becomes an issue you can fix it later. Here's an abstract view of what your database could look like: ...


6

1) giving JS end-users direct access to your terminal is the scariest idea ever, in terms of security, and is 100% impossible without some interfacing server language/framework (php/perl/ruby/c#/python/java/c++/NodeJS), because it is so scary. 2) running exec() on user-input, directly, rather than building an interface in your server language is 100% as ...


6

Several points: You should definitely enable error reporting and error logging into a file on the PHP side, otherwise you'll have no evidence of problems. AJAX errors usually cause little visible error to the user. You should check for errors on the Javascript side too PHP error handling is famous for being both bad (e.g. the default action for most ...


6

I know your question is specifically asking about cron jobs, but I think a lot of web-based mmos are written using "completeTime" logic as opposed to lots of crons. When you start a long-running action, like building a granary that takes 5 hours to complete. The server will just mark the granary's completion time as start time + 5 hours and store that in ...


5

I've recently used both models A and B in two different games. Neptune's Pride and Jupiter Folly. In both games, when two armies meet, they fight until one army remains. In Neptune's Pride, players take turns inflicting damage on one another until one of the armies is dead. In Jupiter's Folly, the strength of the armies is simply compared and some die ...


5

As to but what would the method be when the player logged in and you needed to get their inventory etc You need to look at Managing Sessions and State with PHP or PHP Session Management With Cookies. In general when the player logs in you'll query the database for all the information needed to hydrate the objects associated with the player, such as ...


5

Although I'm not PHP fan, I don't think it's a problem of the language, 300,000 rows in a database is not that big (I worked with much more). Your problem is most likly in the code-> algorithms you use.. As a side note.. 1000 lines of code for just fight logic? How maintainable is that? It's ok that you know what's going on in there right now, but will ...


5

For peer-to-peer communication between web browsers, WebRTC is likely the best option available. But keep in mind that it is not universally supported yet. Also keep in mind that while you might save traffic on the server this way, the perceived performance for your clients might be far worse, because consumer-grade internet connections will likely have far ...


5

A rule of thumb is that you use different classes when objects require different code and instances of the same class when the objects only require different values. So when ShortBow, HuntingBow, CompositeBow, ElvenBow etc. all behave identical except for having different stats, then they would all be instances of the same class. When bows have different ...


5

Introduction There are pros and cons to each method of synchronization you gave that depend on a couple of factors. First, is your game singleplayer or multiplayer, second, how real-time is your game? If your game is only single player, you may want to consider having a client side only game which would make things simpler. However, assuming you need a ...


5

Token and App side So to do this you will need to get the the relevant Access Token from facebook: User Access Token if you want to post things on their behalf and access information about them. App Access Token if you want to change app settings You can read about it here but from what you have said you will probably want the User Access token. After ...


5

The other answers are correct, but there's a historical factor that hasn't been mentioned. When I started to search for do and donts and tips I realized that a lot of projects use PHP and I have actually not found any PBBG using C# which I find really strange. Until a couple years ago, there was a PBBG development community that mostly existed on two ...


4

You're probably going to have to break down what kind of rules you guys have created in the past and just let the computer pick one at random and fill in the specific details. As far as your high level goals this isn't going to make it really "funny" since you'll know all the possible outcomes, but it will make the game possible. So for example, the "lay a ...


4

Better? Probably, but at what cost? PHP has a truly fully-featured string API which will come in handy as soon as you do just about anything with text. C# has native code and some added speed at the cost of having to use an awful API and the JIT compilation on first launch makes testing painful. Python has a rather uncomfortable reference system so copying ...


4

As the others already mentioned....300k of rows from a database and 1k lines of code shouldn't really be that huge of a problem for the memory. Although if you load all 300k rows into memory at once (depending on how much data is in each row) that COULD pose a problem. Another possibility would be memory leaks especially as the phenomenon that you write ...


4

ZorbaTHut's answer is probably what you seek, but nevertheless I'd like to enhance it a bit. Jessica Hische's "Inspiration vs. Imitation" Something that I sadly hear too much is that “it’s not illegal to copy someone’s style”. Sure, if you create an illustration that is completely derivative of someone else but not a direct rip-off or tracing, they might ...


4

I recently created a test program for an algorithm I found. It works on the premise of: I'm an evil overlord and I want more space. Basically the room is seems to be built out of necessity rather than uniformly with corridors. The stages are as follows. Fill the whole map with solid earth Dig out a single room in the centre of the map Pick a wall of ...


4

There is one thing that bothered me about your question: "..But the only programming language I know is Java." So learn another one! Anyway, Java as a client in the browser fails on many, many fronts. For one, Java 7 (and most likely Java 8) doesn't even work in Chrome on Mac OS X because the Java people decided to stop supporting 32-bit, and Chrome is ...


4

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 seed 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-...


4

Card and Slot concepts should not be mixed. They're not the same. My behind is not fused with the chair on which I'm sitting. This allows me to play musical chairs. Let's organize your data: // A card; belongs to a player, has abilities (among which we find 'CanJump') Card Owner : Player // Blue or red CanJump : bool // Tells if the card can jump two ...


3

When you watch a race, it unfolds sequentially, until by the end there is a history of that race that you could tell someone as a story. Some research like watching races with your buddies might show off what the most exciting parts are, or how the story tends to divide itself up. In the "race" part of the game, you could randomise a story like this, having ...


3

I don't have the exact answers you're looking for, but I'll just lay some options out there. I'm biased, but I would say that you definitely want an ORM instead of dealing with SQL directly. If you're into the whole OOP thing, then an ORM gives you an object-oriented view of your data, which is usually more helpful than manually pulling data out of rows ...


3

Similar to what Tetrad has said, the rules will likely have to be pre-defined. However, you can go a step further and break the rules into parts which can be combined to form new rules. For example, you can have a rule grid like the following, where you select one item from each column to form a rule: Of course you can adapt this to whatever rules you've ...


3

If you're using MySQL as your persistence layer, I don't see any reason why you wouldn't keep your combat logs there. The amount of sense that your listed options make goes about like this: Array: 0% (array in what? "array" is a data structure, not a persistence mechanism) XML file: 50% JSON file: 30% Log file: 20% (have fun finding the records you want ...


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