The Solarus Resource Help Project

Started by Zefk, May 06, 2016, 10:23:55 PM

Previous topic - Next topic
July 10, 2016, 09:45:16 AM #30 Last Edit: July 03, 2018, 10:13:08 PM by Zefk
Lua Programming Help

Solarus:
You can learn the basics of Lua in the Solarus editor. There is a terminal that shows up when one play tests the game.

Android:
The best tool to use for learning the basics of Lua on android is an app called Lua Scripting. You can run lua scripts and there are example scripts that come with it. The print(variable) will not work unless it is Screen:Print(variable). That will be the only issue, but I tested it with a lot of my scripts and it works very well. No sound or image file display, but it has some basic draw features. You can create sprites with code if you are a masochist.

Another good app for android is a lua book called Learn Lua. It can be used for quick lua reference or learning.

Ubuntu 12.04 precise Linux Lua installation:
Installing Lua on Linux: Here or this one here for information on installing different versions on Ubuntu. I hear people are having trouble installing lua on later version after Ubuntu 12.04 precise.

Online Lua Compilers:
Tutorialpoint Online Lua Compiler: Here
-Tutorialpoint compiler has many options on it.

Repl Lua Compiler: Here
-A simpler online compiler for quick tests. It could be good for the learning process too.

Windows Installation:

I recommend just using ZeroBrane

I do not use Windows for programming because it is much easier on Linux, but here is what I could find on it.

Tutorialpoint has Windows and Mac installation instructions. Here

Installing Lua on Windows: Here (You might want to check out the video on Luaforge instead.)

LuaForge for Windows: Here and a video series to help you with that.

IDE: (For Windows and Linux)

ZeroBrane is a good lightweight IDE

Books or PDF:

TutorialPoint is always be helpful with programming. Here is a offline book version of the lua Section. You can learn C++ and a bunch of other languages at tutorialpoint too, but only Lua is needed for Solarus. The PDF is free, but there is an option to buy it for $10.

Lua 5.1 Manual:
Lua Manual

Free Lua Book:
Lua Book

Basic Lua Tutorials:
A List of Lua tutorials

Solarus French and English Series:
The new Solarus 1.5 tutorial series: Here

This is an older French Tutorial series. It might still be useful for programming, Solarus history, and finding out some things the English series does not mention.

For Solarus 1.4.5 I confirmed (Maybe for 1.5 too) that the following tutorials still work for the old French series.

Tutorial Create a game with Solarus - E25 Sprites
Tutorial Create a game with Solarus - E29 Fighting
Tutorial Create a game with Solarus - E30 Guard with sword
Tutorial Create a game with Solarus - E31 Guard that identifies the player
Tutorial Create a game with Solarus - E36 Blocks
Tutorial Create a game with Solarus - E37 Police A Link to the Past
Tutorial Create a game with Solarus - E38 System day-night fog
Tutorial Create a game with Solarus - E39 Reusable enemies
Tutorial Create a game with Solarus - E40 Separators
Tutorial Create a game with Solarus - E48 Crystal Switches
Tutorial Create a game with Solarus - E50 Kinematics move the hero
Tutorial Create a game with Solarus - E51 Kinematics move a NPC

Solarus documentation:
This is very useful and the first thing I did was read it all. You can find it online and a pdf version: Here

Solarus Game Source Code:
Here


August 08, 2016, 09:12:07 PM #32 Last Edit: July 03, 2018, 10:31:35 PM by Zefk
Font (.ttf) to Bitmap and Glyph Dump

I found a easy to use python script and a GUI program for turning truetype (.ttf) in to bitmaps (png).

BMFont - This program allows someone to pick a font or scroll through already installed fonts and select what glyphs (letters) to turn into a bitmap. The user can change the font size and has a few output options. I believe it was designed to make bitmap fonts for video games.

ttf-to-pngs - A utility script to convert ttf symbol font to png images. That means you can export the letters to their own PNG file. For instance, 'A' will have its own png, 'B' will have its own png, ect. You get the point. There will need to be adjustments to positions and other Unicode added because it was meant for a picture based font, but I added a modded version with bash scripts for Linux users. Windows users will have to install WSL to use Bash scripts. Remember to give it permission to execute. I never used WSL.

You need to open the tff_to_pngs.py and edit the positions.

#!/usr/bin/env python

import CSV
import ImageFont, Image, ImageDraw
import os
import sys
from optparse import OptionParser


def get_size(character, font):
    size = font.getsize(character)
   
    return (16, 16)


def draw_image(character, font):
    size = get_size(character, font)
   
    image = Image.new("RGBA", size, (255,255,255,0))
   
    dark_grey = (71, 72, 80)
    yellow = (222, 129, 49)
   
    ImageDraw.Draw(image).text((1, -3), character, font=font, fill=dark_grey)
   
    return image
   


Positions and dimention:
return (16, 16)

ImageDraw.Draw(image).text((1, -3)

Color:

image = Image.new("RGBA", size, (255,255,255,0))


dark_grey = (71, 72, 80)
yellow = (222, 129, 49)


Size:
Change the default or use "-s ."


parser.add_option('-s', '--size', dest='size', default=20, type='int',
                        help='the font size'


Alternative Download:
ttf-to-pngs-master_mod

September 07, 2016, 08:09:28 AM #33 Last Edit: September 11, 2016, 12:34:46 AM by Zefk
Added:

-I added some script updates and links to interesting topics.

-Solarus Help Guide posts are backed up

September 08, 2016, 04:56:29 AM #34 Last Edit: September 08, 2016, 11:00:53 AM by Zefk
Added:

Font to png script mod. I added all the basic Unicode and bash scripts to make execution a bit easier. You can download the mod on this post. I will update it soon, but you need to open the tff_to_pngs.py and edit the positions.

#!/usr/bin/env python

import CSV
import ImageFont, Image, ImageDraw
import os
import sys
from optparse import OptionParser


def get_size(character, font):
    size = font.getsize(character)
   
    return (16, 16)


def draw_image(character, font):
    size = get_size(character, font)
   
    image = Image.new("RGBA", size, (255,255,255,0))
   
    dark_grey = (71, 72, 80)
    yellow = (222, 129, 49)
   
    ImageDraw.Draw(image).text((1, -3), character, font=font, fill=dark_grey)
   
    return image
   


Positions and dimention:
return (16, 16)

ImageDraw.Draw(image).text((1, -3)

Color:

image = Image.new("RGBA", size, (255,255,255,0))


dark_grey = (71, 72, 80)
yellow = (222, 129, 49)


Size:
Change the default or use "-s ."


parser.add_option('-s', '--size', dest='size', default=20, type='int',
                        help='the font size'

Update:

Fixed the ttf to png mod script and added size details. Here

I am going to try to tweak it some more, but I will never be able to make it perfect for all font sizes.

Added:

Android:
The best tool to use for learning the basics of Lua on android is an app called Lua Scripting. You can run lua scripts and there are example scripts that come with it. The print(variable) will not work unless it is Screen:Print(variable). That will be the only issue, but I tested it with a lot of my scripts and it works very well. No sound or image file display, but it has some basic draw features. You can create sprites with code if you are a masochist.

Another good app for android is a lua book called Learn Lua. It can be used for quick lua reference or learning.


Full post: Here

October 11, 2016, 04:46:27 AM #37 Last Edit: October 11, 2016, 04:48:45 AM by Zefk
Update:

New version:
Platformer or Side Scrolling functionality by wrightmat! New fully working version with ladder functionality for Solarus 1.5: Here



Old version:
Old version of Platformer or Side Scrolling functionality by wrightmat! Here and Zutokaza's test  - As I can see there are bugs to work out because of new updates to the Solarus Engine probably.

Update:
It has been quite some time since I mentioned updates on the guide. Quite a few things have been added. For instance, a list of good games to study and some script example links.

EX:

ARPG 2D Games good for studying:

-The Legend of Zelda: A Link to the Past
-The Legend of Zelda: A Link to the Past and Four Swords
-Zelda ARPG games: Wiki
-Secret of Mana (Seiken Densetsu 2)
-Seiken Densetsu 3
-Sword of Mana (Seiken Densetsu 5)
-Children of Mana (Seiken Densetsu 6)
-Boktai
-Alundra
-Soul Blazer
-Illusion of Gaia
-Terranigma
-Shining Soul II
-Juka and The Monophonic Menace
-Secret of Evermore
-Yu Yu Hakusho - Ghostfiles - Spirit Detectiv

EX:

Some scripts:

Grab char in a string: Here

Clicking the screen with your mouse: Here

Get mouse coordinates and click an image around the screen: here

Dragging an image with the mouse cursor: Here

October 27, 2016, 07:43:14 AM #39 Last Edit: January 18, 2017, 01:11:57 PM by Zefk
Update:

Added:

C++ SDL 2.0 and QT Creator: Here
Want to help program for Solarus and fix bugs? This would be a good place to start. Once you begin, fork Solarus and do a pull request once you made your changes on GitHub. Scroll down to GitHub on this post if you have no clue what I just typed.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
And in the GitHub section I added:

Pull requests: Here

Fork: Here



January 27, 2017, 06:20:15 AM #41 Last Edit: January 28, 2017, 12:46:43 AM by Zefk
darkFunction Editor: This is a Spritesheet packer and animator. It is one of my favorite, but I think it needs more spacing options and the ability to cut up a spritesheet.

-Packs Sprites
-Animates sprites
-Has cool color options
-You can just click the sprite to highlight it



Napoleon's Simple Sprite Editor: A sprite editor with quite a bit of options.

- Merge sprites
- Cut sprites
- Preview animations
- Preview tiling on a map (Tiling Test tab)
- Create flashing spritesheets from regular images
- Spacing options



Cosaneitor's SpriteCutter: Tool to help the process of cutting sprites. I have not tried this one, but it looks nice!

-Cut several images with the same size.
-Get all together in a new image ready to use as a sprite.
-It has tools to auto-cut and animation tester.



Sprite Decomposer: French members will like this site. The site is in french! The program is in English too.

-Cutting grid
-Cutting rectangular
-Auto cutting



Spaceship Generator || PartArt: Space: This sprite editor is good for making spaceships.

-Save projects online
-Make PNG sprites for games
-Scale
-Rotate
-Position
-Depth
-Symmetric and asymmetric adjustments



Power Sprite Editor: I really like this one. The way it detects overlapping and automatic pixel detection. This is similar to darkFunction editor. This is a sprite split and rejoin program though. I think it could use more options though.

-Split and Rejoin sprite sheets



Chase's Sprite Cutter:

-Cuts spritesheets into individual sprite images.



Sprite Creator 3 VX and XP: Understand that the RPG Maker graphics cannot be trusted in these generators. You can use your own art. Funny how Mack's Sprite base got in there. That is not Enterbrain.

Video for adding your own graphics
Sprite Creator 3 - Remove all built in images.




Mohamed Asfour Cut Sprites: This software can select all sprite locations automatically and cut them into separate images.

Video demonstration



Spricer v0.2: This is like a more advanced version of Hohamed Asfour's cut Sprites. This software can select all sprite locations automatically and cut them into separate images. It has a few more options.



Spricer Beta v8-21-2012 Similar to Spricer 0.2, but with more features.

Video demonstration



Alferd Spritesheet Unpacker: This is another sprite cutter like Spricer.

Walkthrough and video



dcarlile's Sprite Sheet Creator: This is a packer software for making spritesheets.

Website



amakaseev's Sprite Sheet Packer: This is a basic spritesheet packer.

Website

-Support multiple screen resolutions
-Pack multiple sprite sheets at once
-Trimming / Cropping (Save space by removing transparency)
-Include GUI and command-line interface.


Update:
I updated this post: spritesheet editors

Added:
-Mohamed Asfour Cut Sprites
-Spricer v0.2
-Spricer Beta v8-21-2012
-Alferd Spritesheet Unpacker
-dcarlile's Sprite Sheet Creator
-amakaseev's Sprite Sheet Packer

The spritesheet unpacker is really handy, thank yu for sharing it !

Quote from: MetalZelda on January 28, 2017, 03:54:50 AM
The spritesheet unpacker is really handy, thank yu for sharing it !

You're welcome! Some of these free software were difficult to find. Spricer Beta was almost impossible to locate. It is sad that great tools like these are either dead or no where to be found.