Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

faire des jeux pour le simpl integrated terminal (sorry if its not the good words english isnt my first language)

A topic by Asm23 created 35 days ago Views: 251 Replies: 26
Viewing posts 1 to 10

so canvas method is good but i like those ascii art game made for running in terminal and i wondered if it could have a way to make game for the simpl interactive console using ascii art as graphisme i mean output can render space character you can using comand line input like in real terminal everything would be written in pseudo code sprite would be build line after line and something akin to regex replace would do animation and movement exemple :

 //blinking cat  just an animation that make a cat blinking when user type pet it in the comand line

declare scene : asciiart

cat ( 

   row1 :"       A----A               "

   row2 : " =(  0       0  )=___)  "

   row3 : "        !-----!-------!  "

)

output cat 

declare wish : string 

output "what do you want do do with this cute cat ?"

output "                         [ Pet it | Do nothing ]                          "

input wish 

if wish >= "Pet it" then

  Match (cat.row2('0        0')

  replacement ('--       --')

  cat=(row1+row2replacement+row3)

endif


you can modify the syntax but i think it would be a nice add on

(+1)

Hi, and thanks for the first post on the forum! Your English is fine, I understood the idea well: games made of ASCII art that run in the SIMPL console, like terminal games.

Good news: your blinking cat already works in SIMPL today. A sprite can be an array of strings, one per row, and a small FUNCTION can replace part of a row. Paste this in GU{I}DE, press Run, then type Pet it:

// Blinking cat: an ASCII-art sprite in the console
// The sprite is an array of strings, one per row
DECLARE Cat : ARRAY[1:3] OF STRING
DECLARE Wish : STRING

// Replaces the first Found in Text with Changed
FUNCTION Replace(Text : STRING, Found : STRING, Changed : STRING) RETURNS STRING
    DECLARE Position : INTEGER
    FOR Position ← 1 TO LENGTH(Text) - LENGTH(Found) + 1
        IF MID(Text, Position, LENGTH(Found)) = Found THEN
            RETURN MID(Text, 1, Position - 1) & Changed & MID(Text, Position + LENGTH(Found), LENGTH(Text))
        ENDIF
    NEXT Position
    RETURN Text
ENDFUNCTION

PROCEDURE DrawCat()
    DECLARE Row : INTEGER
    FOR Row ← 1 TO 3
        OUTPUT Cat[Row]
    NEXT Row
ENDPROCEDURE

Cat[1] ← "    A-----A"
Cat[2] ← " =( 0     0 )=___)"
Cat[3] ← "    !-----!-----!"
CALL DrawCat()

OUTPUT "What do you want to do with this cute cat?"
OUTPUT "[ Pet it | Do nothing ]"
INPUT Wish
IF UCASE(Wish) = "PET IT" THEN
    Cat[2] ← Replace(Cat[2], "0     0", "-     -")
    CALL DrawCat()
    OUTPUT "Purr..."
ELSE
    OUTPUT "The cat goes back to sleep."
ENDIF

The cat first looks at you, then closes its eyes when you pet it:

    A-----A
 =( 0     0 )=___)
    !-----!-----!
What do you want to do with this cute cat?
[ Pet it | Do nothing ]
    A-----A
 =( -     - )=___)
    !-----!-----!
Purr...

What SIMPL can’t do yet is clear the console or redraw in the same place, so each new frame appears below the old one. A Replace function in the string library and a way to clear the console are now on my list of ideas. I can’t promise when, but your post is the reason they are there.

For real-time games (keys without Enter), the Canvas is still the way: KeyDown and KeyPressed read the keyboard while the game runs.

Hello its me i made a new account because the other is locked on my computer I just wanted to say thank you and ask if a mobile version (as apk file not google play download) is in your plan because I would love to use simpl on the go 

also an epub version of the guide would be good

The manual is now available as an EPUB e-book: you’ll find it on the SIMPL page, next to the Windows and Linux downloads. It’s tested with Thorium Reader and Google Play Books. Let me know how it reads on your device!

Hi, and thank you so much for your kind words, I’m really glad you enjoy SIMPL.

About a mobile version: an APK would be interesting, but it isn’t a matter of packaging what’s already there. SIMPL’s interface would have to be rebuilt from scratch for touch screens to offer the same level of UX, and that’s a big job. Right now I’m focused on expanding and refining the Windows and Linux versions. The same goes for a possible browser version: building the UI without constraints of any kind is what allowed me to refine it and set it up exactly the way I wanted, and to me that’s a central part of the user experience, which is so often spoiled by interfaces that aren’t well thought out or user-friendly.

That said, I don’t rule anything out, so I may well consider these suggestions in the near future.

An EPUB version of the manual, on the other hand, is a great idea and much more within reach: I’ll look into it for an upcoming release, so you can read it on your phone or e-reader on the go.

Thanks again for the feedback!

I'm happy to hear this and with a epub version you could take the guide out of the mobile version so it would left more space for the others ui elements and I understand that its hard to create a new interface especially for something as big as Simpl

Thanks! It’s an interesting idea, and it would make things simpler on a phone. Still, I’d rather keep the manual inside SIMPL in any version: opening an example straight into the editor, or jumping from an error to its explanation, is one of the things that help most when learning. The EPUB would be a companion for reading on the go.

Thanks again for the suggestions!

(1 edit)

thank for listening to my ideas and taking the time to answer me so fast 

 (^_^) 
(+1)

You’re welcome! Feedback like yours is really useful, so feel free to share any other ideas or problems you run into.

Well I don't know if its because I run linux in dual booth but I can't open the appimage even after dojng what you said in the download note perhaps its just because I don't have a lot of space in the linux side of my pc j

It run good on the window side through 

I use ubuntu in dual boot with a hp pavillon using window 10 on the other side (yes I know my pc is old hihi) I didn't wanted to talk about this problem before because it work really great on the window side and I didn't wanted to bother you..


Oh also it would be good to hide exemple's answer so user can try to solve them by themselves before reading the solution

No bother at all, reports like this are exactly what I need, thanks!

About the AppImage: since you’re short of space on the Linux side, did you save it on the Windows partition? Ubuntu usually mounts Windows (NTFS) partitions without permission to run programs, so chmod +x has no effect there and the AppImage won’t start. If that’s the case, moving it to your home folder should fix it.

If it still doesn’t start, could you open a terminal in its folder and run:

./simpl.appimage

and send me what it prints? If there’s an error about FUSE, this should work instead:

./simpl.appimage –appimage-extract-and-run

About the answers: the solutions to the exercises are already in a separate appendix (Appendix G), so you can try them first. Did you mean the output shown right below the examples in the chapters? A “predict before you run” mode, where you write what you expect a program to print and SIMPL compares it with the real output, is already planned, and it sounds close to what you have in mind.

I'm not really good in informatic its my bestfriend that put ubuntu on my pc but as soon that I have some time (probably the weekend after this one) I'm going to try what you sai


Yes it was what I meaned thank 

No hurry at all, try whenever you have time, and your friend can help you with it too. The simplest thing is to move simpl.appimage into your Home folder, then right-click it, choose Properties and turn on “Allow executing file as program”. If it still doesn’t start, just let me know and we’ll try to figure it out.

sorry for the big block of text I'm autistic and Adhd with a very big problem with my punctuation

No need to apologise at all, your messages are perfectly clear. Write however it comes, what matters is the ideas.

(+1)

Thanks and don't worry about ideas I have a lot of them

Here is a little cat 

Meow            
   A---A,,,,,_)
 ={@ _ @}=   | 
   \---------/

on a positive note I like the syntax highlighting colorscheme it's very aesthetic

Thank you! I spent quite some time on those colours, so I’m really glad you like them.

thanks for the epub

You’re welcome.

hi im sory but could it be possible to add color to the text wrote in the console to make multicolored ascii game or things like that

What you’re asking is theoretically already possible using SIMPL’s Canvas feature. I was putting together an example to post, but while doing so I discovered a hidden bug in the DrawText instruction that affects the final result. I’ll be fixing it in the next release and will share the example I mentioned for creating color ASCII games with the Canvas at the same time.

As a side note, since I see you appreciate SIMPL, could I kindly ask you to rate it 5 stars here on Itch and maybe give it a like on AlternativeTo.net? This would help give the project some visibility and help other people discover it. I’d really appreciate it.

done  and thanks

Thank you very much. I expect to publish the new release with the fix for the bug I mentioned in the next few days, along with the code for the ASCII game example made with the Canvas, which I will post here for you.

(+1)

Here’s the simple ASCII demo game I promised you. You can start studying it now; the next release of SIMPL will include the fix for the bug I told you about, the one that keeps it from running at the right speed, which I’ve already fixed in my local working copy.

// ============================================================
//  STAR CATCHER - a tiny game made of ASCII characters
// ============================================================
//  Stars fall from the sky: catch them with your basket \_/.
//  Left and Right move the basket. Miss three stars and the
//  game is over.
//
//  HOW IT WORKS
//  The window is divided into a grid of square cells, like a
//  sheet of squared paper: 20 columns and 16 rows. Each cell
//  holds at most one ASCII character: a star is a "+", the
//  basket is "\", "_" and "/" in three cells side by side, the
//  ground is a row of "=".
//
//  The game remembers only WHERE things are, as a row and a
//  column of the grid (StarRow, StarCol, BasketCol). Many times
//  a second it does the same three things, the GAME LOOP:
//    1. Input:  read the keys, and move the basket.
//    2. Update: move the star, check whether it was caught.
//    3. Draw:   clear the window and draw every character
//               in its cell, then show the result.
//  Moving a character from one cell to the next and drawing
//  everything again is all there is to an animation: like the
//  pages of a flip book, each frame is a little different from
//  the one before.
// ============================================================

// ---------- The grid ----------

// The size of the grid, in cells, and of one cell, in pixels
CONSTANT Cols = 20
CONSTANT Rows = 14
CONSTANT Cell = 24

// ---------- What the game remembers ----------

DECLARE Screen : Canvas
// Where things are: a row from 1 (top) to Rows, a column from 1
// (left) to Cols. The basket is always on the last row, so only
// its column changes, and BasketCol is the column of its "\".
DECLARE BasketCol, StarRow, StarCol : INTEGER
DECLARE Score, Lives : INTEGER
// The clock of the falling star (see step 2 of the loop)
DECLARE FallTimer, FallInterval, LastTime, Now : REAL
// Which of its two shapes the star has now: it twinkles
DECLARE Twinkle : BOOLEAN
DECLARE Col : INTEGER

// ---------- Two procedures ----------

// Draws Text in the cell at Row and Col of the grid. This is the
// only place that turns cells into pixels: column 1 starts at
// x = 0, column 2 at x = Cell, and so on (4 more pixels move the
// character towards the middle of its cell). Everywhere else the
// program thinks in rows and columns, not in pixels.
PROCEDURE Put(Text : STRING, Row : INTEGER, Col : INTEGER)
    CALL Screen.DrawText(Text, (Col - 1) * Cell + 4, (Row - 1) * Cell, Cell)
ENDPROCEDURE

// A new star at the top row, in a random column from 1 to Cols
PROCEDURE NewStar()
    StarRow ← 1
    StarCol ← INT(RAND(Cols)) + 1
ENDPROCEDURE

// ---------- Getting ready ----------

// The window: as wide as the grid, and two rows taller than the
// sky, for the ground and the score
Screen ← NEW Canvas(Cols * Cell, (Rows + 2) * Cell)
CALL Screen.SetBackground(10, 10, 30)
BasketCol ← Cols DIV 2
Score ← 0
Lives ← 3
// The star falls one cell every 0.25 seconds at the start
FallInterval ← 0.25
FallTimer ← 0
LastTime ← TIME()
CALL NewStar()

// ---------- The game loop ----------

WHILE Lives > 0 AND NOT Screen.ShouldQuit()

    // 1. INPUT
    // KeyPressed is TRUE only in the frame in which the key goes
    // down, so each press moves the basket by exactly one cell.
    // The basket can't leave the grid: its "\" stays from column
    // 1 to column Cols - 2, so that its "/" is still inside.
    IF Screen.KeyPressed("Left") AND BasketCol > 1 THEN
        BasketCol ← BasketCol - 1
    ENDIF
    IF Screen.KeyPressed("Right") AND BasketCol < Cols - 2 THEN
        BasketCol ← BasketCol + 1
    ENDIF

    // 2. UPDATE
    // The loop goes round about 50 times a second, faster or
    // slower depending on the computer. To make the star fall at
    // the same speed everywhere, the program measures time with
    // TIME() (seconds since the program started): FallTimer adds
    // up the time that has passed, and each time it reaches
    // FallInterval the star moves down one cell.
    Now ← TIME()
    FallTimer ← FallTimer + (Now - LastTime)
    LastTime ← Now
    IF FallTimer >= FallInterval THEN
        FallTimer ← FallTimer - FallInterval
        StarRow ← StarRow + 1
        // A different shape at each step: the star twinkles
        Twinkle ← NOT Twinkle
        IF StarRow = Rows THEN
            // The star has reached the basket's row. The basket
            // fills three cells, from BasketCol to BasketCol + 2:
            // the star is caught if its column is one of them.
            IF StarCol >= BasketCol AND StarCol <= BasketCol + 2 THEN
                Score ← Score + 1
                // Each star caught makes the next ones a little
                // faster, down to 0.08 seconds per cell
                FallInterval ← MAX(0.08, FallInterval - 0.01)
            ELSE
                Lives ← Lives - 1
            ENDIF
            CALL NewStar()
        ENDIF
    ENDIF

    // 3. DRAW
    // Clear wipes the whole window with the background color, and
    // everything is drawn again where it is now. Nothing has to
    // be "rubbed out" from where it was before.
    CALL Screen.Clear()

    // The star, in yellow: "+" and "x" in turn, so it twinkles
    CALL Screen.SetColor(255, 230, 80)
    IF Twinkle THEN
        CALL Put("+", StarRow, StarCol)
    ELSE
        CALL Put("x", StarRow, StarCol)
    ENDIF

    // The basket, in light blue: one character in each of its
    // three cells, so it is exactly three cells wide, as the
    // test in step 2 expects
    CALL Screen.SetColor(120, 220, 255)
    CALL Put("\", Rows, BasketCol)
    CALL Put("_", Rows, BasketCol + 1)
    CALL Put("/", Rows, BasketCol + 2)

    // The ground, in green: an "=" in every cell of the row
    // under the basket
    CALL Screen.SetColor(90, 160, 90)
    FOR Col ← 1 TO Cols
        CALL Put("=", Rows + 1, Col)
    NEXT Col

    // The score, on the last row, in smaller characters
    CALL Screen.SetColor(230, 230, 240)
    CALL Screen.DrawText("Score " & STR(Score) & "    Lives " & STR(Lives), 8, (Rows + 1) * Cell + 4, 20)

    // Everything drawn so far appears in the window at once, so
    // the player never sees a half-drawn frame
    CALL Screen.Show()

    // A short pause before the next frame: it lets the computer
    // rest, and WAIT also reads the keys pressed in the meantime
    CALL WAIT(0.02)
ENDWHILE

// ---------- The end ----------

// The last frame stays on the screen for two seconds, with the
// game over in the middle of the sky
IF Lives = 0 THEN
    CALL Screen.SetColor(255, 90, 90)
    CALL Screen.DrawText("GAME OVER", 138, 130, 48)
    CALL Screen.Show()
    CALL WAIT(2)
ENDIF
OUTPUT "Game over! You caught ", Score, " stars."
CALL Screen.Close()

Wow thanks