English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 03 June 2020, 20:36   #1
Toki
Registered User
 
Toki's Avatar
 
Join Date: Feb 2016
Location: Birmingham
Age: 60
Posts: 107
Simple games in C?

I'm half way through Anders Bjerin's excellent book Amiga C Manual, with its many useful examples of C codes.

Does anybody know a source of simple games written in C for the amiga that I could study next?

Thanks.
Toki is offline  
Old 03 June 2020, 21:34   #2
drHirudo
Amiga user
 
drHirudo's Avatar
 
Join Date: Nov 2008
Location: Sofia / Bulgaria
Posts: 456
Yes, you can try my games
MazezaM - http://aminet.net/package/game/think/MazezaM
Alex in Town - http://aminet.net/package/game/jump/AlexInTown

And some other of which names I have forgotten over the years.
drHirudo is offline  
Old 03 June 2020, 22:52   #3
Toki
Registered User
 
Toki's Avatar
 
Join Date: Feb 2016
Location: Birmingham
Age: 60
Posts: 107
These are great thanks.

They are probably a bit too complicated for me to understand at the moment., but there's plenty here for me to get my head around.

It's a lot easier to learn by picking games apart.
Toki is offline  
Old 04 June 2020, 10:29   #5
Toki
Registered User
 
Toki's Avatar
 
Join Date: Feb 2016
Location: Birmingham
Age: 60
Posts: 107
These are fantastic thanks.

I probably need something more basic at the moment.

There seems to be a massive leap between reading the theory of C in a book and actually coding games with it.
Toki is offline  
Old 11 June 2020, 17:04   #6
abbub
Registered User
 
Join Date: Dec 2019
Location: Fort Collins, CO USA
Posts: 60
Out of curiosity, what compiler does the 'Amiga C Manual' use / recommend?
abbub is offline  
Old 11 June 2020, 22:04   #7
Ami
Registered User
 
Ami's Avatar
 
Join Date: Sep 2014
Location: Poland
Posts: 175
https://github.com/Zalewa/snekorama
https://github.com/68kPoker/Magazyn

Quote:
There seems to be a massive leap between reading the theory of C in a book and actually coding games with it.
I would say, in theory it's hard but in practice it's not - just amount of work is the biggest factor. But you must actually start practicing programming! IMHO, with good books/tutorials and at least 2-3 hours daily, one can archieve decent results in about 3-6 months.

Here is quite good tutorial (it's in Polish language, use translator https://translate.google.com)

https://www.ppa.pl/programy/nasza-pi...c-czesc-1.html
https://www.ppa.pl/programy/nasza-pi...c-czesc-2.html
https://www.ppa.pl/programy/nasza-pi...c-czesc-3.html
https://www.ppa.pl/programy/nasza-pi...c-czesc-4.html
https://www.ppa.pl/programy/nasza-pi...c-czesc-5.html
https://www.ppa.pl/programy/nasza-pi...c-czesc-6.html
https://www.ppa.pl/programy/nasza-pi...c-czesc-7.html
https://www.ppa.pl/programy/nasza-pi...c-czesc-8.html
https://www.ppa.pl/programy/nasza-pi...c-czesc-9.html

Last edited by Ami; 11 June 2020 at 22:23.
Ami is offline  
Old 12 June 2020, 10:53   #8
Toki
Registered User
 
Toki's Avatar
 
Join Date: Feb 2016
Location: Birmingham
Age: 60
Posts: 107
The Amiga C Manual uses SAS C Lattice. The book is available in Aminet.

The book is excellent, with loads of examples.

I love the fact i can copy the examples into Notepad++, and load them into Winuae. Saves a lot of typing.

All the examples in the book have been printed from actual code, so no typos wrecking things.

Last edited by Toki; 12 June 2020 at 13:12. Reason: spelling
Toki is offline  
Old 12 June 2020, 13:11   #9
Toki
Registered User
 
Toki's Avatar
 
Join Date: Feb 2016
Location: Birmingham
Age: 60
Posts: 107
Thanks Ami.

Yes these web pages looks perfect. This will take quite a while to study. It looks like a good intermediate step. I like the way the files are provided at the end of the game example.
I shall start studying this when I finish all the examples in the Amiga C Manual. Thanks a lot.

Last edited by Toki; 12 June 2020 at 13:13. Reason: more clarity
Toki is offline  
Old 12 June 2020, 17:37   #10
abbub
Registered User
 
Join Date: Dec 2019
Location: Fort Collins, CO USA
Posts: 60
Quote:
Originally Posted by Toki View Post
The Amiga C Manual uses SAS C Lattice. The book is available in Aminet.

The book is excellent, with loads of examples.

I love the fact i can copy the examples into Notepad++, and load them into Winuae. Saves a lot of typing.

nice! i'll grab a copy of it.



i've been working on a cross platform database app (just for fun, mostly to play with the various idiosyncrasies of various c flavors) and have it working on sas/c on the amiga, borland on the pc, and think c on the mac (and gcc on the modern). So far, sas/c seems like it's the 'least picky' of the compilers I've used.


if you're just learning, my (unsolicited) advice is to actually type the code in. in my experience, it's a much better way of learning. for one thing, you'll invariably make mistakes and typos, and a big part of development is learning how to figure out what those mistakes are and where you've made them.
abbub is offline  
Old 12 June 2020, 18:42   #11
OmegaMax
Knight Of The Kingdom
 
OmegaMax's Avatar
 
Join Date: Feb 2016
Location: It's a bald world!
Posts: 179
The first level of the game Menace has been coded in C,worth a look once you
have a bit more experience.

http://amiga.filfre.net/?page_id=17

Last edited by OmegaMax; 12 June 2020 at 19:04.
OmegaMax is offline  
Old 13 June 2020, 15:01   #12
Toki
Registered User
 
Toki's Avatar
 
Join Date: Feb 2016
Location: Birmingham
Age: 60
Posts: 107
Thanks for the advice OmegaMax, the Menace code is a good suggestion. Definitely what I want to aspire to.

Abub is right I must ultimately be typing the code myself. I just found when I was learning Basic that it's good to take existing code and tinker with it to see what works and what doesn't.

What I'm finding about C is that it seems to be all about building up a structure that will work. Less concerned with understanding the individual nuts and bolts. If it wasn't I would have to understand the detailed workings of the include files? I hope I'm right here, but feel free to disagree.

If anyone else has Simple Games in C to recommend please do. I'll need all I can get!
Toki is offline  
Old 14 June 2020, 01:59   #13
OmegaMax
Knight Of The Kingdom
 
OmegaMax's Avatar
 
Join Date: Feb 2016
Location: It's a bald world!
Posts: 179
Writing code and playing around with another programmers code is a good way to learn.Learning structs is an absolute must for game programming in C(Make sure you really spend some time learning with structs Toki),this isn't for amiga but it's a good example of playing with another programmers code an observe the changes to understand.This one is quite simple but if you already understand structs ignore my post.


Code:
#define MaxNumberOfBaldies 30        ;<-- Max amount of baldies     


typedef struct baldies_s {
	int x,y;                      ;struct member x,y 
	int deltax,deltay;	      ;struct member deltax,deltay
	int dir;                      ;struct member dir
	int moverate;                 ;struct member moverate
}baldies_t;


baldies_t baldies[MaxNumberOfBaldies];
The result



Code:
//Same exact code but increase MaxNumberOfBaldies 

#define MaxNumberOfBaldies 300        ;<-- Max amount of baldies

Last edited by OmegaMax; 14 June 2020 at 02:07.
OmegaMax is offline  
Old 14 June 2020, 12:04   #14
Toki
Registered User
 
Toki's Avatar
 
Join Date: Feb 2016
Location: Birmingham
Age: 60
Posts: 107
I love it, that's a lot of Baldies. Great pictures.

The trill of being able to program the Amiga to do things is a revelation.

I shall study structs. It's great to study something then immediately be able to put it into action.

I suppose I'm not surprised that more Amiga fans don't code. Now seems like the best time more than ever. The amiga fans seem to be encouraging each other to step into the world of coding.

Surely this was the dream of the software engineers such as RJ Mical that the amiga would be used to turn us all into coders.
Toki is offline  
Old 14 June 2020, 13:54   #15
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,174
Code:
#define MaxNumberOfBaldies 30        ;<-- Max amount of baldies
you should NEVER comment 1) the same thing as the variable and 2) with a SEMICOLON. Comments in C are /* */ or // for modern compilers.

The code you quoted cannot just compile because of the macro expanding the colon inside the array size declaration. In that case, even using // would make the compiler fail.

Comment above the line if you must. be careful of macros.

And yes, SDL is excellent to learn about coding games, but not on amiga, SDL is just too slow to be useable.
jotd is offline  
Old 14 June 2020, 17:29   #16
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,773
I've never seen semicolons used for comments. Which compiler accepts that?
Hewitson is offline  
Old 14 June 2020, 21:38   #17
OmegaMax
Knight Of The Kingdom
 
OmegaMax's Avatar
 
Join Date: Feb 2016
Location: It's a bald world!
Posts: 179
Sorry,I didn't mean to cause any confusion with the ;comments and I just assumed majority would know how to comment in C,bad assumption on my part.

Last edited by OmegaMax; 14 June 2020 at 22:48.
OmegaMax is offline  
Old 15 June 2020, 00:58   #18
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,773
Quote:
Originally Posted by OmegaMax View Post
Sorry,I didn't mean to cause any confusion with the ;comments and I just assumed majority would know how to comment in C,bad assumption on my part.
Uhh, it's actually you that doesn't know how to comment. Your code will fail to compile on almost any compiler. It's not valid C code.

I asked my question politely, there was no reason for such a rude response.
Hewitson is offline  
Old 15 June 2020, 01:27   #19
OmegaMax
Knight Of The Kingdom
 
OmegaMax's Avatar
 
Join Date: Feb 2016
Location: It's a bald world!
Posts: 179
I wasn't being rude,and it is my fault, it didn't dawn on me that anyone would try and compile what I posted.I also assumed every programmer would know to use //../* */ and not ;.....Sorry if my post came off as rude as that wasn't my intention.
OmegaMax is offline  
Old 15 June 2020, 15:24   #20
drHirudo
Amiga user
 
drHirudo's Avatar
 
Join Date: Nov 2008
Location: Sofia / Bulgaria
Posts: 456
Wow, what a debate over a single symbol.

If you can't notice the symbol, your code won't compile, so you will need to watch closely and get more experience, eventually finding other bugs in the source.

For the record, old Amiga C compilers won't compile with // either. This is a C++ standard. VBCC has the option -cpp-comments - Allow C++ style comments (not ISO89 conforming).

What's next? Which is more correct - Tab or Spaces?
drHirudo is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Probably something simple... zerohour1974 support.Apps 3 06 April 2015 14:53
Old simple demo Fester77 request.Demos 6 02 August 2011 21:53
A simple request... Nostalgeek Coders. General 7 09 January 2009 10:04
Simple two player games ? eternalcrusader Retrogaming General Discussion 25 24 April 2007 11:50
A little simple tool zeGouky project.Sprites 7 05 November 2005 21:52

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 05:09.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10398 seconds with 13 queries