.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Dominions 3: The Awakening (http://forum.shrapnelgames.com/forumdisplay.php?f=138)
-   -   Creating a fake map image file (http://forum.shrapnelgames.com/showthread.php?t=39749)

llamabeast July 19th, 2008 10:57 AM

Creating a fake map image file
 
Calling all technical types.

I would like people to be able to upload their own maps to the LlamaServer. However, I'd rather they didn't have to upload the images as well, since they are often large. It occurred to me that the images are surely fairly pointless - the server doesn't have to see the prettiness of the map. So I was hoping to set it up so that only the .map file need be uploaded.

However, you can't actually start a game without the map image present (it gets angry). So, I decided to write a program to create a fake image file, containing only a row of white pixels with as many pixels as there are provinces listed in the .map file. Ingenious, I thought. Unfortunately, it turns out that Dominions isn't happy with such an image file. On trying to create a test game, it said:

N�got gick fel!
can't find a valid starting province
N�got gick fel!
can't find a valid starting province
Aborted

So, my question is: what other features of the image file do we think Dominions needs? Do I need to space out the white pixels somehow? I'm at a bit of a loss, being as I don't know what Dominions actually does with the image file.

Hope someone has some ideas!

Thanks, llama

Aezeal July 19th, 2008 11:41 AM

Re: Creating a fake map image file
 
well no idea but just try to space them with a green pixel http://forum.shrapnelgames.com/images/smilies/laugh.gif

llamabeast July 19th, 2008 11:43 AM

Re: Creating a fake map image file
 
Okay, I think I may have fixed it. I created a file like this:

RRRRRRRRRRRRR
RWRWRWRWRWRWR
RRRRRRRRRRRRR

where W is white and R is dark red, and it didn't complain. I'll do a bit of testing to see if there are any side effects, but if not this is going to be super awesome.

llamabeast July 19th, 2008 11:45 AM

Re: Creating a fake map image file
 
This is also quite exciting because trying to work out the .tga file format was the first ever time I've had a go at hex editing. Turned out, unsurprisingly I guess, to be quite easy.

Gandalf Parker July 19th, 2008 12:30 PM

Re: Creating a fake map image file
 
Love the concept but I dont think its going to work.

I tried copying a random maps RGB over another random map of the same size and starting a server game.

My machine had the map that the .map said was being used so no transmitting was done. But the result the old map, with very strange placements of flags. I didnt think that the host needed the graphic file either but apparently it does use it for something.

llamabeast July 19th, 2008 12:38 PM

Re: Creating a fake map image file
 
Bugger. Looks like you're right Gandalf.

Hmm, I think that's game over for that plan. What a shame.

Aezeal July 19th, 2008 12:39 PM

Re: Creating a fake map image file
 
/me gives llama a hug and an A for effort

Gandalf Parker July 19th, 2008 12:48 PM

Re: Creating a fake map image file
 
You might offer a number of different well-chosen maps from the various map generators, and support players creating their own .map files to go with them. Thats the only thing I can think of.

llamabeast July 19th, 2008 01:15 PM

Re: Creating a fake map image file
 
http://forum.shrapnelgames.com/images/smilies/happy.gif Thanks Aezeal!

Gandalf - yeah, I think that's the best plan really. Maybe down the line I could allow upload of whole map images, but there's the potential for problems there. Not least is the fact that the LlamaServer's web server is provided by a volunteer student group, so I want to leave as small a bandwidth footprint on it as possible.

Ballbarian July 19th, 2008 02:29 PM

Re: Creating a fake map image file
 
1 Attachment(s)
Try this llamabeast:
Create a cross-platform program that your users can download (or run from a browser) that will change every pixel to black except for the pure white province markers. Then have them upload the resulting image.

I have attached a "minimized" version of the silent seas map image. The file size goes from 2787 KB to 50 KB. If you are able to automate zip file decompression as well, have the user or your distributed application zip the resulting "minimized" image and it will squeeze down to 2 KB.

I have not tested the map image in game yet, but I see no reason why it should not work. I have attached it to this post for anyone who wants to try it out.

Hope this helps!

llamabeast July 20th, 2008 05:17 AM

Re: Creating a fake map image file
 
Ha, that is a very cool idea Ballbarian! I may very well end up using that.

Gandalf Parker July 20th, 2008 04:29 PM

Re: Creating a fake map image file
 
Hmmmm I was working on a command-line to the fantastic ImageMagick tools to do that. Or maybe a ghost-script to GIMP.

The purpose was actually to turn a map into one with just borders and pixels that could be used as an online view to have the national colors automatically filled into the provinces to show game progression. But I can see a use here also.

llamabeast July 20th, 2008 04:48 PM

Re: Creating a fake map image file
 
Oh wow Gandalf, if you could whip that up for me that would be really amazing. I was thinking about how to carry out Ballbarian's suggestion but had just about decided to give up because I couldn't face learning the necessary skills to modify the map.

lch July 21st, 2008 01:58 PM

Re: Creating a fake map image file
 
I'm really surprised to hear that putting random white pixels into a map image doesn't work. What exactly is going haywire with that approach? Anybody care to give me an example?

Quote:

Ballbarian said:
Try this llamabeast:
Create a cross-platform program that your users can download (or run from a browser) that will change every pixel to black except for the pure white province markers. Then have them upload the resulting image.

Another possibility would be to do this on the client side when they want to upload the image. Here are links to open source file upload applets in Java which you might be able to vandalize to add the desired functionality:

http://sourceforge.net/project/showf...group_id=59144
http://www.aasted.org/ (don't let the name "Coppermine java image uploader" scare you away, it's probably easier to get it working even without a Coppermine gallery installed than to implement an image uploading applet from scratch)

Quote:

Gandalf Parker said:
Hmmmm I was working on a command-line to the fantastic ImageMagick tools to do that. Or maybe a ghost-script to GIMP.

I certainly don't want to curb your enthusiasm, but while it's very powerful in terms of functions that it offers, I've found out that ImageMagick or at least its bindings through PythonMagick is an awful sluggish piece of *bleep*.

I could give you something in Python which does this in PIL, that would be about 5 lines of code. Somebody actually even asked exactly for this a couple of weeks ago on the image-sig mailing list. You could even chose to build binaries for any platforms you'd wish to support with that. But speaking from experience, if the process is too complicated, like this sounds, I'd say that people wouldn't bother to use it.

llamabeast July 21st, 2008 02:26 PM

Re: Creating a fake map image file
 
Quote:

I'm really surprised to hear that putting random white pixels into a map image doesn't work. What exactly is going haywire with that approach? Anybody care to give me an example?

I was surprised too. The server seems to include the province positions in the trn file, oddly. So all the provinces end up cluster together in one corner of the map once you look at the trn file at the client end.

Quote:

Another possibility would be to do this on the client side when they want to upload the image.

Okay, web stuff is very far from being my forte. What's the idea here? The computer at the client end runs the program contained within the web page to alter the map image before it's uploaded, so that the actual data uploaded is already altered and hence small? Or something different?

lch July 21st, 2008 02:32 PM

Re: Creating a fake map image file
 
Quote:

llamabeast said:
The server seems to include the province positions in the trn file, oddly. So all the provinces end up cluster together in one corner of the map once you look at the trn file at the client end.

Wow, that's really odd.

Quote:

llamabeast said:
Okay, web stuff is very far from being my forte. What's the idea here? The computer at the client end runs the program contained within the web page to alter the map image before it's uploaded, so that the actual data uploaded is already altered and hence small? Or something different?

Yes, exactly that. If you use a Java applet the idea would be to do the white-pixel-filtering on the client side. You could do it in ActiveX for MSIE, but Java is more portable. And while Java applets were bringing browsers to a grinding halt about 10 years ago, they're quite fast and usable now.

llamabeast July 21st, 2008 02:36 PM

Re: Creating a fake map image file
 
Okay lovely. I think what I will do is see how much demand there is for it, and if there's much I'll look into it. Do you think it would take me long to figure out? Given zero knowledge of javascript but lots of general programming experience.

I'm about to make the game creation process on my server fully automated, so that I don't have to get involved any more - I've been coding like crazy for the last week and a half or so. I'm going to provide as big a choice of ready-made maps as I can, and also I've included the option for people to upload their own .map files for map images the server already has. But I'm not sure how desperate they'd be to be able to provide new images.

The plan is to make it so I can just not think about the server for months at a time without anyone having problems. What with my PhD writeup coming up soon, I think that would definitely be a good thing.

Ballbarian July 21st, 2008 02:36 PM

Re: Creating a fake map image file
 
Quote:

The computer at the client end runs the program contained within the web page to alter the map image before it's uploaded, so that the actual data uploaded is already altered and hence small?

That is what I initially envisioned when I suggested something that could run from a browser. Not much point in running it on the server since the whole point is to keep a small bandwidth footprint. http://forum.shrapnelgames.com/images/smilies/happy.gif

Web development is not my forte either. I could slap together a VB program to generate the basic map, but that would only work for windows users and a few others who are set up to run it in a shell (or however they have been managing it). The conversion is pretty simple. I wish that I could just "record a macro" in Gimp. That would be the simplest, but if it is possible, I have no idea how. I only glanced at script-fu, but I just don't have time or energy to devote to figuring that out right now. http://forum.shrapnelgames.com/images/smilies/frown.gif

lch July 21st, 2008 02:47 PM

Re: Creating a fake map image file
 
Quote:

llamabeast said:
Okay lovely. I think what I will do is see how much demand there is for it, and if there's much I'll look into it. Do you think it would take me long to figure out? Given zero knowledge of javascript but lots of general programming experience.

Java and JavaScript have nothing in common except for the name, which was picked for marketing reasons. Java is a full-blown programming language which is quite often taught in school and college when it comes to object-oriented programming. You'll have to get your hands dirty with imaging in Java, but if you're experienced in OOP and you use the links that I provided before as a base, you might come up with something in a reasonable time. I'd have to start at about the same as you would, so I'm not much help.

Quote:

llamabeast said:
I'm about to make the game creation process on my server fully automated, so that I don't have to get involved any more - I've been coding like crazy for the last week and a half or so. I'm going to provide as big a choice of ready-made maps as I can, and also I've included the option for people to upload their own .map files for map images the server already has. But I'm not sure how desperate they'd be to be able to provide new images.

As I've said many times before, that's about my oldest dream that I want to realize too, a fully web-customizable automated Dom3 server. Hasn't happened yet, though. Would be interesting to see what you come up with as a reference.


All times are GMT -4. The time now is 09:51 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.