Is it reccomended to use a image, representing player positions/sizes and map boundries with diff pixels? Is this slow? Say there are like 1000 images/rooms all 750x750 pixels for a multiplayer game? The benefits with this would be a good way of doing collission detection and being able to have large units like dragons. Atm I''m using a regular grid map but the problem is diffrent size units, and walking between the grid cells.
Any ideas welcome
[java] Player positions using image?
Hum, that would be too slow in anything other than ASM! A better way would be you use another (invisible) map for collision detection. Say you had a 4x4 tile map (with a wall down the middle (where 1 is the tile for the wall)):
0010
0010
0010
0010
the collision map would look something like
00x0
00x0
00x0
00x0 where x = non passable and 0 = passable (walkable?)
the maps don''t have to be on the same scale (i.e. make the collision map 8x8 and have 4 parts for each tile which can be blocked/unblocked) so you can more closely follow the path of a wall or tree etc...
This way you can draw whatever you like on the map (multi sized tiles, bk images etc) and just define what''s walkable etc later. But it will make the scene (level) designer more complex to develop...
Ok so a 4x4 tile map with a 16x16 collision map would not be benefited by a 16x16 image then? I cant see why the information stored in a image should take much more power than for instance a vector or array.
Any other input, experience with tile maps and collision detection between units of diff sizes would be great. thx.
Any other input, experience with tile maps and collision detection between units of diff sizes would be great. thx.
quote: Original post by Spyder
Ok so a 4x4 tile map with a 16x16 collision map would not be benefited by a 16x16 image then? I cant see why the information stored in a image should take much more power than for instance a vector or array.
Any other input, experience with tile maps and collision detection between units of diff sizes would be great. thx.
Cuss that''s just stupid! Why build an image then reduce it to a 2D array of pixels, why not just define the array?
You have to consider the solution which costs less (in terms of operations & memory usage) especially when developing in java. And the data in an image isn''t good for definitions, whats a blocker going to be, red? & which red (what value). Unless your blocker image is going to v.basic i.e. 2 colours the data is to be useless (& your program will have long lists of dum definitions)!
Consider the steps:
load image;
wait for image to load (via metiatracker (& with a 56k modem that won''t be much fun));
get image source & parse to int[][] (or even better int[]), this takes an age!
Or (the other non-image way):
open mapfile
parse string to int[][] (or even better int[]), quick cuss routines are native!
Which looks like it may take longer??
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement