Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Projets de programmation


Index du Forum » Projets de programmation » Terrario, a Terraria rewrite for the calculator
Kbd2 Hors ligne Membre Points: 269 Défis: 0 Message

Terrario, a Terraria rewrite for the calculator

Posté le 10/07/2020 16:05

2021 Casio Awards winner, thanks everyone!

Hi. I noticed a while ago there weren't any games like Terraria or Minecraft available for Casio calculators. For the past while I've been working on rewriting Terraria in C for the SH4 calculators using gint. I'm not sure when if ever I'll finish it, since it is a fairly big project, so I've decided to put it here for now.

Here are a few screenshots of the progress so far (some may be out-of-date):
Main menu


Gameplay


Inventory


Crafting


Equipment


A visualisation of a generated world (click for full detail)



The game runs at 30FPS. Worlds are 1000x250 tiles large (640x250 on the 35+E II / GIII).

The control scheme and a crafting guide can be found in the game's About menu.

This forum page is updated regularly with the latest release of the game, as well as a changelog in the comments.

If you aren't sure what an item does, feel free to search it up on the official Terraria wiki.

Most recent update:
Jungle and a bunch of content.

Up next:
Who knows?

The attached file contains the latest build of the game, as well as instructions and a screenshot compiling script and map tool.

The source code repository as well as early builds of the game can be found at this GitHub repo and its Gitea mirror. Obviously, expect bugs in these early builds, though I take care to remove the major ones I find before releasing.

Due to the very large world, the save files for this game are big. Make sure you have at least 450kB of storage space before installing the addin (300kB on Graph 35+E II), and try to keep at least 300kB free afterwards. Tampering with the files in the TERRARIO folder will corrupt the save, so don't do that. The game will warn you if you have low storage space available, so that you can optimise your storage.

NOTE: You must have a Graph 35+ E, Graph 35+E II, fx9860GII, or fx9750GIII model calculator to run this game.

Fichier joint


Précédente 1, 2, 3 ··· 5, 6, 7, 8, 9, 10 Suivante
Kbd2 Hors ligne Membre Points: 269 Défis: 0 Message

Citer : Posté le 06/06/2021 09:39 | #


Right, I guess I was using an older gcc that allowed it or something
Lephenixnoir En ligne Administrateur Points: 24146 Défis: 170 Message

Citer : Posté le 06/06/2021 09:53 | #


Good. I also forgot the OpenLibm problem that you mentioned:

<KBD2> @Lephenixnoir Looks like the include path doesn't get set for openlibm, so even your sh-elf-gcc headers cause an error

Ok so OpenLibm has this issue where it installs itself in an openlibm/ subfolder but includes itself as if it were installed directly in an included folder. So it requires some -I option, which is documented on the repository.

For CMake-based add-ins I have made gint add the proper paths, which is transparent for everyone. But make doesn't have mechanisms where I can deploy code to your project through an fxSDK update, so you have to include it yourself. Here are the paths you need:

CFLAGS += -I $(shell sh-elf-gcc -print-file-name=include/openlibm)
LDFLAGS += -lopenlibm

This is also something I failed to mention in the changelogs because I forgot about Makefile-based add-ins.
Mon graphe (24 Mars): (gint#27 ; (Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; ...) || (shoutbox v5 ; v5)
Lephenixnoir En ligne Administrateur Points: 24146 Défis: 170 Message

Citer : Posté le 07/06/2021 17:47 | #


Since there was a (probably heap-related) problem yesterday I tried to see if I could find anything suspicious in the Terrario code.

I briefly mentioned the chest deletion code on the shoutbox where the replacement index seems to be invalid because of the extra division, even though this doesn't look like it would cause heap problems.

The realloc calls look good to me. Note that in general when reducing the size of the array realloc will not move the data and simply reclaim the extra space (unless the new size is 0 obviously).

I checked the whole NPC and marker logic more times than I care to admit (which is at least five), but couldn't find a visible bug; references in both directions seem consistant, no code seems to re-use a pointer after a call that can reallocate it, and everything seems to be initialized properly.

I suggest maybe try and reproduce the problem to find a common denominator ?

Ajouté le 08/06/2021 à 13:37 :
Picking up from your answers in chat...

<KBD2> @Lephenixnoir It doesn't happen every time either
<KBD2> Though if it doesn't happen it will reliably occur the next time
<KBD2> Made a little menu to easily display a bunch of ints, all the pointers have expected values
<KBD2> I'm only using 11.5k of the heap, actually less than I thought
<KBD2> Crash is still happening in the same place, the compiled arena_gint.c
<KBD2> Something weird's happening - if I don't free anything, the pointers are in the exact same place next run and the crash still happens
<KBD2> Does gint free the heap on exit anyway?
<KBD2> (This is when it doesn't crash on exit)
<KBD2> Oh, just got a juicy bit of info for you
<KBD2> The crash happens when exiting after using the About menu
<KBD2> So nothing is allocated on the heap and the crash happens
<KBD2> It's a lot less consistent but still happens in the same place
<KBD2> https://github.com/KBD2/terrario/blob/14e163828e7ed6c910876ad06a9944719fffed47/src/menu.c#L404 Something in here will cause that same crash occasionally
<KBD2> It's unlikely, but both the game loop and that menu call dfont
<KBD2> Pretty much the only thing I can see that both those do but the main menu doesn't
<KBD2> Confirmed that it only happens after the About menu is used

Not only is that juicy, it's perfect! I've narrowed down the cause of the crash to displaying this confetti image and reproduced the problem in a trivial add-in that just shows it.

I further found a problem with the image rendering code. Basically, the image renderer accounted for the image going past the edge of VRAM on the side left but not on the right side. The confetti image overlapped past the right side (because it is padded to width 64), which caused writes past the end of each line since the renderer was not careful enough. This extra write affects the leftmost part of the next line (which is invisible on the VRAM due to to what values are being written), or, in the case of the last line, some other variable stored after.

When using the gray engine, some of the VRAMs are allocated in the heap, so the "other variable stored after" is as you know part of the data structure maintained by the heap; and I think you know where this is heading.

Here is the commit fixing the problem. It is quite funny to see how many buffer overflows the new heap (which has not had a bug yet) has already revealed.

I have rebuilt Terrario with the fix and could not reproduce the problem anymore. Due to the fix I have released a new gint version 2.5.2, which also includes moving all the standard functions provided by gint to fxlibc. Starting now, <gint/std/*.h> users are officially useless, and you can include standard headers directly instead.

Thank you for your patience with this issue, and finding the precise About menu problem.
Mon graphe (24 Mars): (gint#27 ; (Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; ...) || (shoutbox v5 ; v5)
Kbd2 Hors ligne Membre Points: 269 Défis: 0 Message

Citer : Posté le 08/06/2021 15:43 | # | Fichier joint


Update:
- Added house markers and NPCs
- Make a valid house with a chair, workbench, and torches that's at least 60 tiles large.
- Press TAN inside it to place a marker; NPCs looking to move in will automatically claim it during the day.
- The Guide has no requirements to move in, and the Nurse will move in once you have increased your maximum health.
- Made movement a bit smoother over terrain changes
- And loads of bugfixes.


Aeron_Emory Invité

Citer : Posté le 10/08/2021 23:37 | #


I wish I knew how to install
Lephenixnoir En ligne Administrateur Points: 24146 Défis: 170 Message

Citer : Posté le 10/08/2021 23:40 | #


Just drop the .g1a file in the storage memory! Plug in the USB cable, in the popup on the calculator press F1, and the calculator will show up as a USB device on the PC. Copy the .g1a file there, disconnect, and then Terrario will be in the calculator's main menu.

More details in the file transfer tutorial; it's in French but a good translator will clear it up for you (if you have no preferred one I'd suggest DeepL).

Ajouté le 20/08/2021 à 22:06 :
I've having a very hard time playing Terrario today. Most of the worlds I create are unplayable because I die of fall damage upon spawning. The save feature also doesn't seem to work properly, leaving me with either an "Optimization was stopped" message or a crash, both resulting in empty void worlds when coming back (I have 1.5 MB space left, so no problem there). I was eventually successful at recording a couple of minutes of video footage (which was my goal and the reason I was building from source), then I pressed OPTN on accident and froze the program. Are you aware of any of these potential issues?
Mon graphe (24 Mars): (gint#27 ; (Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; ...) || (shoutbox v5 ; v5)
Kbd2 Hors ligne Membre Points: 269 Défis: 0 Message

Citer : Posté le 21/08/2021 01:36 | #


Yes, I was trying to wrangle a bunch of issues SegfaultDev introduced saving the player's position, though I thought I had fixed it - I'll see what I can do

Ajouté le 21/08/2021 à 01:51 :
I can reproduce the new world spawn bug, though optimisation and screenshots seem to work fine - are you using a GII model or GIII model?
Redcmd Hors ligne Membre Points: 380 Défis: 7 Message

Citer : Posté le 21/08/2021 02:09 | #


GII I believe
Kbd2 Hors ligne Membre Points: 269 Défis: 0 Message

Citer : Posté le 21/08/2021 02:09 | #


I believe I've fixed the spawn issue by changing what the game looks for when setting the spawn, though there are some underlying worldgen issues that may have caused it (mainly setting tiles at the very top of the world) that haven't been carried over to the map gen tool and so went unnoticed.
Lephenixnoir En ligne Administrateur Points: 24146 Défis: 170 Message

Citer : Posté le 21/08/2021 09:05 | #


Thank you for the quick response. I was using a G-III model yesterday specifically, though I have both. I'm also at fault here for building from source, and most problems are probably development leftovers; I was mostly worried about the save, since it's a crucial part of the game.

Edit: Ah so OPTN is the screenshot key, makes sense. Then it likely froze because I had been capturing live video until that point, with the USB module initialized early on.
Mon graphe (24 Mars): (gint#27 ; (Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; ...) || (shoutbox v5 ; v5)
Gladosse Hors ligne Membre Points: 229 Défis: 2 Message

Citer : Posté le 17/11/2021 14:57 | #


you can have multiple shades of black on the graph 35 E?
Lephenixnoir En ligne Administrateur Points: 24146 Défis: 170 Message

Citer : Posté le 17/11/2021 14:58 | #


Yes it's an illusion based on flicking the screen fairly fast (it starts working at 64 Hz, although it's very sensitive). Several implementations of this exist, the one used in Terrario is natively integrated in gint. I know Redcmd has implemented an engine outside of gint for his own purposes.
Mon graphe (24 Mars): (gint#27 ; (Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; ...) || (shoutbox v5 ; v5)
Gladosse Hors ligne Membre Points: 229 Défis: 2 Message

Citer : Posté le 17/11/2021 15:05 | #


Lephenixnoir a écrit :
Yes it's an illusion based on flicking the screen fairly fast (it starts working at 64 Hz, although it's very sensitive). Several implementations of this exist, the one used in Terrario is natively integrated in gint. I know Redcmd has implemented an engine outside of gint for his own purposes.


oh so it's similar to how we can display multiple digits on a seven segments display?
wow thats really cool
Lephenixnoir En ligne Administrateur Points: 24146 Défis: 170 Message

Citer : Posté le 17/11/2021 15:11 | #


It's even simpler than that: it just flicks from black to white faster than the eye can see it, so what you perceive is an average (over time) of how often each pixel is black. So dark gray alternates but stays black for longer periods, and light gray also alternates but stays white for longer periods.

The delays tend to be different for each model and you can see the flicker even with the best settings, but if you play for more than a few minutes you stop seeing it eventually and it's really nice
Mon graphe (24 Mars): (gint#27 ; (Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; ...) || (shoutbox v5 ; v5)
Kbd2 Hors ligne Membre Points: 269 Défis: 0 Message

Citer : Posté le 19/11/2021 16:24 | # | Fichier joint


Update with a bunch of content, mainly contributed by segfaultdev!
- Added the jungle
- Player's position is saved upon world exit
- Clay, mud, and glass
- Copper, tin, and tin tools
- Tin and cactus armour
- Diamond, emerald, ruby, sapphire, topaz
- Cobwebs and chains
- Sawmills, looms, silk, and beds
- A chat system (currently only used for beds)
- Coins
- Mushrooms and healing/mana potions
- Pots
- Eyes of Cthulhu
- Splash messages on title screen
- Numerous small changes and bugfixes.

I haven't really tested this as much as I would other updates due to the large amount of new content, so if you find a bug while playing be sure to notify me here or preferably as an issue on the Github repo.
Fade Hors ligne Membre Points: 1 Défis: 0 Message

Citer : Posté le 11/01/2022 18:59 | #


Wow nice game
I have two issues though :/
In the latest update (0.10.0) the game crashes when I walk for about 10 seconds and I get an error :
Exception! (SysERROR)
TLB miss read
PC: 0031ca24
TEA: 0033b046
TRA: 00000000
SGR: 8804fe64
The add-in crashed.
Please reset the calc

I checked several times and I always get the same error message.
Also if I save and close the game, when I try to open the world, I spawn in a void.
(The 0.9.0-indev version worked fine)

Am I doing something wrong ?
Lephenixnoir En ligne Administrateur Points: 24146 Défis: 170 Message

Citer : Posté le 11/01/2022 19:02 | #


The spawning in the void thing seems like a known problem where you spawn high up in the sky (and usually die of fall damage). It might be fixed in latest builds?
Mon graphe (24 Mars): (gint#27 ; (Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; ...) || (shoutbox v5 ; v5)


Ngk6D Invité

Citer : Posté le 10/02/2022 03:43 | #


Theres a bug in the game: When you stand at a opened door then you close it, it teleports into the top of the door or a roof of the house if you place the door in front of the house.
Calamari Hors ligne Membre Points: 229 Défis: 0 Message

Citer : Posté le 03/10/2022 20:46 | #


This older version seems to work on the fx-9750GIII (able to move without crashing and can load a game after saving it). Whether there are other problems in this version, I don't know: https://github.com/KBD2/terrario/files/5243852/Terrario_30kB.zip

The file is from this GitHub post: https://github.com/KBD2/terrario/issues/1#issuecomment-694688403


tt_thoma Invité

Citer : Posté le 31/05/2023 22:23 | #


The graph 35+E II has a memory of 60KB. That means it will crash when a buffer exceeds 60KB. Reducing the buffer size works for this reason


tt_thoma Invité

Citer : Posté le 01/06/2023 08:45 | #


Nevermind
Précédente 1, 2, 3 ··· 5, 6, 7, 8, 9, 10 Suivante

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 112 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd