BBC BASIC
« Example program challenge »

Welcome Guest. Please Login or Register.
Jul 26th, 2017, 02:37am


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1 2 3  4 Notify Send Topic Print
 veryhotthread  Author  Topic: Example program challenge  (Read 1383 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Example program challenge
« Thread started on: Dec 11th, 2016, 09:55am »

The only example programs, supplied with BB4W, that make any significant use of structures do so in the context of calling the Windows API. Whilst this is indeed a valuable reason for structures to exist, it doesn't give the user any idea of how structures can be useful in ways that are independent of the Operating System.

So I would like to set the assembled user-base a challenge of writing an example program which illustrates the usefulness of structures other than in an API context. The program should:
  • Do something useful and/or interesting and/or attractive.

  • Use structures (ideally including arrays of structures and array structure members), without being obviously contrived to do so.

  • Run in the trial version of BB4W (32K memory limit).

  • Run in both BB4W and BBCSDL (so either not using any API functions, or ones that have an equivalent in both).
My intention will be to distribute the 'winning' program with future releases of BB4W and BBCSDL, or even multiple submissions if they are good enough.

Get your thinking caps on! If you have an existing program which you think fits the bill you can of course submit that.

Richard.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Re: Example program challenge
« Reply #1 on: Jan 14th, 2017, 8:52pm »

Another area in which the current set of example programs leaves something to be desired is GAMES (probably reflecting my own relative lack of interest in that genre). Only four are supplied: ANIMAL, HANOI, RHEOLISM and SUDOKU - and HANOI isn't really a game it its current form.

So I would be very interested in supplementing this set with some more games, so long as they satisfy the criteria for example programs as outlined previously. That is, they should:
  • Be interesting and/or attractive; games are often judged by their appearance.

  • Run in the trial version of BB4W (32K memory limit + 16K for libraries).

  • Run in both BB4W and BBCSDL (so either not using any API functions, or ones that have an equivalent in both).

  • Be usable with a small touch screen, such as may be found on an Android phone or tablet.
That last point is particularly important, because I would want to include any new example programs with all editions of BBCSDL.

If anybody has, or fancies writing, a program that they think might be suitable please reply to this thread.

Richard.
User IP Logged

michael
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 54
xx Re: Example program challenge
« Reply #2 on: Jan 15th, 2017, 01:51am »

With 714 views since December 27, 2016 (just on BBC4W forum), RETROLIB 10 does have the interests of many. I have publicly offered it to everyone . I have expanded it further into version 12.( not seen here)

It has some premade objects that can be customized and works extensively with palettes and shading and graphics controls. It also has special input tools.

It is still being improved, but does provide some help for those who might want to slap stuff together fast.

I can modify it into 2 versions. One for BBC4W (which is what it works on..), and the reduced object assist version.

There is some testing to be done for the colour checking tools on BBCSDL.

I offer it once again.


« Last Edit: Jan 15th, 2017, 02:01am by michael » User IP Logged

I like reinventing the wheel, but for now I will work on tools for D3D
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Re: Example program challenge
« Reply #3 on: Jan 15th, 2017, 09:49am »

on Jan 15th, 2017, 01:51am, michael wrote:
I offer it once again.

Thanks for the offer, but I am not currently looking for libraries. Potential new users, evaluating BBC BASIC (e.g. using the trial version), may form a view on its capabilities and strengths by running the supplied example programs, which is why I am keen that they should give a good impression. Libraries are 'invisible' to such people so aren't really relevant to that concern.

The new BOUNCE program kindly provided by Howard (see the thread at groups.io) filled a gap in the coverage of BBC BASIC's features, in respect of structure arrays. I have also added a couple of new programs of my own recently, such as POLYFIT and SNOWSCENE. Looking across the set of examples as a whole it is apparent that the GAMES directory is very sparse compared with GENERAL and GRAPHICS.

I know that a lot of people, like me, are not very interested in games but nevertheless they can be colourful, dynamic, and - hopefully - a good demonstration of the capabilities of the language across the board. Also, many of the most spectacular programs ever written in BBC BASIC have been games (although too large and, probably, non-portable to be of direct relevance).

Richard.
User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 53
xx Re: Example program challenge
« Reply #4 on: Jan 16th, 2017, 2:52pm »

Hi Richard,

Yesterday I added the BB4W version for the 2048 game Rosetta task.
See: http://rosettacode.org/wiki/2048

It's a very rudiment implementation. Just enough to meet the requirements of the task.
For example, I didn't adopt the recommended naming conventions, used local variables, added any comments or provided help for the user.

If you agree with the quality level, I could upgrade with a visually more attractive interface, add comments etc and then it would be an honor to donate it as an example game.

Just let me know.

Regards,

Mike
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Re: Example program challenge
« Reply #5 on: Jan 16th, 2017, 8:50pm »

on Jan 16th, 2017, 2:52pm, hellomike wrote:
If you agree with the quality level, I could upgrade with a visually more attractive interface, add comments etc

You only need to look at the existing example programs to appreciate that the code quality is highly variable: many of them are poor from that point of view. So I wouldn't worry too much about that aspect, at least not as a priority.

The challenge is to give a good first impression, and it's hard to judge what that program could become if given a graphical interface. It's described as a "sliding block puzzle" so if it could be made photo-realistic (or close) it could well be the sort of thing I am looking for. It's perfectly acceptable for the program to need separate bitmap files if necessary.

David Marples (of the BB4W forum) has offered a vaguely similar program involving draggable 'gemstones', so it could be that they have too much in common for me to want to use both. I don't know whether some liaison might be desirable.

Richard.
User IP Logged

michael
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 54
cheesy Re: Example program challenge
« Reply #6 on: Jan 17th, 2017, 04:34am »

I could offer Volatile Vases game I recently made, which has code based board and vase design. I could improve the help screen and make it gather automatically after a swap.

Here is a link to the code and bmp files it created:

https://1drv.ms/f/s!AmYwmTjbmULXlDz300rujXJ6xSfI

It works on BBC4W. It would require modifications to make it work on BBCSDL (mainly replacing TINT type tracking with arrays) and I may need to use a diffrent technique for the sprites. Maybe redraws.
« Last Edit: Jan 17th, 2017, 05:16am by michael » User IP Logged

I like reinventing the wheel, but for now I will work on tools for D3D
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Re: Example program challenge
« Reply #7 on: Jan 17th, 2017, 08:59am »

on Jan 17th, 2017, 04:34am, michael wrote:
It would require modifications to make it work on BBCSDL (mainly replacing TINT type tracking with arrays)

That's a valuable reminder that TINT (and POINT) are very slow in BBCSDL (not my fault - all to do with the way OpenGL and SDL work), so should be avoided whenever possible.

Richard.
User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 53
xx Re: Example program challenge
« Reply #8 on: Jan 17th, 2017, 09:59am »

Quote:
The challenge is to give a good first impression, and it's hard to judge what that program could become if given a graphical interface.

Well, I have something like this in mind: https://gabrielecirulli.github.io/2048/

which is what the game generally looks like. See also: https://play.google.com/store/search?q=2048

Note that I'm not that keen to include animated sliding though. Would be hard, I assume and would defy the purpose of serving as an example for newbie's in my opinion.

So if including such an implementation has a chance, let me know and then I start coding.

Mike
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Re: Example program challenge
« Reply #9 on: Jan 17th, 2017, 2:22pm »

on Jan 17th, 2017, 09:59am, hellomike wrote:
Note that I'm not that keen to include animated sliding though. Would be hard, I assume and would defy the purpose of serving as an example for newbie's in my opinion.

The supplied programs have multiple purposes, only one of which is to serve as "an example for newbies". If that was their primary purpose we would not have mandel.bbc or teapot.bbc or sheet.bbc, none of which can by any stretch of the imagination be described as the sort of program that could be written or understood by a 'newby'!

Rather what I am looking for is a program or programs with the 'wow factor'. Elegance and simplicity are desirable, of course, but not at the expense of the impression they give of the capabilities and power of BBC BASIC.

In any case I wouldn't agree that animating a sliding block is hard:

Code:
      MODE 20 : VDU 5

      w% = 240 : h% = 80
      GCOL 11 : RECTANGLE FILL 0, 0, w%, h%
      GCOL 0 : MOVE 16,60 : PRINT "Sliding block"

      bx% = 0 : by% = 0
      drag% = FALSE
      MOUSE ox%, oy%, b%
      REPEAT
        WAIT 1
        MOUSE x%, y%, b%
        IF x% > bx% IF x% < bx%+w% IF y% > by% IF y% < by%+h% THEN
          MOUSE ON 137
          IF b% drag% = TRUE
        ELSE
          MOUSE ON 0
        ENDIF
        IF b% = 0 drag% = FALSE
        IF drag% THEN
          RECTANGLE FILL bx%, by%, w%, h% TO bx%+x%-ox%, by%+y%-oy%
          bx% += x%-ox% : by% += y%-oy%
        ENDIF
        ox% = x% : oy% = y%
      UNTIL FALSE 

Quote:
So if including such an implementation has a chance, let me know and then I start coding.

Definitely worth pursuing.

Richard.
« Last Edit: Jan 17th, 2017, 2:37pm by Richard Russell » User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 53
xx Re: Example program challenge
« Reply #10 on: Jan 17th, 2017, 7:25pm »

Thanks for the reply.
Of course, "RECTANGLE TO". Keep forgetting about its power.

OK, I will give it a try.
Where should I post the beta for evaluation?

Mike
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Re: Example program challenge
« Reply #11 on: Jan 17th, 2017, 8:10pm »

on Jan 17th, 2017, 7:25pm, hellomike wrote:
Where should I post the beta for evaluation?

I really don't mind. If you have some private webspace (a small amount is often bundled with a broadband package) you can put it there. Or if you've got a cloud storage account (Dropbox, OneDrive, Google Drive, iCloud etc.) they all, I think, provide publicly-accessible spaces - and even if you haven't you can open one for free!

Wherever you choose to put it, just post the URL in a message here so that anybody who wants to can download it.

Richard.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Re: Example program challenge
« Reply #12 on: Jan 18th, 2017, 08:19am »

on Jan 17th, 2017, 7:25pm, hellomike wrote:
Of course, "RECTANGLE TO". Keep forgetting about its power.

I should add that, because it involves 'reading back' from the screen, it shares with POINT and TINT that it is very slow in BBCSDL. If you are wanting to 'animate' a sprite that is easy to redraw (e.g. a BMP image) then you will probably find it faster to redraw it in the new position than to 'copy' it with RECTANGLE TO.

Richard.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 488
xx Re: Example program challenge
« Reply #13 on: Jan 21st, 2017, 9:45pm »

on Jan 17th, 2017, 7:25pm, hellomike wrote:
OK, I will give it a try.
Where should I post the beta for evaluation?

Any progress on this front? The next release of BBCSDL is due in only 10 days time so there's a degree of urgency.

For my own peace of mind can you confirm that there are no IPR issues surrounding this game? Obviously I cannot distribute with BBCSDL any program that may raise questions of legality.

Richard.
User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 53
xx Re: Example program challenge
« Reply #14 on: Jan 23rd, 2017, 2:40pm »

Richard,

Developing the graphical form for the game, I arrived at the infamous last 5% (taking 95% of the time).

Concerning licensing, as per the following Wikipedia link, the concept is free and open-source.
"https://en.wikipedia.org/wiki/2048_(video_game)"

I uploaded the unfinished beta for the game to Dropbox. Its location is:
https://www.dropbox.com/s/p8hfsq13m6vkn4w/2048beta.bbc?dl=0

Main concern to have this working with BBCSDL, is the font.

The original 2048 game uses open-source font "Clear Sans". I installed that in windows and then in BB4W, the display mimics the original game at https://gabrielecirulli.github.io/2048/ very close, although the score in not kept (yet) nor any animated sliding is implemented.
To be SYS "GetTextExtentExPoint" independent, values are kept in the TW&() and TH&() arrays.

The font is at:
https://www.dropbox.com/s/k8kyy0gt3zshk78/clearsans-1.00.zip?dl=0
In Windows, when this font isn't installed, the alternative chosen is okay-ish too but BBCSDL just states "No such font".

To overcome the font problem, I could delived a BMP file with the different squares in it and use the same technique as in "PacMan.bbc". However I'm not sure I then can make the deadline.

OK, well that's the current state.

Regards,

Mike
User IP Logged

Pages: 1 2 3  4 Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls