Showing posts with label documentation. Show all posts
Showing posts with label documentation. Show all posts

Friday, July 12, 2024

Hardware and porting

This is a list of some good links for archival and to make them easier to find if someone didn't know them.

Basic but indepth intro to the Vita hardware for developing homebrew:

General guide on how to port games for vita:

Android games and how to swap assets for vita use:

Yoyoloader (game maker) basic requirements:

Thursday, February 22, 2024

Visual Novel with renpy

Another engine, again...

I wanted to test out a Visual Novel Demo. Which means: "Different goals, different methods".

Let me assure you, I am not leaving behind the samples with SDL from the beginning of this blog, I am also not going to stop using Godot for many of my projects (at least for now). This is "only" another extra tool for my bag.

Question: Why now?
Answer: Now, because Ren'Py, like Godot, is in active development. In future iterations compatibility might break, with this Demo I can write down the version that works for the vita before it's too late (you don't want to keep trying versions in the future to find one that can export without crashing).
If a new one works, go ahead and use it, if they don't, you have this one as a back-up.

Question: Why Ren'Py?
Answer: Because Ren'Py is open source and free for commercial use. This engine is also one of the most widely known and used for Visual Novels. It works nicely for PS Vita (loading times aside), and It's easy to use.


With that explained, it's time to get our hands dirty. I decided to call this Demo "Conociendo Hokkaido" to make a somewhat nice presentation of the place in the future and, at the same time, present the Ren'Py
basics too. This time (entry) however, will be mostly about how to set everything up, and make a sample VPK build for the vita. [At the end of the entry, you will find a link to a GitHub repo with this project]

To be fair, most of the engine is pretty straightforward or is explained in their quick start guide https://www.renpy.org/doc/html/quickstart.html (in addition to the whole documentation). However, a few adjustments are necessary to make them work with the PS Vita. Besides, some features (like input) may crash the PS Vita.

The first we need is the engine and the means to export for the vita, to do that, I've used:
Ren'Py Version used: Ren'Py 7.3.5.606 ( https://www.renpy.org/release/7.3.5 )
Ren'Py PSVita Distribution Tool: (crash report says) 7.4.9 Ou ( https://github.com/SonicMastr/renpy-vita )

With that out of hands, let's boot up Ren'Py and create our project:

Since we are making the project to play in the vita, we'll use the console resolution (960, 544). Other than that, just create your project normally:

> 'Create New Project' > Project Name > 'Custom. The GUI is optimized for a 16:9 aspect ratio.'
> WIDTH: 960 > HEIGHT: 544 > Select Accent and Background Colors.

You can see an example in the image below:


When it finishes, it creates a new folder with all the default files. We can now edit them to make our Visual Novel.


We will need to have PS Vita livearea files eventually, I put them here too so they can be found easily.


Besides, I added a few files for my Demo to make it more personal (If we were making a full project, this is how you add them too). [You can omit this step if you are just setting up the engine]

Conociendo Hokkaido > Game > images
Conociendo Hokkaido > Game > audio
Conociendo Hokkaido > Game > gui

Something like the following image:


Back to Ren'Py, if you have received an already created project, and it doesn't show on your project list, you can press on refresh to make them appear.


The basic GUI of the engine displays the following:

> Edit file (it has the code for your game):
    It is useful to say that you can open all rpy files with any text editor of your likeness.
    [This may be worth it to check (or ask) things without opening the whole Ren'Py launcher]


    # options.rpy contains options that can be changed to customize your game.

    # script.rpy contains the actual script for your game

    # gui.rpy contains the GUI Configuration

    # screens.rpy contains the configurations for the screens used to display dialogue to the player.


> Actions (it has some autoconfigurations to check your game's files to look for potential problems)

> Build distributions (is what you expect)
    * The vita export doesn't show here because the tools for it are unofficial.
    

To summarize, in this demo: I've added music, a scene with two minibranches, and one common ending.

* I've also tried to use the input method with the vita keyboard:

```
    $ pName = renpy.input("Write your name and press enter to start the game.", length=10) or "Bunkai"
```

At first, it saves the input (or the lack of it). After that, it glitches out and prompts the keyboard again (this second time the input is not used). As a result, the dialogue for the input prompt and the dialogue right after your first input will be hidden by the keyboard screen.
[None of this happens in the PC version. That resulted in me commenting the input for the time being]


With the basic features somehow finished, and being myself from Spain, I also wanted to have the demo translated (or at least to make the option easy). I used the official documentation for it,
https://www.renpy.org/doc/html/translation.html . However, for me, these explanations were a bit confusing in some parts, and I had to make some trial and error. As a result, I think it's a good idea to share a step by step here with screenshots.

First, we need to know where the default language is stored (it will help us to avoid headaches later):
 `This is called the None language, regardless of what language it actually is.`
We can find the files at: Conociendo Hokkaido > Game > tl


Now it's time to go back to the launcher and generate the translation/localization files.
To do that, go to the 'Generate Translations' section:



A bit overwhelming menu will be displayed, but don't get discouraged, this is what we need to know:


> Language: This is the name of the target language of your translation files.

> Generate empty strings for translations: as the name implies, you will see your Localized lines empty or filled with the original text. (This difference will be shown in the print screen with the translations, where it is the clearest)
 
When the settings are done, press on 'Generate Translations' and the new files will be created.

Before actually translating the sentences, we also want the language option to show in our game. This part is pretty important, and the instructions in the guide could be easily overlooked (or difficult to follow) for a beginner, making a quest to find were the new code goes. To fix this, here's another example:
 
`The Language action can be used to add a language preference to the preferences screen:`

> The path is as follows: 'Project's name' > Game > screens.rpy

Scroll down, until you see something like this:

```
## Preferences screen ##########################################################
##
## The preferences screen allows the player to configure the game to better suit
## themselves.
##
## https://www.renpy.org/doc/html/screen_special.html#preferences
```


Then add/edit this block there:

```
                vbox:
                    style_prefix "pref"
                    label _("Language")
                    textbutton "English" action Language(None)
                    textbutton "EspaƱol" action Language("es_es")
```

[you can put as many extra languages as you want the same way, just add more textbuttons)]


It's time to launch the game within the engine and see the results:
(a new language option has been added)


Now it's time to really translate/localize the game, the files to do that are in the following path:
'Project's name' > Game > tl > 'the previously input name for the new language'
You can see a comparison with the default language from the script in the image below:



'screens.rpy' for menus and preferences
'script.rpy' for the story text
'common.rpy' for prompt messages


The last step is to export our project to play in our beloved PS Vita. To do that, We need to copy the whole project folder from Ren'Py directory to the Ren'Py PS Vita Distribution Tool. It will look like this:


Here, run the 'Ren'Py PS Vita Distribution Tool.exe' and the export config window will be displayed:


The 'Build VPK0' button will not activate until you have filled the blankets, so don't worry. Extra notes to have into account:
 
> write the version parameter with the '00.00' format, or the VPK installation will fail.
> include your 'sce_sys' folder inside your project's folder (like I did in 'Ren'Py)


With that, you have a working Visual Novel Demo for your PS Vita. If you want to try the one from this entry, or use it as the starting point for yours, here's the link to the GitHub repo:
https://github.com/Bunkai9448/ConociendoHokkaido_renpyVita


---

Aditional notes: 

- No self-voicing, as the vita doesn't have TTS

- Load times can be pretty long due to hardware limitation.

- Video playback will not work

- Quiting by the menu will crash the app, but 
doesn't affect anything else.

Friday, October 13, 2023

Godot 3.5 AI

Since one of the "near" future steps for the ice puck game I had to see how to implement the NPC AI, and I want to leave a few documentation/guide videos. All with explanations and examples, plus a description of mine here so you can remember at a glance. [Remember you can use any of them if it fits you, I'm only giving hints]

State machine
https://youtu.be/RzUkBT7QwrU?si=OirslGHuHIs2kIDk
These are your usual platformer ones, mario like, where the enemy has a pattern that repeats over and over, no matter what.

Behaviour tree
https://youtu.be/YHUQY2Kea9U?si=oxl2viKZpWvxe0mG
These are more seen in fighting and shooter games, I believe racing games could go here as well. The enemy has a tree and different paths with minimum weights, to select the most efficient to their task. Your enemy doesn't take into account your life or score, it wants to finish you. 

GOAP
https://youtu.be/LhnlNKWh7oc?si=ct5vAyN4yCuv3nf_
The Goal Oriented Action Planning (GOAP),
which is the one I'm probably going to use. This one uses the priorities given for their goals, hence why for a sport game could be pretty useful. For example, the enemy takes into account if it has more or less goals than you, to decide if defence the net or attack.


Saturday, October 7, 2023

New Engine

I had a secret halted demo game for a long time (due to some nasty bugs), so when I found out about the new Homebrew contest for the vita I knew it was time to squash them and release it: https://fuhen.homebrew-contest.com/submissions/23/ 
 
Besides, thanks to the FuHEN Homebrew Contest for PS VITA, I discoverd some options that I didn't know. And since this blog is to develope homebrew for that console, I decided to add the info here. After reading around the resources page: https://fuhen.homebrew-contest.com/resources/ I discover a new interesting option for coding my Ice Puck homebrew, which is the Godot Engine: https://github.com/SonicMastr/godot-vita/releases/tag/3.5-rc5-vita1 
 
Official documentation for Godot 3.5 here:

Then, I tried to make a test exporting the game "3D Squash the Creeps starter project" (which also is a good introduction to the engine for beginners). A video explanation of how to code it can be found here: https://www.youtube.com/watch?v=YiE9tcoCfhE and the code's official repo is here: https://github.com/gdquest-demos/godot-3-getting-started-2021/releases/tag/1.0.0 
 

 As explained in the README, for it to work on the vita, we need to make a few adjustments to the project settings. 
(For newbies who don't find that config in the engine) I will explain those steps below, with screenshots: 
 
 Go to Project > "Project Settings..." 
 

 
 
Click on Search and type "GLE2" 
Then click Quality and mark the box "Fallback to GLE2" 
 
 

 
Next it's turn to: Click on Search and type "ETC2" 
Then click on VRAM compression and mark the box "Import ETC2"
 
 
 
After that, close the window. 
 
 
Finally to export your game: 
 
Go to Project > "Export..." 

When it asks for an export template, choose and load the "vita_template_3.5.rc5.tpz" file from the github.

 



Time to make and play your own games!

Friday, April 21, 2023

Some documentation

This entry provides papers and documentation on many key topics like:

   - Ice Hockey - Quick Guide
   - Game Programming Patterns
   - Scaling Screen
   - Simple DirectMedia Layer (audio, keyboard, mouse, joystick, and graphics hardware)
   - NPCs movement, a.k.a. AI and Steering Behaviors.
   - Multiplayer: Client-Server Game Architecture
   - Game pad controls reference
   - Writing your own Load / Save routines
   - How to choose a License

* The list should be updated along the project.

---------------------------------------------------------------------------------------

- Ice Hockey - Quick Guide
https://www.tutorialspoint.com/ice_hockey/ice_hockey_quick_guide.htm

- Game Programming Patterns, Robert Nystrom
https://gameprogrammingpatterns.com/

- Scaling Screen
https://gamemaker.io/en/tutorials/the-basics-of-scaling-the-game-camera

- Simple DirectMedia Layer (audio, keyboard, mouse, joystick, and graphics hardware)
https://wiki.libsdl.org/SDL2/FrontPage

- Create a Hockey Game AI Using Steering Behaviors: Game Mechanics
https://gamedevelopment.tutsplus.com/tutorials/create-a-hockey-game-ai-using-steering-behaviors-game-mechanics--cms-23026

- The Nature of Code, Daniel Shiffman
https://natureofcode.com/book/

- Client-Server Game Architecture, Gabriel Gambetta
https://www.gabrielgambetta.com/client-server-game-architecture.html

- Game pad controls reference, from EA's NHL games
https://help.ea.com/ca/help/nhl/nhl-16/nhl-16-controls/

- Writing your own Load / Save routines, Myopic Rhino
https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/writing-your-own-load-save-routines-r1289/