Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Loading files into Smash Hit

knot126 edited this page Dec 18, 2023 · 3 revisions

Note

This article is somewhat dated since there are easier ways to work, but is still accurate technically accurate, so I have decided to add it to the main manual.

Once you have created a set of segments you would like to make an APK from, you will need to:

  • Copy the segment files to the APK
  • Create a room file (possibly based on Quick Test settings)
  • Create a level XML file
  • Add your level to game.xml

If you know how to navigate folders and edit text files, you can probably skip some of this guide.

What are we doing?

Android ships apps in "packages" that contain the data and libraries needed for the application to work. To distribute your custom segments and load them in game, you need to create an Android package, also called an APK.

To do this, we download a normal Smash Hit APK and add our segments into it.

Things you need

To start, you will want to download APK Editor Studio if you have not already. It lets you easily edit and save modified APK files, and we will use it here.

Also, if you don't already have a default Smash Hit APK file, you need to download one.

If you use Windows, you also might want a text editor better than Notepad, like Notepad++.

Open an APK

To start, you will need to open APK Editor Studio.

image

  1. Click the folder in the top left and browse to the Smash Hit APK, then open it.
  1. Once it is open, wait a few seconds and it will have loaded:

image

  1. Click Open Contents, and we will now see the files in the Smash Hit APK:

image

  1. We can now modify the game files and mod Smash Hit.

Change package name, title and icon

When making a Smash Hit mod, you will probably want to change the package name, title and icon. Please note that if you don't change the package name, your progress in non-modded Smash Hit could be erased.

TODO: Write this!

Copy segment files

  1. Export and find your segment files in a file explorer window.
  2. Follow the first guide to open the APK contents.
  3. In the window with the apk contents, go to assetssegments.
  4. Create a folder named whatever you want your level to be called. For example, forest, beehive or tunnel.
  5. Copy and paste your segment files from where you exported them to this folder.

Create room files

  1. Go to the APK contents.
  2. Navigate to assetsrooms.
  3. Copy an existing room file. For example:
  • go to basic
  • copy basic.lua
  • go back
  • paste basic.lua
  • rename the file
  1. Open the copied file in your text editor (Notepad, Notepad++, or whatever you like).
  2. You will see something like this:
function init()
	pStart = mgGetBool("start", true)
	pEnd = mgGetBool("end", true)

	mgMusic("0")
	mgReverb(0.2, 0.8, 0.3)
	mgEcho(0.3, 0.2, 0.5, 0.5)
	mgFogColor(1.8, 1.6, 1.9, .05, .3, 0)

	confSegment("basic/basic/chasms", 1)
	confSegment("basic/basic/chasms2", 1)
	confSegment("basic/basic/stairs", 1)
	confSegment("basic/basic/stairs2", 1)
	
	l = 0
	
	if pStart then
		l = l + mgSegment("basic/basic/start", -l)	
	end

-- ... and there is more
  1. The only thing we need to change to view our segments is the confSegment lines. Edit them with the path to your segment, for example:
	confSegment("forest/door", 1)
	confSegment("beehive/hexagons", 1)
	confSegment("tunnel/long", 1)
  1. Save the file.

Create a level xml

  1. Open the APK contents.
  2. Go to assetslevels.
  3. Create a new file: my_level_name.xml.
  4. Open the file.
  5. Start with the basic level structure of one room:
<level>
	<room type="[room name]" length="100"/>
</level>
  1. Replace [room name] with the name of your room, and maybe edit the length.
  2. Save the file.

Edit game.xml

  1. Open the APK contents.
  2. Go to assets.
  3. Open game.xml. You will see something like this:
<game>
	<levels>
		<level name="basic"/>
		<level name="night"/>
		<level name="holodeck"/>
		<level name="cave"/>
		<level name="canyon"/>
		<level name="ocean"/>
		<level name="cave2"/>
		<level name="river"/>
		<level name="brownie"/>
		<level name="phosphor"/>
		<level name="hyperspace"/>
		<level name="city"/>
		<level name="endless"/>
		<level name="endless"/>
		<level name="endless"/>
	</levels>
</game>
  1. Add your level anywhere you want (the very start is recommender for easier testing). The name comes from the file in the levels folder.
  2. Save the file.

Saving your apk

  1. Go to APK Editor Studio.
  2. Click Save APK.
  3. Choose a nice filename.
  4. Save the file.
Clone this wiki locally