| Reply | « Previous Thread | Next Thread » |
|
Hi guys,
I am currently creating a mobile poker game for a Uni project. I am using the Netbeans IDE with the mobility pack installed. In the next 2 days or so I will be creating the game interface and menus. I was wondering as I am relatively new to J2ME, what size (i.e. pixels and memory) images have to be when displaying them on a mobile device and will the mobile resize the images to fit their screens as they are of different screen size? I am also looking some advice, as i want the game to be multiplayer, what would be the best way to implement this? Should I use webspace to host the game? Or could I have a normal J2SE socketserver and connect to it using J2ME socket client? Any other suggestions? Any advice much appreciated! Thanks Murzo |
|
Quote:
To cope with this, don't write any code that relies on the size of the screen, or the size of any image. Use Canvas.getWidth() and getHeight(), and the sizeChanged() event, to get the size of the screen. Image.getWidth() and getHeight() should be used to get the size of the artwork. Get this right, and you will be able to use the same code on different devices, just by changing the image resources. (Likewise, use the various methods of the Font class to check the size of the text, as font sizes will vary between devices. If you need to wrap text to the screen width, write your own code for this. Don't split the lines yourself, as this will mess up when the screen or font size changes.) Different devices will have different limitations regarding images. Nokia devices don't have significant problems. Things you should know: * PNGs are supported by all devices.. not every device will support JPGs. * The memory requirements are between two and four bytes per pixel. So, depending on device, an image 256x256 will need anywhere between 128k and 512k. * Some devices (non-Nokia) have problems with images that are large in either directions, even if they have enough memory. Avoid images larger than 1024 pixels wide or tall. (If you're targetting older, low-end devices, avoid anything larger than 256 pixels in either direction.) * There is an overhead per image, both in memory, and in the JAR. A common practice is to combine several images into one (for example, one image containing several frames of an animation). * Get yourself a copy of PNGOUT. It helps to shrink PNG files, to take less JAR space. (This will reduce only the JAR size, not the amount of heap the image will require.) * Images are discarded from memory when no variable refers to them. You can stop a variable from refering to an image by: myImage = null; * (There is a bug on MIDP1 Series 60 devices that stops unreferenced images from being discarded.) Quote:
Really, your first thing to decide is: which device (or devices) do you want to support? Cheers, Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
|
Thanks for the reply graham,
the devices I am targeting are the more modern handsets with good memory storage and visual displays, or do you mean the makers of the handsets i.e. Nokia, SE, motorola etc. I was hoping it would be cross platform and work on different makes of phones who meet the requirements. Quote:
Thanks Murzo |
|
Quote:
* screen size * heap size (memory for Java objects) * JAR size (maximum size of application you can install) * performance If you code sensibly, you can cope quite easily with changes in screen size, just by switching to a different set of PNGs (smaller or larger). On the N95, you have lots of heap, no real JAR size limits, and huge amounts of performance (by mobile standards). The advantage of this is that you won't run into too many performance or memory problems. The disadvantage is: you might not realize what a luxury all that memory and cpu is, and you might write something that runs poorly (or not at all) on less devices. If you were doing this professionally, I'd recommend you define a minimum spec, find the crappiest device that meets it, and work on that. Since you're doing this as a university project, so you have a tight deadline, and you want to pass, it is probably best not to worry too much about other devices. If the app works on anything else, that's a bonus. If you have time at the end (you won't), you can experiment with other devices. Quote:
Socket support is optional, but most new devices (last two-three years) will support sockets. That includes all MIDP-2 Nokias, Sonys and Motorolas. Cheers, Graham. |
| grahamhughes |
| View Public Profile |
| Find all posts by grahamhughes |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Capturing and sending image to server | mahesh_aquarius | Mobile Java Networking & Messaging & Security | 2 | 2008-12-05 15:09 |
| uploading image to the server | knawaz | Mobile Java Networking & Messaging & Security | 6 | 2008-10-11 20:27 |
| image upload server API | gerrymackenzie | Streaming and Video | 1 | 2006-01-18 16:35 |
| changing mime type on server, where do I start | Dexy | Mobile Java Networking & Messaging & Security | 1 | 2004-10-11 22:57 |
| Change image in camera server emulator | jonawebb | Symbian Tools & SDKs | 2 | 2003-09-05 15:57 |