Dungeon Adventure Mapscript [WIP]

Lutefisk Mafia

Inscrutable Enforcer
Joined
Jun 15, 2007
Messages
544
Location
Minnesota
UPDATE: Script fixed as of March 29, 2010!

*****************************

Attached is my attempt to convert Dungeon Adventure material into a mapscript for FfH2.

The dungeon generation code from DA-133rd KRAG has been refined to create a random, one-level labyrinthine dungeon, complete with special rooms and features.

It is intended to allow for flexible play as any civilization and on a variety of map sizes. The mapscript does not require ANY changes or modding of any other FfH2 files: it is a stand-alone mapscript, sort of like the Erebus mapscript. Except that the entire map is inside a dungeon. ;)

Simply unzip the Dungeon_Adventure mapscript file into your "public maps" folder and then select the mapscript in a custom game.

NOTE: THIS IS A BETA RELEASE. Having said that, the earlier reported crashes and bugs have been fixed! It turns out that preplacement of barb units was causing crashes, as well as an infinite loop in the portal linking subroutine. Accordingly, preplacement of barb units has been stripped out, and the portal linking bit was fixed.

This will result in some odd looking rooms for a while (features with no creatures!), but the important thing is that the script is now useable. Pending feedback, I will continue to polish this script and get the rooms looking a little nicer.

Hope you enjoy playing with it -- feedback for new features or improvement is always welcome!
 
Very cool concept.
 
Awesome fun, I do hope you manage to fix that crash bug, because this mapscript leads to some amusing and offbeat games. The dearth of productivity means you really have to think about what you're doing, which is nice. I was really kicking myself when I got the immigrants event and the Amathaon constellation event twice, and I didn't have any money for any of them. Also, Acheron is scary now.

One minor annoyance that I noticed, there are lots of caged animals dotted about. However, capturing the animal puts it on the tile that the attacker came from, which means it's then impossible to un-cage them.
 
Looks pretty good. I haven't generated a bunch of them but I haven't gotten any crashes.

Actually I did get only crashes when I tried to play with RifE but I fixed the map for that. It was generating crash dumps that talked about a hotkey error.

Anyways, here's a map that works for RifE, it might be helpful to you.


Edit: If you don't turn off the gone to hell victory, Cernunnos wins on the first turn.
 

Attachments

  • Dungeon_Adventure.zip
    8.7 KB · Views: 90
@ Morlark: Good catch on the held animals. I totally forgot that they move to the attacker's plot when captured. I will edit this so that they either get a fortify mission or have a ring of "no move AI" plots around them.

@cyther: Thanks for posting the mapscript that works with RiFE. What is that you changed? I took a quick look but didn't catch it. Could you point me in the right direction? The hotkey errors (whatever they are) may be what is goofing up the regular games, too. Thanks!
 
The things that I changed:

1. All references of the barbarian civ were changed to animal civ. RifE has three different factions of barbarians but none are the barbs. This shouldn't affect you.

2. I had to change all equipment to the unit CONTAINER and give it the equipment promomtion as that is how equipment works in RifE. This shouldn't affect you.

3. I had to change mentions of some units that appear in FfH but not RifE to units that were close to the FfH units. This may be related your problem. I found that some XML objects were hardcoded into your mapscript. If they were misspelled, you would get a crash and the dump (if enabled) would talk about a hotkey error. I don't know how the mapscript files are read but if you have a broken XML object in a conditional it may cause some of your random errors.

This is all speculation as I have neither seen a crash on your mapscript (outside of putting it into RifE) or any XML value that looked wrong.

PS) Would you mind if I made a Dungeon Adventure-like ModMod on RifE? :please:
 
PS) Would you mind if I made a Dungeon Adventure-like ModMod on RifE? :please:

Please do! I have found that my best contributions to the CivFanatics community are the things that give other people ideas. (I contributed the dungeon walls to FfH2, believe it or not! They are modified icebergs! :) ) Feel free to use any of the DA mapscript.

Please note that the code that generates the initial one-plot-wide maze is an adaptation of the Maze.py mapscript by Bob Thomas (Sirian). I left that part credited to him in my own file. The rest of the DA mapscript is my own bludgeon style of programming.

I'd be happy to collaborate with you if you would like -- at the very least, I can explain some of the code routines or at least why I did things the way I did. I left a lot of commentary in my mapscript, since it is a work in progress, but some of the code blocks are a little obscure.
 
After more playtesting, and based on feedback from users, it appears that much of the "initial generation" bugs have been resolved.

I rarely (maybe 1 time out of 50) get a crash upon initial map generation now. Part of my reason for reporting crashes before is because I was stress testing the code with multiple regenerations. I have since found out that vanilla FfH2 will get errors and crashes when you try this, too.

Anyway -- the important thing to know is that, if the map script generates a map without a crash error, the game can be played through without any problems. If it is going to crash, the mapscript will do it on map generation -- NOT during the game!

I hope this will encourage people to give the mapscript a try and provide some feedback!
 
Could you upload the new mapscript? I'm still running the old one and it crashes a bit much for in-depth testing in my mod. (Check sig, Ruins of Amur).
 
Oh, there is no new version yet -- I was just mentioning that most of the error seemed to occur on regeneration.

Please check my post in your DA-ish mod thread for my additional thoughts. I'd like to locate the source of the problem, but am having difficulty. I could use help! :)
 
I updated the script in two ways:

1. Following suggestions, I changed the way animals and slaves get "caged." They are now put in a cage improvement and all of the tiles around them are set to block AI unit movement. This eliminates the annoying capture problem that lead to animals with the HELD promotion being un-freeable.

2. The entire script has been re-formatted to closely follow the order and constraints listed in the exemplar mapscripts for BTS. So, the good news is that I now know that it is not some weird formatting error that is causing the crashes on map generation. the bad news is that the errors still happen.

Having said that, the script is much improved -- it seems to work more often (near 100% for Duel sized maps), and is WAY quicker. The regeneration times on duel sized maps are instantaneous!

I really, truly could use some help chasing down likely suspects for the script initiation errors. I am guessing it is hapening when certain civs are chosen and/or certain rooms appear.

I have tried to look for the obvious python code formatting problems, such as missing colons or goofed up indents, but have not located any. Any extra eyes to review the script for python formatting errors would be very welcome.

If that all looks clean, then it may be what I mentioned above. Or something else? Seriously, I am begging for help here! I believe that this script has some potential to generate a lot of fun games for people -- if I could just iron out the bugs! :cry:

If I do not get this nailed down in the next few weeks or so, I will likely need to just abandon this project. :(

Again, any help from you FfH2 code experts out there would be truly appreciated!

Regards,
Lutefisk Mafia
 
Well uber DUH!

It turns out that the Civ4 game engine REALLY does not like it when your mapscript places barb units on the map before the human and AI civs get their units placed. This was the source of the crashes and auto-death errors. I am slapping my forehead for not getting this sooner, and I hope that people did not get turned off to this mapscript because of a shaky first release. :blush:

Anyway, I am racing through the code to remove all pre-placements of barb units and/or equipment. I will make an updated release soon -- I have tested the script 40 times so far on various sizes and no crashes or errors so far. Keep your fingers crossed!

I hope to have a quick release soon, with a more polished release to follow.
 
Well uber DUH!

It turns out that the Civ4 game engine REALLY does not like it when your mapscript places barb units on the map before the human and AI civs get their units placed. This was the source of the crashes and auto-death errors. I am slapping my forehead for not getting this sooner, and I hope that people did not get turned off to this mapscript because of a shaky first release. :blush:

Anyway, I am racing through the code to remove all pre-placements of barb units and/or equipment. I will make an updated release soon -- I have tested the script 40 times so far on various sizes and no crashes or errors so far. Keep your fingers crossed!

I hope to have a quick release soon, with a more polished release to follow.

Glad to hear it! This is a very promising script. :goodjob:
 
NEW SCRIPT JUST POSTED!

Notes:

1. I stripped out all of the preplacements of barb units that were causing crashes.

2. I also found an infinite loop in my portal linking code that I fixed.

I have tested it at various sizes, and have found it to be stable. (Please let me know if you experience any crashes!) Some of the rooms will look a little odd for now, since the barb units that were supposed to be there are now AWOL. I will continue to work on the script and try to improve the affected rooms.

I will likely make use of all of the improvements that generate monsters, since this will now be the only way to get more critters than just the standard random barbs that spawn in areas with fog of war. I would REALLY like to find a way to get my caged animals and slaves back, but that will have to wait.

Speaking to that -- does anyone know of a mapscript function that will trigger AFTER human and AI units have been placed on the map? I could probably use that, if there is such a thing.

I also need to figure out if barb cities will cause a conflict like barb units do. If not, at least I could put in a single city into which Archeron may spawn. :)
 
Top Bottom