Another generator

Another generator

Hammer Mapping — Page [1]
green_meklar

2009 Apr 10 • 9
*works up the courage to post*

Hi people!

I posted a similar thread to this in the VERC forums back in January, so some of you (particularly Killer-Duck, I recall he was there) may recognize me. I realize this here is a rather tight-knit community, so I hope I'm not barging in, or breaking any rules or customs by posting a thread that one, isn't asking for help, two, is a near duplicate of one I posted on the VERC forums, and three, mostly comes down to advertising. Yes, I admit it. So if you don't like advertising and/or have no interest in 3D procedural content generation, don't read any further.

Over the past few months, I've been writing a Half-Life 1 map and map component generator in C++. Although my original intention was just to be able to place random crates and shipping containers and stuff in a room, I kept writing more and more functionality into the program until by now it is over 8000 lines long (making it one of the longest programs I've ever written, in any language) and quite sophisticated. The reason I wanted to post about it here, of course, is that this site is the home of the Freshmap and Automap programs, so I'm hoping that the people here are the kind of people who would both be interested in my program and would be able to give me evaluations and suggestions from the most experienced viewpoints.

Unfortunately, I have no idea how to use the Windows GUI with C++, and so my generator relies on a command line interface; that is to say, it looks like the Windows command prompt, only a little more colorful. That said, though, from my limited knowledge of Automap and Freshmap, I would guess that by now my generator is probably the more advanced program, but it does have a few obvious drawbacks (although I hope to correct many of them in the future) and is probably less reliable as well as having worse usability. I also don't know exactly what operating systems it will work on, other than that it runs fine on Windows XP and Windows Vista.

With all that said, for those of you who don't find typing numbers into a console too tedious, here's the link to the ZIP on box.net:

http://www.box.net/shared/34b9x7itub

Hopefully the above URL will remain the same for the foreseeable future. However, if it changes, the updated link should be available on the downloads page on my website:

http://green-meklar.110mb.com/Downloads.html

So, what are your thoughts? Really disappointing? Totally awesome and I should post about it on Snarkpit too? Difficult to use? Needs such-and-such added to it? Doesn't run on [insert operating system here]? Kinda cool, but anything SuperJer writes will always be better? I'm hoping to get some decent feedback so that I can improve the program in the most effective directions, although keep in mind that I'm neither a Hammer expert nor a C++ expert and so there are some limits as to what I'm able to do.
Citizens demand a stadium. And more cream of celery soup.
 
 
2009 Apr 13 at 16:49 PDT — Ed. 2009 Jun 16 at 16:50 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Hello! This seems rather interesting. I won't compile because of windows.h but the exe, when ran in Wine, divided by zero somewhere. I'll let you know if it happens more. It's amazing how much Windows jams into executables... There are a few file paths in there. You might want to see if you can strip them out. This looks interesting! SuperJer might see this but he isn't on so much any more. Certainly interesting though. You might want to post elsewhere in the forum, not all the forum users visit here.
 
 
2009 Apr 13 at 18:09 PDT
green_meklar

2009 Apr 10 • 9
Down Rodeo said:
the exe, when ran in Wine, divided by zero somewhere.

Is it a consistent error? If so, I may be able to explain and/or fix it. Bug reports are welcome.
Down Rodeo said:
It's amazing how much Windows jams into executables... There are a few file paths in there.

The filepaths are all relative and should work fine (at least on any Windows system...I know nothing about WINE) provided you don't move the EXE and the folder away from each other, or restrict permissions on any of the files the program uses (including the output MAP file).

EDIT: I modified it slightly. I have honestly no idea whether it will help, but you can try it.
Citizens demand a stadium. And more cream of celery soup.
 
 
2009 Apr 13 at 19:01 PDT — Ed. 2009 Apr 13 at 19:28 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Nah, I just meant it has kept a little bit of information about your setup in there... turns up in any stacktraces Wine generates. It seems that the error is not consistent as I did the same thing again but it worked this time, sort of. I pressed 4, -1, 1000; after this whenever I tried to add things it added 0. I then tried to add pipes with a density of 100 at which point it gave me a stack overflow error. I wouldn't worry about it too much though; I imagine very few of your users will be on Linux.
 
 
2009 Apr 14 at 02:14 PDT
green_meklar

2009 Apr 10 • 9
Down Rodeo said:
I pressed 4, -1, 1000; after this whenever I tried to add things it added 0. I then tried to add pipes with a density of 100 at which point it gave me a stack overflow error.

Mm-hm. The problem is that the maximum random height of a warehouse is less than 2000, so when you have walls 1000 units thick, there's no space inside. You're right that I should make that 'safe', but you still would not get anything useful that way. Try a wall thickness of 1 instead; since there'll be nothing outside the map, the vis will still work fine on that if you try to compile it after.
Citizens demand a stadium. And more cream of celery soup.
 
 
2009 Apr 14 at 08:19 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Ah, I get it now. This is making more sense. I'll try again. When I read that I had thought like the length... Even though the dimensions were done in the previous step. I was tired

...

It works now. Uh, if I posted this, would anyone like to try compiling it? I could but have no copy of anything to play it with that is easily accessible.
 
 
2009 Apr 14 at 10:01 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Hah! I managed to get the source compiling. I hadn't realised the only thing you were using windows.h for was changing the colours in the terminal... so, I removed the windows.h include, commented out the setcolor definition and removed every single reference to it in the code. It now runs! It allowed me to select maze, I put in its dimensions and it then segfaulted on me. So that's cool, it doesn't matter over much :)
 
 
2009 Apr 14 at 11:02 PDT
green_meklar

2009 Apr 10 • 9
Down Rodeo said:
I hadn't realised the only thing you were using windows.h for was changing the colours in the terminal...

Neither had I. I don't know what exactly is included in windows.h that isn't included in the other libraries I'm using. In any case, personally I find the text colors quite helpful in determining what's what in the console.
Down Rodeo said:
It allowed me to select maze, I put in its dimensions and it then segfaulted on me.

Now that I suspect is an issue either with your emulator or with something you did to the code accidentally before compiling it. The maze generator doesn't crash for me no matter what dimensions I put in, so long as they're valid integers.
Citizens demand a stadium. And more cream of celery soup.
 
 
2009 Apr 14 at 11:22 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
I'd need to look at the code. Incidentally I'm not using an emulator, this is a native executable :)

I might start jamming in print statements to see where it goes funny. But yeah, this could just be a quirk of GCC.

Also, before it segfaulted, it wiped the previous file I had called "generated.map", which implies it opened it, failed a write maybe...? I guess you open it not in append mode.
 
 
2009 Apr 14 at 11:51 PDT — Ed. 2009 Apr 14 at 11:54 PDT
green_meklar

2009 Apr 10 • 9
Down Rodeo said:
Also, before it segfaulted, it wiped the previous file I had called "generated.map", which implies it opened it, failed a write maybe...?

That file is the only file the program outputs to, and it is always cleared and overwritten with a heading section (the specifications of the worldspawn entity) immediately when the program starts. Nothing else is created until the program knows what it's supposed to create, because it can't go back and fix anything that's already been generated.
Down Rodeo said:
I guess you open it not in append mode.

That's correct. If you want to save any generated content for later, you have to move the file or copy the content to another file before you run the program again.
Citizens demand a stadium. And more cream of celery soup.
 
 
2009 Apr 14 at 13:11 PDT
turnip1

2009 Jan 20 • 139
This sounds nice. Is it somewhat user friendly yet? Or still in testing?
phoenix_r said:
Hey guyz u liek mai new SIG?!
 
 
2009 Apr 14 at 14:26 PDT
green_meklar

2009 Apr 10 • 9
turnip1 said:
This sounds nice. Is it somewhat user friendly yet? Or still in testing?

It's perpetually in testing and development, but that doesn't mean it can't be fun or useful in the meantime. And it's about as user-friendly as it's going to get, which is way short of ideal but (in my humble opinion) still good enough for the casual user- no worse than Half-Life's own developer console, at any rate. If you have Windows and Hammer, then by all means, try it out and let me know what you think.

EDIT: I should perhaps mention though that currently the program is only designed to support the original Half-Life. It is not able to create any of the entities specific to such games as Opposing Force, Counterstrike, Team Fortress Classic, etc, so anything that isn't in Half-Life, you'll have to add. I may implement Opposing Force and Counterstrike entities eventually, although I can't really test the latter as I haven't got Counterstrike installed.

EDIT: I just discovered a serious problem which, among other things, was causing very few shipping containers and mainframes to be created. Fixed version is up now.
Citizens demand a stadium. And more cream of celery soup.
 
 
2009 Apr 14 at 14:46 PDT — Ed. 2009 Apr 14 at 16:15 PDT
turnip1

2009 Jan 20 • 139
Hmm it sounds good and i have both windows and hammer but what i dont have is half-life :( definitely interested if you decide to add counter-strike though.
phoenix_r said:
Hey guyz u liek mai new SIG?!
 
 
2009 Apr 15 at 13:17 PDT
green_meklar

2009 Apr 10 • 9
Well, as far as I know most of the standard entities (light, light_environment, func_wall, func_water, func_door, func_ladder) are supported by Counterstrike, and one of the posters on the VERC forums, wolf, said that the Half-Life textures were also compatible with Counterstrike. So although the program can't make Counterstrike-specific entities itself, you should be able to generate a 'bare' map (that is to say, no items, monsters, player spawns or chargers on the map) and then add any necessary Counterstrike entities manually. In fact, technically the info_player_start and info_player_deathmatch entities (the former without suits) generated by the program would work for Counterstrike CT and T spawn points too, however at the moment they're placed randomly with no consideration for teams. The layout of most of the generated maps also isn't very conducive for team play, although a desert with buildings in it might work out. You could also for example simply generate a building to place in an existing layout.
Citizens demand a stadium. And more cream of celery soup.
 
 
2009 Apr 15 at 14:24 PDT — Ed. 2009 Apr 15 at 14:25 PDT
turnip1

2009 Jan 20 • 139
well as long as i can do that ill have fun with your program but once you get the randomized player spawns thing so you can make it not random i could possibly switch over full time if i like it.
phoenix_r said:
Hey guyz u liek mai new SIG?!
 
 
2009 Apr 15 at 14:49 PDT
green_meklar

2009 Apr 10 • 9
turnip1 said:
once you get the randomized player spawns thing so you can make it not random

I might be able to manage something. I should at any rate start by unifying the functions for singleplayer and multiplayer spawn points, then I might be able to figure out a system for placing spawn points in a more Counterstrike-like style. No guarantees.
turnip1 said:
i could possibly switch over full time if i like it.

Keep in mind that this program is not meant as a replacement for any other program you already have (with the exception of Automap). It is a generator, not an editor.
Citizens demand a stadium. And more cream of celery soup.
 
 
2009 Apr 15 at 15:52 PDT
turnip1

2009 Jan 20 • 139
Ok anyhow I will still check it out I would like to be familiar with several programs.
phoenix_r said:
Hey guyz u liek mai new SIG?!
 
 
2009 Apr 15 at 15:59 PDT
Page [1]