English Amiga Board Amiga Lore


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 11 February 2016, 13:49   #1
clebin
Registered User
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 253
My game projects in C/C++ and GameSmith

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:



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.

[ Show youtube player ]

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.

Attached Thumbnails
Click image for larger version

Name:	microbot.gif
Views:	915
Size:	6.5 KB
ID:	47417   Click image for larger version

Name:	microbot2.gif
Views:	956
Size:	26.3 KB
ID:	47419  
clebin is offline  
AdSense AdSense  
Old 11 February 2016, 14:05   #2
Predseda
Puttymoon inhabitant
Predseda's Avatar
 
Join Date: Mar 2007
Location: The City of Townsville
Age: 39
Posts: 4,443
Wow!!!
Predseda is offline  
Old 11 February 2016, 15:58   #3
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 2,982
It's inspiring to see that someone's taken up Gamesmith, which seems to have been largely forgotten.
idrougge is offline  
Old 11 February 2016, 18:11   #4
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 359
Nice! Keep coding!
alkis is offline  
Old 11 February 2016, 19:30   #5
Adrian Browne
Jackie Chan
 
Join Date: Mar 2012
Location: Ireland
Age: 40
Posts: 647
Looks nice. The robot sprite could do with more detail and colour imo. I like the background.
Adrian Browne is offline  
Old 11 February 2016, 20:01   #6
clebin
Registered User
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 253
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.
clebin is offline  
Old 11 February 2016, 20:09   #7
ajk
Registered User
ajk's Avatar
 
Join Date: May 2010
Location: Helsinki, Finland
Posts: 908
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.
ajk is offline  
Old 11 February 2016, 20:55   #8
davideo
Amiga Tomcat

davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,166
@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

I'm about to embark on an overhead game when I get chance to do some more coding.
davideo is offline  
Old 11 February 2016, 21:35   #9
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by clebin View Post
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 View Post
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.
matthey is offline  
Old 12 February 2016, 00:18   #10
tolkien
AmigaMan

tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 443
I was thinking in use gamesmith, game master system or similar.
Would you think gamesmith is a good start?
Good work mate!
tolkien is offline  
Old 12 February 2016, 10:50   #11
clebin
Registered User
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 253
@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.
clebin is offline  
Old 12 February 2016, 15:52   #12
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 2,982
If you can get it to cooperate with GameSmith, I think AmigaE has a rather lean object orientation.
idrougge is offline  
Old 12 February 2016, 16:31   #13
clebin
Registered User
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 253
Quote:
Originally Posted by idrougge View Post
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.
clebin is offline  
Old 12 February 2016, 17:49   #14
Franchute13
Registered User
Franchute13's Avatar
 
Join Date: Feb 2013
Location: Argentina
Posts: 223
Hi.

Congratulations! The game looks good!

Could upload the source code to see it?

Cheers
Franchute13 is offline  
Old 14 February 2016, 14:07   #15
clebin
Registered User
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 253
Quote:
Originally Posted by Franchute13 View Post
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 is offline  
Old 14 February 2016, 14:30   #16
clebin
Registered User
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 253
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);
      }
   }

Last edited by clebin; 14 February 2016 at 15:14.
clebin is offline  
Old 14 February 2016, 20:30   #17
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 814
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

Last edited by kamelito; 15 February 2016 at 00:09.
kamelito is offline  
Old 15 February 2016, 20:25   #18
clebin
Registered User
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 253
Quote:
Originally Posted by kamelito View Post
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 is offline  
Old 16 February 2016, 19:28   #19
clebin
Registered User
clebin's Avatar
 
Join Date: Apr 2012
Location: Cardiff
Posts: 253
Progress! I can now blit 16x16 tiles directly to a bitmap. A little test using my bubbles:



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!
Attached Thumbnails
Click image for larger version

Name:	microbot-tiles.gif
Views:	650
Size:	26.1 KB
ID:	47525  
clebin is offline  
Old 16 February 2016, 21:30   #20
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 814
Good job, always nice to see progress in Amiga land.
Kamelito
kamelito is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
GameSmith bookmarked manual sir_xeno project.EAB File Server 0 27 July 2012 10:33
My Projects Amigaman Hardware mods 17 24 January 2011 18:11
Who here uses GameSmith with C or C++ davideo Coders. General 20 12 June 2010 15:34
Gamesmith Jherek Carnelia request.Apps 7 12 March 2008 23:40
Proposal: Split Amiga projects and PC projects? andreas project.Amiga Game Factory 4 12 February 2008 12:00

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:06.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.28207 seconds with 13 queries