English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. C/C++ (https://eab.abime.net/forumdisplay.php?f=118)
-   -   Simple games in C? (https://eab.abime.net/showthread.php?t=102564)

Toki 03 June 2020 20:36

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.

drHirudo 03 June 2020 21:34

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.

Toki 03 June 2020 22:52

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.

Korodny 03 June 2020 23:08

http://aminet.net/package/game/misc/amiganitzusrc
http://aminet.net/package/game/shoot/AntiISDAWarior
http://aminet.net/package/game/shoot/AntiISDA_Warrior2
http://www.ppa.pl/aktualnosci/crazycrane-0.5.html
http://aminet.net/package/game/misc/misscmd-src
http://aminet.net/package/game/wb/SnakePit

Toki 04 June 2020 10:29

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.

abbub 11 June 2020 17:04

Out of curiosity, what compiler does the 'Amiga C Manual' use / recommend?

Ami 11 June 2020 22:04

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

Toki 12 June 2020 10:53

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.

Toki 12 June 2020 13:11

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.

abbub 12 June 2020 17:37

Quote:

Originally Posted by Toki (Post 1407238)
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.

OmegaMax 12 June 2020 18:42

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

Toki 13 June 2020 15:01

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!

OmegaMax 14 June 2020 01:59

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

https://i.postimg.cc/C56mDzcW/Untitled.png

Code:

//Same exact code but increase MaxNumberOfBaldies

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

https://i.postimg.cc/DyJcHfjw/Untitled2.png

Toki 14 June 2020 12:04

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.

jotd 14 June 2020 13:54

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.

Hewitson 14 June 2020 17:29

I've never seen semicolons used for comments. Which compiler accepts that?

OmegaMax 14 June 2020 21:38

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.

Hewitson 15 June 2020 00:58

Quote:

Originally Posted by OmegaMax (Post 1407931)
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.

OmegaMax 15 June 2020 01:27

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.

drHirudo 15 June 2020 15:24

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?


All times are GMT +2. The time now is 05:35.

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

Page generated in 0.05032 seconds with 11 queries