English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. General (https://eab.abime.net/forumdisplay.php?f=37)
-   -   My game projects in C/C++ and GameSmith (https://eab.abime.net/showthread.php?t=81523)

clebin 11 February 2016 13:49

My game projects in C/C++ and GameSmith
 
2 Attachment(s)
I've been trying to get into Amiga game programming for a while. I wanted to skip BASIC and go straight into C/C++ and I've finally settled on an environment I'm comfortable with:

Cubic IDE
SAS\C 6.58
GameSmith Development System

I'm starting this thread as a bit of motivation to keep going, to ask some newbie C questions and give a little bit of publicity to GameSmith.

My first project is inspired by a Spectrum game called Microbot. It's an original and addictive little game that I enjoyed as a kid, but flawed in the execution so didn't even review that strongly at the time.

Heres's a screeshot of the Spectrum version:

http://eab.abime.net/attachment.php?...1&d=1455190137

Here's a little video of my early attempts with the Amiga version. I hope people like it so far, even though it's obviously quite basic.

https://youtu.be/lm8oeAWvfzo

And for the hell of it, here's a original mock-up I made in PPaint. The background, particularly the floor area will get more work once I change over to a tile-based background.

http://eab.abime.net/attachment.php?...1&d=1455190361

Predseda 11 February 2016 14:05

Wow!!! :great

idrougge 11 February 2016 15:58

It's inspiring to see that someone's taken up Gamesmith, which seems to have been largely forgotten.

alkis 11 February 2016 18:11

Nice! Keep coding! :)

Adrian Browne 11 February 2016 19:30

Looks nice. The robot sprite could do with more detail and colour imo. I like the background.

clebin 11 February 2016 20:01

Thanks for the positive words, everyone - that means a lot!

The robot will definitely get a bit more work as time goes on - especially the back as I've literally just taken the front and blanked out the details!

My first newbie question is this: SAS\C 6.58 apparently does C++. Do I have to do something to enable it? If anyone knows how to do it in Cubic IDE, even better.

ajk 11 February 2016 20:09

I don't know how to enable it, but my instinct says that you should steer away from C++ when dealing with such an old compiler (and system :)). Especially considering your application is a game and performance is/will be important.

davideo 11 February 2016 20:55

@clebin

I've been messing with Gamesmith for a while.

I created a brain teaser but If you complete the puzzle it Gurus. Which is funny really because if you fail or select the Demo mode it's fine :confused

I'm about to embark on an overhead game when I get chance to do some more coding.

matthey 11 February 2016 21:35

Quote:

Originally Posted by clebin (Post 1069777)
My first newbie question is this: SAS\C 6.58 apparently does C++. Do I have to do something to enable it? If anyone knows how to do it in Cubic IDE, even better.

There is an experimental patch to add C++ to SAS/C available for download on the following website.

https://www.warped.com/amiga/

The C++ support was limited and would be considered old if not ancient by today's standards. It did add some support for little conveniences like C++ comments which is nice considering that SAS/C predates modern C standards like C99. I doubt you will find many C++ programmers who are satisfied with the Amiga SAS/C C++ level of C++ support and bugs. Even the Amiga SAS/C C support seems primitive and non-standardized although it is a good ANSI C compiler and a professional product for its day. If you need modern C++ support on the Amiga, GCC is about the only choice. If you need more modern C support then vbcc is easier to install and use on the Amiga. Both require significantly higher specs than SAS/C though.

Quote:

Originally Posted by ajk (Post 1069782)
I don't know how to enable it, but my instinct says that you should steer away from C++ when dealing with such an old compiler (and system :)). Especially considering your application is a game and performance is/will be important.

Good advice. The Amiga was created for C which generates more efficient code.

tolkien 12 February 2016 00:18

I was thinking in use gamesmith, game master system or similar.
Would you think gamesmith is a good start?
Good work mate!

clebin 12 February 2016 10:50

@ajk, matthey

Thanks for the advice. C++ is a nice-to-have but not essential. I'd like the game to run on a stock OCS/ECS machine if possible. I'll just have to get out of my OOP way of thinking...

@tolkien

Thanks! I can't speak for Game Master System but I recommend trying out GameSmith. It took me a little while longer to get up and running than Blitz - which I also tried - but I quickly felt more comfortable with it. The manual isn't great as a tutorial but is a very useful reference. There's also a number of examples included which I've found essential. Once you get them compiling, you're half-way there. There's next to no Google help out there, so being able to look at another piece of code and work out what makes that work and mine fail has been priceless.

There's also a tool called CITAS to import images and turn them into animations. It's rough round the edges but does the job. You can also use CITAS to define collision detection between objects, which is my next task.

idrougge 12 February 2016 15:52

If you can get it to cooperate with GameSmith, I think AmigaE has a rather lean object orientation.

clebin 12 February 2016 16:31

Quote:

Originally Posted by idrougge (Post 1069928)
If you can get it to cooperate with GameSmith, I think AmigaE has a rather lean object orientation.

Thanks but the syntax is a bit too different from what I'm used to with PHP/JavaScript/Obejctive-C/Java. It's swings & roundabouts but I'll stick with C.

Franchute13 12 February 2016 17:49

Hi.

Congratulations! The game looks good!

Could upload the source code to see it?

Cheers

clebin 14 February 2016 14:07

Quote:

Originally Posted by Franchute13 (Post 1069951)
Hi.

Congratulations! The game looks good!

Could upload the source code to see it?

Cheers

Hi. Thanks very much! I'm not confident enough in my C coding to release it yet and I don't want to lead people down the wrong path. I'm not doing much that isn't in the examples - I recommend the MoonRocks and parallax examples to get going.

clebin 14 February 2016 14:30

My biggest remaining challenge is to use a tile-map for my rooms.

There's an example included with GameSmith but it's not well described. I can't tell what format the tiles and the map are in (except that's pretty raw binary) or how I'd create those files myself.

Preferably, I'd just use an IFF file for my tiles and a CSV file to define my map.

Could anyone make sense of these files or (even better) point me towards an example using an IFF file? I'll be using that "gs_blit_copy()" function to paste the tiles into a big bitmap.

Here's the relevant code from the example:

Code:

/*  "TILES.DAT" is the graphics data for the tiles -- each tile takes 192
  bytes (16 x 16 x 6 planes), and there are 107 tiles in the set.
  "MAP.DAT" is the tilemap -- 200x10 tiles, 1 byte per tile. */

UBYTE *tilesdata=0;  /* Pointer to chunk of chip data for tiles graphics */

UBYTE map[MAPHEIGHT][MAPWIDTH];    /* Map array - y,x (NOT x,y, because of how it's loaded in, ROW at a time.) */

/* Struct for blitting tiles to screen (just using same struct and changing "data" pointer for each) */
struct blit_struct blit =
{
  0,0,0,
  6,0xff,1,16,32,
  0,0,0,0,0,0,0
};

.
.

/* Load tile graphics */
  file=Open("TILES.DAT",MODE_OLDFILE);
  if(file==0)Quit("Can't Open File: TILES.DAT!");
  len=Read(file,(BYTE *)tilesdata,TILESIZE*NUMTILES);
  if(len==-1)Quit("Can't Read File: TILES.DAT!");
  Close(file);file=0;
 
  /* Load tilemap */
  file=Open("MAP.DAT",MODE_OLDFILE);
  if(file==0)Quit("Can't Open File: MAP.DAT!");
  len=Read(file,(BYTE *)&map[0][0],MAPWIDTH*MAPHEIGHT);
  if(len==-1)Quit("Can't Read File: MAP.DAT!");
  Close(file);file=0;

.
.

  gsvp=display.vp;  /* Set pointer to gs_viewport */
  bm=gsvp->bitmap1;  /* Set pointer to bitmap1 */
 
  /* Blit first screen of tiles to the visible display (and blit the same thing again, one screen to the right) */
  for(y=0;y<SCREENHEIGHT;y++)
  {
      for(x=0;x<=SCREENWIDTH;x++)
      {
            /* Set pointer to graphics data */
            blit.data=(USHORT *)tilesdata+(96*(map[y][x]));
            /* blit tile into bitmap (twice) */
            gs_blit_copy(&blit,bm,(x<<4)+16,y<<4);  /* "<<4" == "*16" */
            gs_blit_copy(&blit,bm,(x<<4)+352,y<<4);
      }
  }


kamelito 14 February 2016 20:30

the only drawback using GameSmith is that it's development has been halted long ago and bugs and new features will never happens. That's too bad we can't get our hand in the source code.

Source code says it contains 106 16x16 tiles with 6 bitplanes, reading it with Maptapper describe it as ACBM format.

Kamelito

clebin 15 February 2016 20:25

Quote:

Originally Posted by kamelito (Post 1070422)
the only drawback using GameSmith is that it's development has been halted long ago and bugs and new features will never happens. That's too bad we can't get our hand in the source code.

Source code says it contains 106 16x16 tiles with 6 bitplanes, reading it with Maptapper describe it as ACBM format.

Kamelito

That's fabulous, thanks for your help Kamelito. Reading about the ACBM format on wiki.amigaos.net, the description matches exactly what the GameSmith manual says goes into the data part of the 'blit_struct':

"All graphics data (except the mask) must be contiguous in memory starting with the first plane (from 0 to n)"

I've learnt a lot since yesterday but I'm still blitting garbage to the screen at the moment. Knowing the name of the format will be a great help.

clebin 16 February 2016 19:28

1 Attachment(s)
Progress! I can now blit 16x16 tiles directly to a bitmap. A little test using my bubbles:

http://eab.abime.net/attachment.php?...1&d=1455646644

The key has been the GetImage package on Aminet:

http://aminet.net/package/dev/c/GetImage

GetImage produces C source, including a imageData array that I can use in my "blit_struct". I also modified GetImage slightly so it can write the image data into a binary file. The blue bubbles are from a file, the green from an array.

Still some work to do before I can load real maps, but I'm happy!

kamelito 16 February 2016 21:30

Good job, always nice to see progress in Amiga land.
Kamelito


All times are GMT +2. The time now is 20:49.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.07326 seconds with 11 queries