Best programming language to choose

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by froger, Jul 13, 2010.

  1. froger

    froger New Member

    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    I have a question, where would be the best place to start to create a game for mobile users. This will be a multiplayer mobile game.
    How you would move on the map, would be from a link going north east south or west. The game will be browser based and require
    a reload to move the character over one space. The setup for this game would be something like this...

    72x72Image

    HP:XX
    Mana: XX

    North
    East
    South
    West


    This is where things start to puzzle me though, How would I create a map that they could move up and down on. Mobile phones are very very
    limited so the image would be 72x72. I have an idea of one thing. I create a whole bunch of small 8x8 images.
    Such as player(your character moving in game.) the ground, mountains etc. In the end it really wouldnt be that many pictures.
    Now how would I be able to combine them/duplicate them as needed to create a small map.
    When I say 72x72 pixel image, thats just the piece of the map at the time that I want to display. In reality the map would be bigger. Here is an example
    of what I mean.

    ground
    [​IMG]
    cavewall
    [​IMG]
    player
    [​IMG]

    turn them 3 small 8x8 images into something like this.

    MMMMMMMMM
    MMMMMMMMM
    M--------
    M--------
    M---P----
    M--------
    M--------
    M--------
    M--------
    HP: xx
    Mana: xx

    north
    east
    south
    west

    aka

    [​IMG]
    HP: xx
    Mana: xx

    north
    east
    south
    west

    Things you need to consider are that this game should be playable from ANY phone. That includes old ones. This is the reason why I think I should go along the lines of something
    text based, then have something convert the text into image. So that way an option to have image or text would easily be able to be implemented. Any ideas? Thanks in advance.
     
  2. bhupendra2895

    bhupendra2895 New Member

    Messages:
    554
    Likes Received:
    20
    Trophy Points:
    0
    Old phones, I don't think will be able to support browser based game, because each time the images needs to be refreshed and downloaded by mobile browser.This will take so much RAM of client phone and finally browser would crash.Even in nokia s40 platform this won't perform better if the game goes so long and so the consumption of memory.Developing games for such handsets in J2ME is best option.
    Handset with good Java Script and Ajax support can do that easily and such handsets are gaining market, even in third world countries like India.So my suggestion is you should develop your browser based application for them.Presently cellufun @ http://www.cellufun.com is creating browser based games, so you can get more help by reviewing what they do.

    Good Luck :)
     
    Last edited: Jul 13, 2010
  3. froger

    froger New Member

    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    I have seen many mobile phones that dont even support images, that could carry something like this out. It could even be done in PHP if necessary. There would be a table named world or something. Have 5 columns X, Y, Z, Image, Type. Ex. X: 5, Y: 5, Z: 0, -,Ground.

    Then have a table named location with 4 columns (more if necessary) X, Y, Z, PlayerName. So it stores Locations of players. Then you could do something like this...



    $sql = mysql_fetch_array(mysql_query("SELECT * FROM Location WHERE Player='Example'"));

    for ($y = ($sql['Y']-4);$y<=($sql['Y'] + 4);$y++)
    {
    for($x = ($sql['X'] - 4);$x<=($sql['X'] + 4);$x++)
    {
    $img = mysql_fetch_array(mysql_query("SELECT * FROM world WHERE X='" . $x . "' AND Y='" . $y . "'"));

    if (($img['X'] == $sql['X']) && ($img['Y'] == $sql['Y']))
    {
    echo str_replace($img['Image'], "P", $img['Image']);
    } else {
    echo $img['Image'];
    }
    }
    echo "<br/>";
    }

    Then to move all I would have to do is have get variables in my north east south west links. This game has to be browser based. Older phones do have wap browsers that ARE capable of supporting text if they cant support image. Thus the ability to switch from text to image would be required. Also could J2ME be multiplayer AND browser based? I don't know much of J2ME either.

    Also thanks for the response. Much appreciated.
     
    Last edited: Jul 13, 2010
  4. bhupendra2895

    bhupendra2895 New Member

    Messages:
    554
    Likes Received:
    20
    Trophy Points:
    0
    J2ME is not browser based it runs in java virtual machine(jvm) on mobile devices.I don't have through knowledge of J2ME, but mobile devices which supports internet in j2me applications can take advantage of this using platform request() method, but game will be slow because old mobile phones don't support 3G, so either your application have to perform better in 48kbps GPRS connection and if you are lucky and operator and handset both support EDGE then there will be 239.5 kbps maximum speed.You can make it multiplayer and as you said it will be text based then no need to use j2me, because php will do it.I think ajax on client side will be more better because page need not to be refreshed.You can create two versions one for low fi handsets (with html and text only) and other for handsets like Iphone(with images, javascript etc.) and for detection of mobile devices, you can use wurfl. http://wurfl.sourceforge.net and
    http://tera-wurfl.com
    If you use firefox then you can install an addon called user agent switcher and switch to user agent of Iphone and open m.youtube.com you will be able to see what Iphone, android and handset like nokia 9500 can do.
     
  5. froger

    froger New Member

    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    I expected the phones to be slow. Lets say mabe one space per 2-5seconds. There will be a run option but thats something totally different. 3G networks will go 2-3x faster.

    Isn't there a better way than making an entirely seperate type of game? Lets say have a table of player information. One of the columns will be display.

    $stats = mysql_fetch_array(mysql_query("SELECT player, display FROM playerstats WHERE player='example'"));

    if ($stat['display'] == 'text')
    {
    display text version.
    } elseif ($stat['display'] == 'gif') {
    display gif version.
    }

    that way converting between text, wbmp, gif, and png will be easy. The main question I guess is
    from the script that I posted originally, how would I use that same method to convert the $img['Image'] to the small 8x8 image.
     
    Last edited: Jul 13, 2010
  6. bhupendra2895

    bhupendra2895 New Member

    Messages:
    554
    Likes Received:
    20
    Trophy Points:
    0
    I think that can be done using GD function, if you are going to implement it in x10hosting, because imagemagick is not available here.I don't know about GD too much, you can search the PHP manual, web and this forum's programming section with GD in search string.
     
  7. froger

    froger New Member

    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    Before I started looking for help on my quest to create this game, I was actually looking into GD functions. I really couldn't find any that would help my situation. What would really help is, if anyone knew how to store an image to a variable so it can be echo'd multiple times. ex.

    <?php
    $url = example.com/images/example.png";
    $img = imagecreatefrompng($url);

    header("Content-Type: image/png");
    imagepng($img); // here is where I would need the help.
    ?>

    How would I be able to echo that same image numerous times. Turning them three small 8x8 images on my original post to that 72x72 image.
     
    Last edited: Jul 13, 2010
  8. lemon-tree

    lemon-tree x10 Minion Community Support

    Messages:
    1,420
    Likes Received:
    46
    Trophy Points:
    48
    The images would have to be arranged either using GD functions prior to outputting with imagepng($img) or could be arranged through the use of multiple structured img items in HTML.
     
  9. froger

    froger New Member

    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    I agree with you here. I just dont know how I would do this. I don't see any GD functions that can be of use to do this? Can you point me in the right direction?
     
  10. Salvatos

    Salvatos Member Prime Account

    Messages:
    562
    Likes Received:
    1
    Trophy Points:
    18
    Well, if you're using a database, what I usually do is just store the image's location (filepath) in the table. You can already put the image tag around it if desired.

    For instance:
    echo "<img src=\"$sql['result']\" />";

    In your case, I would probably add the whole tag in the db so you can do something like this:
    if ($mode == 'graphic') {
    echo $sql['img'];
    }
    else {
    echo $sql['text'];
    }

    Or, more conservative, you could just have one "type" column to identify what is on the square (person, landscape, item, etc.) and have your code fetch an image or display a character in accordance. That is assuming that every "desert" square, for instance, will always have the same image/symbol. It might not work, or not as simply, if you want to superimpose images, for instance a character on a desert square.
     
  11. froger

    froger New Member

    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    Thank you for your response. It seems though I have already fount the solution to this problem. I am using imagecopymerge to handle whats needed. I thank you for your response. I was also trying to prevent the use of multiple image taggs.
     
  12. deroba

    deroba New Member

    Messages:
    10
    Likes Received:
    1
    Trophy Points:
    0
    I don't see the need of MySQL, plain PHP with HTML can do the job
     
  13. froger

    froger New Member

    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    I am sorry but I would have to disagree with you. How do you suppose to make a Multiplayer RPG without a database to keep track of different things such as location, identity, stats, armor, gear, monsters, and the whole 9 yards.

    A database is needed for almost anything that has to do with multiplayer/members.
     
    Last edited: Jul 23, 2010
  14. leafypiggy

    leafypiggy Manager of Pens and Office Supplies Staff Member

    Messages:
    3,819
    Likes Received:
    163
    Trophy Points:
    63
    What you're trying to do has been invented already. Its called MUD.

    It's a telnet game, very common, actually. You're just re-interpreting it with images, and unneeded complexity.

    If you wish to do it, J2ME, is however, your best bet. You can still use mysql, though it's incredibly dumb, and you'd just cause issues. Using flat file databases and a client/server system, this can be accomplished much like Runescape is made.
     
  15. froger

    froger New Member

    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    I have already accomplished what I wanted. I have much to learn when it comes to Java. I do understand though, that J2ME would be probably the best for what I wanted to accomplish at end game. Right now though I am using php/mysql, because I know php/mysql really well. My solution also works really well. Users are capable of moving around on a map now without a problem. That maps are easy to create and easy to implement with the scripts that I have set up. PvP is exactly what I want it to be. The only problems I see are the monsters. I can make monsters randomly move around and target players, but the thing is its up to the users to keep the monsters moving.

    In reality if every user just stopped clicking refresh or just stopped any action period, the game would be frozen until the first user made the refresh. Then the monsters would be updated and moved accordingly to where they are supposed to be. So if a user just stopped attacking and was the only user on the game. No monsters would be able to move without the monstermove/attack script being refreshed.

    **EDIT** I realized even then the monsters could still be programmed in such a way, that they can catch up with there movements and attacks and such. So refreshing them wouldn't really even matter because the simple fact is that when the refresh does happen, things will catch up to what they are supposed to be. So PHP/MySQL can be an alternative over java. So they idea really isn't stupid if they same concept of a game can be made with either languages. Its all about who likes what language better.
     
    Last edited: Jul 23, 2010

Share This Page