Showing posts with label Bmax. Show all posts
Showing posts with label Bmax. Show all posts

Sunday, September 27, 2020

Bmax - buttonDash 01

 
Having a selection menu means you can call differents apps or modules, now we need modules to launch.
We have decided to start with a simple and easy minigame.
[The minigame will be named buttonDash, a description is comming later]

First we need to create a new btnDash.c file to work on, and add it to the CMakeLists.txt
[Reminder : This is an specific module or game inside the main app (BMAX)]

updated CMakeLists.txt


The following is to create a function in btnDash.c, we will name it btnDashGame().
This is the function we are going to launch from common.c.

With this, we update the common.c file, in the selectedApp to launch the buttonDash:
[This line goes inside selectedApp function]

if ( !strcmp(selApp,"buttonDash") ) btnDashGame ();

----

[Normally, you know what kind of modules or games you want to do before starting the project. And you do a specific menu for them. However with a launcher this part is sticked to each module. The launcher just call them, that is why we did not mention any of this before.]

We got the code ready to call our new module, it is time to decide what module is going to be.
[This part comes with idea brainstorming, but here we will go just directly to the picked idea.]

Here is a briefly explanation of what are we trying to achieve in this module:

- A minigame with highscore, and current score. Highscore will be saved in a file, for future replays.

- A game flow guided by the speed of pressing buttons correctly. A failure reset the current score.

- The button to press will be showed on screen. One button appears at a time. If no button is pressed in a specific time interval, the game will count this as a failure and, it will pass to the next button.

- An increasing difficulty based in the current score. The difficulty will have 3 stages:
   - Button image shown highlighted, 60 sec before next button appears.
   - Button will not be highlighted, 60 sec before next button appears.
   - Button will not be highlighted, 30 sec before next button appears.
[Higher difficulties with less time may be added later. Another difficuly could be show wrong button to confuse.]

- A pause menu. This screen is to be determinated.

Having the bases of the module, the next step is to draw the flowchart.
[Pseudocode could be used too, but the flowchart makes the big picture clearer. In addition, both can be done together or, done one after another.]

Warning: There are some "steps" that can be omitted, if the knowledge of the rendering were farther (which won't be done in this module).


Button dash flowchart

Tuesday, September 22, 2020

Bmax part 3.2

This entry is about making the main loop to follow the flowchart. The code will be on the main.c file, and it will (most probably) be the last one done in this file. After this, the code will be done particularly to each module, and a few lines in common.c to launch each module.
[Remember that, we are using this flowchart]

We will want to add a confirmation screen, when the user wants to exit. Right now, we have done a dummy function for that.

dummy to know if the user wants to exit


To create the flow in code, we are using a do while loop. The reasons of this are:
 - The app should, at least, show the menu at the begining.
 - We want to show this menu every time the user close any inside module (app).

To control the loop, we will need a variable which changes when the user ask to exit.
Everything else is just directly follow the flowchart.

Note: the chooseLang must be asked before the loop once, if we don't want to ask the user constantly.

main loop in main.c file

With this, it comes the first official release, go to https://homebrew-psvita.blogspot.com/2020/08/main-projects-plan-000.html and check it out.

Bmax part 3.1

In this entry we are making the functions of the main loop.

First, we declare the functions in common.h:

declare new functions in common.h

Now to code the appSelect() function, we are using the same idea of chooseLang() explained here. However, the options offered have changed. Options now:
 - help (default answer in bracket)
 - chooseLang
 - button_dash
 - exit

After doing that, we should check everything is ok, and we don't have made any typo or something. This is made by doing the main just launch it, and printing the answer (launching nothing afterwards).

main.c to check appSelect()

With this assured, we can go to implement selectedApp():

This function is basically a column of ifs with string comparison, where each option launch a function.
It will also receive two arguments, the selected app and the language to use.


selectedApp()


If everything is correct (which it is), now we have our selection menu up and running. We can do a test with:

main.c with code to check our main menu


The only thing left now is to make the loops to keep the game running, until the user wants to exit.

Monday, September 21, 2020

Bmax part 3

Up to now, we have some basic required funtions for the app. It is time to give it another essential feature, we will implement the main flowchart. To do that, we will use the one we did here.

To implement the flowchart, we need to decide a few things:

 - How are we going to get the user input?
   The user will write what he wants to do.

 - Where will the main menu go? after or before chooseLang?
   Better chooseLang right away the app init, and then main menu with option to changeLang again.

 - Which text are going to show on the selections screen?

 - Some flow decissions, that are made on the flowchart, will be explain directly on the code.
   [This should be writen in the draft with the flowchart on more official documents.]



Note 1: To make things easier, the selection menus will only have the default english ime. However we will try to make the sentences short and globally known.

Note 2: After making these selection menus, we can delete previous functions on main, and leave only these two new ones. With this, in theory, we won't have to modify main.c file again.

Note 3: To implement this, we will use one loop in each decission triangle. This will be BMAX's main loop, from there it executes other modules, or it just wait the user input.


Saturday, September 12, 2020

Bmax part 2.5

 This is the 2nd entry of the BMAX help function. After thinking about that, we have decided that is easier to choose the language with the IME as it lets you write the language directly with the ps vita api.

As we are using the ime and the ime will be used again, we have decided to make another file to have the ime variables and functions easy to find and modify (using the ime sample code).
We will call it (keyboard display -> ) kbDisplay.h


kbDisplay.h


To do the function ChooseLang, we are going to ask the user to introduce the language with the initials (e.g. ENG for english), using the ime to get the input. After that we are returning it as a result, to have it outside. Currently, we have 3 languages included, but we can add any simply repeating the if statements with each lang.

Note: more info about the initials here https://iso639-3.sil.org/code_tables/639/data

Note: as a base code we have used the ime sample.


chooseLang function

Wednesday, September 9, 2020

Bmax part 2

 In this next 2 entries we are going to make the function to call the help, in order to make it able to read different files depending on the language chosen by the user. [This will be divided in 2 functions, one to chose the language and another to trigger the help]

First we need to define (in main.h) and create the function (in common.c).

With that done, we have to make it read the buttons to know the user election.

We make that using the sceCtrl functions. as an entry point we write a function
that prints a text to let the user know how to stop it. And then keeps checking in loop
until the user stop it. Code below:

function definition


function code


* Note: we have made a new file (screen.c) to have everything related to the rendering (currently with sdl) and functions in common.c separated.

adding screen.c to the CMakeLists.txt


After that we have to put a way to give the different options for him to choose. This should be a visual option (graphics rendered on screen or ime dialog) which will see in the next entry.

Friday, August 28, 2020

Bmax logo

 It is not a good app if it doesn't have a good logo, we had one for testing, today i wanted to make a representative one.

For that, i decided to use all the name letters and create a face for him in paper:

first draft in paper



And after that i give him the colors i used in the screen of the app to give him his own personality:




computerized logo with representative colors

Bmax part 1.5

Now that we have the basic estructure, we will create a mini function to print errors and dump the text into a readable file for future debugging purposes. we are going to call this function when we check for bad results.

Although a good debugger would be desirable, we use this as a temporal patch.

The function will be declare in the main.h and written in the "common.c" file.


debugLog function

Friday, August 14, 2020

Bmax part 1

 In the previous entry we got the basic environment of the homebrew, now we want to make it modular. This will make the project easier to mantain and upgrade.

For this goal, we have to make separate files for the headers and the main module (main.h and main.c). From now on, we are also going to do something similar for each "Bmax's function" (sub module).

At the end of this point we will have 4 files created/updated, but in the future will be adding more files.

In the main.c file we only leave the main function with: init, program_loop (currently redrectangle), and quit.

main.c step



In the main.h we will have definitions of data types, function prototypes and C preprocessor commands.
(How to write your own header file in C). (we surely need more files like this)

main.h step


In the common.c we will write the generic functions we are going to call (we surely need more files like this).

common.c step



In the makefile we are adding the new c files that we want to add to the compile process, in the "add executable" section

makefile step




Note: debugScreen is added for future debuggin purposes. also a function for that goal has been created.

Thursday, August 13, 2020

Bmax part 0.5

 In this entry we will create the basic folders and files. For that goal we are going to copy and modify the pretty_livearea and the sdl/rectangle.

 From the pretty_livearea we are going to copy the whole folder. After that, we modify the makefile, and later the pictures, and the template.xml to adapt to our homebrew.

 The changes to the makefile consist in changing: project name, app name, app title, and link libraries (to add the sdl since we are using the make file from the pretty live area).

makefile
Modifying the makefile step 1

makefile
Modifying the makefile step 2


The changes of the template.xml consist on changing some texts with our data:

Modyfing the template.xml




From the sdl/rectangle we are going to copy the src/main.c file to ours.

Since it is the first entry of the project, and creating new picutures is not part of the blog, we stop here for today.

In the next entry we will have those pics changed acording to their needs, and we will start with the new code.

As a prologue of the following entries of this project, we are going to use this tutorial as a helper for the sdl library:
http://lazyfoo.net/tutorials/SDL/index.php

Note: also we may need the sdl part of the game controller and the joystick mapping:
https://wiki.libsdl.org/CategoryGameController

 ---

Screenshot from the project in the current state running on the vita

Bmax livearea

 

Wednesday, August 12, 2020

Bmax part 0

 Here we will write the initial flowchart of the Bmax project.

The main program will be the one who start with the app and with the list of modules to load.
Each module will be like a mini app inside the main one.

draft idea
 

With that idea in mind, we have created a basic flowchart to implement later.
 
 
flowchart


The modules though at this moment are:

  - a help file (will be multilingual in the future)

  - button_dash minigame

  - whack-a-mole minigame (touch controlled)

  - a clock (it will have some events hour dependent). it may be included in the main as secondary image in the future

  - more TBD (To Be Determined)


Link to Source files: https://github.com/Bunkai9448/BMAX