|
Post by Pjot on Oct 20, 2019 9:23:33 GMT 1
Thanks felixp7, All works fine, as usual. Hope your porting gave a good impression of our BASIC to C converter Best regards Peter
|
|
|
Post by felixp7 on Oct 20, 2019 14:50:18 GMT 1
Oh, definitely! This time, BaCon is a keeper. Thank you very much for all the help! In fact, I hope to continue this thread soon, with something a little different. If you're interested, of course. In the mean time, check out the final product. Have fun, and keep up the good work!
|
|
|
Post by felixp7 on Oct 22, 2019 13:41:26 GMT 1
All right, this is going to take a while, as it's a bigger project and I'm also trying to dust off another unrelated thing at the same time. So for now here's a screenshot and UI mock-up. This is a port of my game Space Cruiser Orion to the Linux console, using only BaCon's built-in functionality. (Normally I'd be using ncurses, but it's a lot more complicated, and would kind of defeat the point.) This is also interesting because I'm porting from another Basic dialect. Perhaps the biggest change so far is that now I can use records, which proves useful as it's no longer possible to mix base-0 and base-1 arrays like in the original code*. But more about that once I can show you the game logic. The UI code so far seems straightforward. Maybe that will change once I add checks for a minimum size and handle SIGWINCH to know when to redraw the whole screen. Got a plan for that too, hopefully it's sound. *) Well, the original was actually a command-line prototype in Python, which came out great but, well, requires Python. Attachments:orion.bac (2.47 KB)
|
|
|
Post by Pjot on Oct 22, 2019 17:28:25 GMT 1
Thanks felixp7, The screenshot sure is promising, and the code compiles fine. So I am looking forward to see the final version BR Peter
|
|
|
Post by felixp7 on Oct 23, 2019 7:25:48 GMT 1
You're very kind, but that will take a while. For now, I've set aside the game logic again and instead added something new to show. It's not much, just message panes and modal UI (try keys 1 and 2 in-game). The code is a bit oddly organized because I'm trying to minimize color changes and cursor movements. Another thing ncurses would normally manage for me. But oh well. At least I can probably afford to redraw the whole screen each time in the first version, and only optimize that if it proves necessary. Attachments:orion.bac (5 KB)
|
|
|
Post by vovchik on Oct 23, 2019 10:13:44 GMT 1
Dear felixp7,
Very nicely done. Thanks. And the code is extremely clean and structured.
With kind regards, vovchik
|
|
|
Post by felixp7 on Oct 23, 2019 17:49:24 GMT 1
Y'all are going to make me blush. All right then, one more quick update before I dive into porting the logic again. I only changed the title screen to use the new toolbar code, and added checks for the terminal size. No need to bother with SIGWINCH since I redraw the whole screen every time for now. As for the limit, 72x24 is an uncommon size, but doesn't force me to move things around as the terminal shrinks to keep them looking good. Otherwise, the game could be made to work in 64x24, which means it's also portable to e.g. the Apple II or Spectrum with suitable display routines. Attachments:orion.bac (5.31 KB)
|
|
|
Post by felixp7 on Oct 24, 2019 16:25:54 GMT 1
At last, I managed to port enough of the game logic to start integrating it. Still not in a playable way, but you can see how the UI is supposed to work. Press "2" to toggle views as before; you'll notice a strange bug whereas the last five sectors at the bottom right of the map are always scanned at the start of the game, despite my explicit code resetting all of them in orion-logic.bac line 267. As for the player being special-cased in add_ship_to_sector and remove_ship, that's for a silly reason: as mentioned previously, the game is ported from a Basic dialect that allows mixing 0-based and 1-based arrays in the same program. As BaCon doesn't seem to, I improvised a solution quickly and moved on rather than taking the time to rethink it. Oh, and here's a question: note the calling sites for outposts_found and enemies_active. The code just wouldn't compile until I added empty parens at the end. But only those two functions seem to require it. What gives? Attachments:orion.bac (8.17 KB)
orion-logic.bac (5.83 KB)
|
|
|
Post by Pjot on Oct 24, 2019 17:49:04 GMT 1
Hi felixp7,
The parenthesis are needed because otherwise the PRINT will think you try to print a variable name (which has not been declared). The parenthesis indicate that it is a function.
BR Peter
|
|
|
Post by felixp7 on Oct 24, 2019 19:31:29 GMT 1
Oh, all right. Curious though that `score`, which is defined with DEF FN, doesn't have the same problem. Anyway, I found where that bug happens but not the cause, and rearranged the code a little to make it work despite that. Uploading the modified files early to let people know it's all right. See you later with more additions! Attachments:orion-logic.bac (5.91 KB)
orion.bac (8.19 KB)
|
|
|
Post by felixp7 on Oct 26, 2019 15:15:36 GMT 1
So, as documented in another thread, development had to stop for a couple of days to deal with an issue. On the plus side, the game now has a small test suite, and I'll be looking for ways to make the code more robust. Otherwise, nothing new, but now development can resume in earnest. Have fun! Attachments:orion.bac (8.14 KB)
orion-logic.bac (6.37 KB)
orion-tests.bac (665 B)
|
|
|
Post by felixp7 on Oct 29, 2019 9:21:36 GMT 1
Apologies, everyone. I bit more than I could chew, made too many changes so the work was even harder, and almost gave up twice. But thanks to your patient help, all the game logic is now ported over, and the first "real" game commands actually work (try Dock, Refuel and Repair). I'm leaving out the test suite, which hasn't changed since last time, in favor of a screenshot. Next: to make sure the UI transitions smoothly to asking for input and back, so that the fun part can begin. Attachments:orion-logic.bac (16.88 KB)
orion.bac (8.27 KB)
|
|
|
Post by Pjot on Oct 29, 2019 19:10:55 GMT 1
Thanks felixp7! The program is getting quite big, and it looks promising - me being a fan of nethack and similar games, it is cool to see that there's such a game under development in BaCon. Do you happen to have any kind of manual available? Best regards, Peter
|
|
|
Post by felixp7 on Oct 29, 2019 19:34:28 GMT 1
Glad you like it! Though this isn't like a roguelike, but rather a game from the Trek family. (I made roguelikes too, and might consider porting one or more in the future.) And sure, I wrote a manual for the graphical edition, see below. This one should play much the same, at least once it's all working. Random question: what is DEF FN, exactly? Some kind of macro, or inline function, that the compiler replaces into the code where it's called? Attachments:how-to-play.txt (4.37 KB)
|
|
|
Post by Pjot on Oct 29, 2019 19:49:47 GMT 1
Though this isn't like a roguelike, but rather a game from the Trek family. Apologies, I meant to emphasize the ASCII nature of the game - Trek kind of games are cool too, of course Random question: what is DEF FN, exactly? Some kind of macro, or inline function, that the compiler replaces into the code where it's called? It defines a macro stored amidst C code which then is parsed by the C Pre Processor (CPP). The preprocessor will perform a textual replacement of all occurrences of (function-like) macros. BR Peter
|
|