CW1 to CRPL Project

Started by mopa42, October 31, 2013, 10:25:16 PM

Previous topic - Next topic

mopa42

Since I've already worked on parsing the CW1 map format, I wanted to see if I could convert CW1 maps to CW3 format. Virgil even nicely provided a number of unit-creation commands in CRPL. My idea was: get terrain, make CRPL script with a SetTerrain loop and lots of data, and use a throwaway core to run the CRPL script.

So far, this has worked out pretty well, and I'd like to share this project with you all. I've got it running at http://aguakandra.com/cw1convert.html. You browse for a cwm file, then copy and paste the resulting CRPL script into a file. It copies over not just terrain but also walls and some units:

  • Totems
  • Emitters
  • Collectors, Relays, Reactors
  • Blasters, Mortars

For example, I tried converting MadMag's Creeper Hollow, one of the maps selected for User Space. The resulting map has all of the emitters and totems, and looks pretty nice under terrain theme Proc2 (the custom background doesn't copy over -- yet). I've attached the resulting CRPL script. All I did was make a CRPL core, add the script to it, and run until the terrain changed. Creeper Hollow in CW3 is still very playable, despite the lack of spores, different unit costs, etc. See the before and after screenshots below.

This is still very much a work in progress. You might encounter weird bugs, and the resulting CW3 maps will require tuning (or at least checking) to make sure they are still playable and fun in CW3. This only works on custom maps, not on story maps or chronom maps. If you want CW1 story maps in CW3, for now you have to settle for J's "CW1 Tucana" in the Alpha Sector.


Let me know what you think about this project! Is this a good idea? Does it work on your favorite CW1 map? What's broken? What CW1 features can be implemented with more CRPL?

Grayzzur

Very cool what you have so far.

See thread http://knucklecracker.com/forums/index.php?topic=14482.0 for a CRPL Core that imitates a Survival Pod (minus the proper custom image).
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

knucracker

That's very cool...
A 2x option would also be interesting.  In the alpha sector, J ported Tucana from CW1 to CW3.  He did a 1-1 mapping and a 2x version.

Getting the terrain 'close' to the original map can save a lot of time porting an old map concept to the new game.  There are a few places it might need to be touched up due to the way corners work, etc.  And some custom images might need to be overlaid to get back some original custom art, and of course some special cores might need to be placed here and there. 

But for any author of a CW1 map looking to make a CW3 map, this would be a fantastic way to start.

miquelfire

You might want to see about have a CN appear where OC is on the map. Or at least have that be an option. (if you can build CNs with CRPL, if not, then I can see why there's no CN on the example you gave)

J

Nice! Would have saved me a lot of time if I had this earlier. (did you know MM already ported creeper hollow to CW3?)
Few suggestions:
1. Allow users to choose which terrain levels are used (simply add <-levelmod add before the SetTerrain command). I used 2-6 for my tucana maps and others might want to use 6-10 or 2,4,6,8,10 (<-terrainmult mul). This allows easier modification of landscapes.
2. Allow users to disable the copying of certain units.
3. Add a 'x2' option (like CW1 Tucana x2 in my alpha sector)

1 and 2 can be done with some work in the CW3 editor, 3 would require another core to copy the landscape correctly to double the size (I think I should add such a script to the wiki).

mopa42

I hadn't realized that there was Creeper Hollow in Alpha:MadMag already, I just picked that map as one I remembered from CW1.

I think I might do terrain height configuration with a look-up table in the CRPL, that way you can do heights 1-5 => any values you want. 1x or 2x would probably be decided before CRPL. Best strategy would probably be 1x1 cell becoming 2x2 without fancy interpolation.

Command Nodes will be tricky, just because I don't think the CreateUnit command can create a CN. Also, CN's can't be locked in place like OC could.

For spore waves, I think I might just do a spore tower. No longer would spores come from the edge of the map, but doing it that way (instead of via CRPL CreateSpore) enables the incoming spore countdown.


Thanks for the feedback. I don't know if anyone is in a big hurry to use this, but I should have some more changes ready by the end of the weekend.

MadMag

#6
Great project and a great map you picked :)

mopa42

Added more unit support! This now understands the 5 special types (emitter, totem, upgrade, survival pod, artifact), 5 civilian structures (collector, relay, storage, speed, reactor), 5 military structures (blaster, mortar, SAM, drone, mine), and the Odin City. Not all of these are converted to real units (things I haven't implemented yet are power zones) but all are present in the output.

I ran into a couple of walls approaching the CRPL: apparently there is no way (yet) to configure a resource pack or a message artifact. I'd like to programmatically create an Aether resource pack (for CW1 Storage and Speed) and set the text on a message artifact (for CW1 Artifacts).

I think survival pods, totems, mines, and spore waves can likely be CRPL-ized.

eduran

#8
Quote from: mopa42 on November 03, 2013, 07:54:25 PM
I ran into a couple of walls approaching the CRPL: apparently there is no way (yet) to configure a resource pack or a message artifact. I'd like to programmatically create an Aether resource pack (for CW1 Storage and Speed) and set the text on a message artifact (for CW1 Artifacts).

I think survival pods, totems, mines, and spore waves can likely be CRPL-ized.

SetScriptVar(<-sporeTowerUID 0 "startTime" 3600)
SetScriptVar(<-sporeTowerUID 0 "waveInterval" 3600)
SetScriptVar(<-sporeTowerUID 0 "waveCount" 1)
SetScriptVar(<-sporeTowerUID 0 "sporePayload" 25000000)


That works for spore towers (taken from Arca). I am pretty sure we could do the same for resource packs if we knew the correct variable names. I tried a few, but no luck so far. I am also working on a script to create CW1 style border spores. If you are interested I can share that.

Edit: Finished version of the spore script

Grayzzur

I present the first draft of SAM Launchers.

I "borrowed" the spore warning bar from eduran's script. I hadn't figured out how to set absolute screen window positions until I saw that. Thanks.

My spore launcher runs off a list of spore wave properties with Time, Count, Intensity and Side like you would set up in the CW1 map editor. It steps through the waves, then repeats the last one indefinately.

I'm not happy with the movement logic here yet. The missiles need a turning radius when they re-target. Spores are missing shadows.

This works by "co-opting" the Beam weapons and piggybacking a SAM Launcher CRPL Core on top of them. This works because I need CRPL Core Spores in order to target them with the SAM Launcher, and the Beam ignores them. That solves the problem of building, unit movement and network connections, but you can't really disarm/deactivate them like you would expect. If you deactivate or stop resupply, it'll still fire off shots until the ammo is too low.

I'll be working on this some more and throwing out a better version later, but I thought it good enough to share.

Things that I can't seem to do:
* Change the MAXAMMO property of the Beam weapon.
* Determine the arm/resupply/activation status of the Beam weapon.

The attached map is not for play, merely for demo of the spores and launchers. (And for the draft versions of the scripts, for those interested.)
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

knucracker

Wow...
The spores and the sams.  That's some impressive work. 

For attributes that you can't get or set, if we can get a summary of the ones that should be added I'll try to get to them. I can't promise everything will be added, but I can at least take a look since some might be very easy to add.

Grayzzur

The following on player units would be helpful, I think. Unless you want to go all-out and make CRPL Core's that can interact with the UI like player units. :)

Readable:
CONST_ISARMED, CONST_ISACTIVATED, CONST_ISRESUPPLYING -- know what the state of the unit is.
CONST_FIRERANGE, CONST_FIRERATE -- range and rate of fire of the unit, and accounts for forge upgrades

Writeable:
CONST_MAXAMMO, CONST_MAXAMMOAC -- ability to modify these
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

mopa42

I wasn't expecting to see a working SAM - great job! I've linked to some of the CRPL add-ins you guys have made, and when they are ready I'd like to add them in to my generator.

I've added the 2x option for scaling up the map, and the converter now lists spore waves and available tech settings.

Grayzzur

I put up a new thread in custom maps that highlights the "version 1.0" of my SAM Launcher/Spores scripts.

http://knucklecracker.com/forums/index.php?topic=14650.0
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker