Jump to content

  • Log In with Google      Sign In   
  • Create Account

zoneweb

Member Since 08 Mar 2012
Offline Last Active May 23 2013 12:54 AM

#4925771 Ticks in PHP Games

Posted by zoneweb on 27 March 2012 - 12:48 PM

What bothers me is that, one of the core features of the game will be trade, and with that you need a market place with lists of buy and sell orders. These will need to be kept up to date and every time the user visits the 'market.php' page it will have to do a search query and update it accordingly. I'm worried this could take very long and by the time the user chooses to buy or sell something, the data has changed and they'll get the wrong order when they submit.

You need to queue the orders and process them one at a time. Read from the database only if the values have been changed. Otherwise, display it from the cache like what you've said.


#4925765 how much faster si udp

Posted by zoneweb on 27 March 2012 - 12:36 PM

If there is no packet loss, then TCP and UDP are exactly the same speed.


Even if there's no packet loss, TCP requires the receiver to send acknowledgements of received data.


#4924397 Java or C++?

Posted by zoneweb on 22 March 2012 - 12:18 PM

Try to stick with facts, rather than opinions.

Posted Image

Consider virtual machines, if you look back a few years and see the performance difference between what they were then and where they are now - you will see that most of the "performance issues" are actually implementation issues.

It's so easy to blame everything on implemention. It's a catch-all phrase for defending anything that's wrong with a particular tool. One could argue that the performance issues of C/C++ is related to implementation too. If the compilers were made better, C/C++ would always be extremely far ahead of Java in performance.

Java's main performance pitfall is the memory structure - it suffers because it doesn't allow explicit value objects and AFAIK little or no memory layout optimisations are done automatically. This is where 95%+ of modern performance issues are - memory layout problems causing the busy loops to fall outside the cache.

Regardless of whether or not the percentage is correct, you've admitted yourself that Java is an inadequate language, performance-wise.

And of course if you allow C or C++ that, then surely you must allow Java, C# or even Javascript the same, and you are back to where you started.

However unless you are in the business of writing operating systems I don't see any relevance of this line of reasoning.

There's a huge difference between a little abstraction and 100% abstraction. And if Java is so good, it would've been used for coding commercial operating systems


#4924384 AI for simple Bomberman game

Posted by zoneweb on 22 March 2012 - 11:31 AM

You could try one or more of the following:

1) Check the distance of the player to the bot. If the player is too close to the bot, the bot should avoid placing bombs and focus on running away.
2) Use the pathfinding algorithm (A*). If there isn't a path of escape to safety, don't put the bomb. If a path leads to a dead end, the bot should avoid it.
3) Make the map bot-friendly. Add hidden triggers or location markers on the map to make it an ideal bomb site.


#4923994 2d game depth?

Posted by zoneweb on 21 March 2012 - 10:49 AM

You haven't mentioned what graphics API you're using, but the principle is the same regardless: sort all your sprites by the order of their appearance before drawing them or draw each sprite into a separate graphics layer then draw all the layers in order onto to the main screen.


#4922017 Whats wrong with java?

Posted by zoneweb on 14 March 2012 - 11:33 AM

Slow compared to what? C++, C, Assembly? The JVM has come an awful long way in its 15+ years. And of course there are multiple vendors of JVMs now, all with different performance properties.

Minecraft is written in Java, and while it might not be that much to look at, a whole mass of computations are going on under the hood.

If it was fast, then the graphics could've been done better. Java is not good for gaming unless you're content with not going beyond subpar 3D graphics. Yes, there are commercial games made with Java, but they're only a few in number (at least on PCs). That's a telling sign that it's not meant for heavy duty games.

Not so much -- There's a native code SDK available too, which I'd make an educated guess is the preferred environment for pro game developers, for portability between PC and iOS if nothing else.

Programs written with the native code SDK still require a VM (for the Android OS at least), which defeats the purpose of writing in native code.

A simple, self-contained library that doesn't do what you want isn't very helpful, regardless of how well its documented or clear the code is.

Multiple libraries that aren't well documented aren't very useful either. Many functions and classes are often so interlinked and esoteric that examples are required to know the proper use of them.

C++ simply doesn't make any over-reaching attempts to protect you from yourself. Java and many other modern, RAD-oriented languages have extensive guardrails in place, while C++ is happy to let you walk off the end of the pier; however, that does't change the fact that good design is required regardless of language or programming paradigm.

So the best languages are the ones that act like nannies? I see that cognitive laziness and impulsiveness, but I agree with your point.

Again, there's something to be said for simplicity, and I actually have a lot more respect for JavaScript than your average Joe -- but its hardly a panacea of simplicity. Javascript performance varies greatly between browsers, as does the feature-set needed to do anything interesting with games. Performance swings from one extreme to the other between even versions of the same browser.


Though JS code is prone to hanging up because of bad loops or whatnot, it won't crash in the way that compiled programs do. With the recent addition of the canvas element, making games with decent 2D graphics is possible. It's a good alternative to flash, which has even worse performance issues.


#4921706 Whats wrong with java?

Posted by zoneweb on 13 March 2012 - 11:58 AM

It's slow and not very good for game development on PCs, but on some smart phones (e.g., Android-based phones) it's the language used for coding games. IMO, neither Java nor C++ is noob-friendly due to their myriad frameworks and libraries, lack of documentation, and intentional obfuscation. Other languages have similiar problems that make it difficult for new programmers. C++ does have its drawbacks, but nobody forcing the programmer to make things more difficult than it needs to be. It's the design and not the language that is the main issue.

If you want to start simple, I recommend Javascript. It's completely self-contained. There's no need install anything and you won't have to worry about compiler settings and options. All you need is a modern browser.


PARTNERS