Click Here
home features news forums classifieds faqs links search
6071 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
» Home
» Features
» News
» Forums
» Classifieds
» Links
» Downloads
Extras
» OS4 Zone
» IRC Network
» AmigaWorld Radio
» Newsfeed
» Top Members
» Amiga Dealers
Information
» About Us
» FAQs
» Advertise
» Polls
» Terms of Service
» Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
11 crawler(s) on-line.
 107 guest(s) on-line.
 0 member(s) on-line.



You are an anonymous user.
Register Now!
 cdimauro:  49 mins ago
 retrofaza:  1 hr 17 mins ago
 agami:  2 hrs 25 mins ago
 Hypex:  2 hrs 31 mins ago
 Hammer:  2 hrs 32 mins ago
 Seiya:  5 hrs 20 mins ago
 matthey:  5 hrs 41 mins ago
 Rob:  6 hrs 52 mins ago
 vox:  6 hrs 56 mins ago
 kolla:  7 hrs 50 mins ago

/  Forum Index
   /  General Technology (No Console Threads)
      /  Experienced coders, bring me up to date a bit on coding systems.
Register To Post

Goto page ( 1 | 2 Next Page )
PosterThread
Bugala 
Experienced coders, bring me up to date a bit on coding systems.
Posted on 18-Sep-2016 21:44:31
#1 ]
Cult Member
Joined: 21-Aug-2007
Posts: 649
From: Finland

Heres my story in short. I started programming with Basic languages in late 80s and got into Amiga Amos languages.
from Amos languages i took some short tries on several C-type languages until finally landing on Hollywood.

However, I have seen those modern Unity etc. languages and couple of things have got my eye which I dont quite know or understand how they work.

1. I see in Unity etc. modern languages they seem to be able to make new main game characters and enemy characters by simply modifying some sort of predone Object Creature and they seem to be able to do pretty much anything. Things like shooting, way of moving, gravity etc.

Basically they seem to be having some sort of list of features:

GRAVITY=ON
WEAPON=OFF
and so on.

They also seem to do this same to game maps etc. general things.

Now how does this work and can i somehow implement this system to my Hollywood projects?


2. I never quite understood how are they able to make programs in such way that there are 10 people working on same piece of software.

I do understand one can be making picture showing program, and another one music player, but how does it work that there can be 10 people all working on same music player?


Can someone bring me up to date on these? Hopefully with such an explanation that I am able to implement these systems to my Hollywood programs.

 Status: Offline
Profile     Report this post  
broadblues 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 18-Sep-2016 22:47:43
#2 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4446
From: Portsmouth England

@Bugala

You question is quite wide ranging and needs big answer but I lack the time, so two shorts hints to start you off...

1. Google Object Orientated Programming.

No idea if hollywood supports it or not.

2. Modular Coding / OOP and sharing code via svn git or similar.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
Trewq 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 18-Sep-2016 23:49:20
#3 ]
Regular Member
Joined: 1-Jun-2012
Posts: 205
From: Unknown

@Bugala

You might try your luck asking on Amigans.net where more coders hang out.

Amigaworld lately seems to be only good for rumor campaigns and jumping to conclusions.

Last edited by Trewq on 18-Sep-2016 at 11:56 PM.

_________________
Best way to enjoy Amiga is without the community

 Status: Offline
Profile     Report this post  
TheAMIgaOne 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 19-Sep-2016 11:36:49
#4 ]
Cult Member
Joined: 10-Jan-2004
Posts: 776
From: United Kingdom

@Bugala

Unity is a 3D game engine not a programming language.

This means it has a full 3D engine, charactor motion, animation, physics, input, AI ++ capabilities control by a top-level programming language.

Hollywood / C / Basic are just languages.

Amos and Blitz have built in 2D graphics handling but thats where the comparison ends

_________________
Cross-developer on Windows, OS3, OS4, Linux; Current Projects:-
Nephele Cloud App OS4
UserProfile System OS4
AmigaOneXE OS4.1.6

TaoSoftwareBlog Youtube

 Status: Offline
Profile     Report this post  
NutsAboutAmiga 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 19-Sep-2016 18:27:52
#5 ]
Elite Member
Joined: 9-Jun-2004
Posts: 12817
From: Norway

@Bugala

As broadblues points out object oriented programing.

You code a class the class defines how all cars, or dogs or whatever behaves.
So when you call car::Move(); the move method knows how to move the car.

So if you have a array of cars, you sort step through all cars, and calling Move() on etch of car's.

A class defines the data structure and methods that relates to that data structure, so it's self contained.

In a more traditional programing, in AMOS you have "statements" this are more or less like functions in BlitzBasic, and is sort of like "methods", but unlike "statements" that has to take a input value, methods, knows some of its value because its attached to something (an object or some data).

You can think of class relates to Integers and floats and strings, it defines what data is, how big it is and so on.

But unlike a integer or float, a class can be defined by the developer.
A car class, has speed its traveling, it has direction, it has speed its falling, it can move so it has Move() method, it can be Drawn, so it has a Draw() method, it can be collided with, so it has Collide() method and so, you add methods as you need them.

Last edited by NutsAboutAmiga on 19-Sep-2016 at 06:29 PM.

_________________
http://lifeofliveforit.blogspot.no/
Facebook::LiveForIt Software for AmigaOS

 Status: Offline
Profile     Report this post  
Zylesea 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 19-Sep-2016 22:36:48
#6 ]
Elite Member
Joined: 16-Mar-2004
Posts: 2263
From: Ostwestfalen, FRG

@Bugala

For object orientated programming (OOP) on Hollywood check the documentation chapter 9.9. Hollywood is not the best OOP language, but has quite something to offer in this domain.
But it's covered there only very briefly and i have not tried OOP in Hollywood myself yet.

Quote:

Going into the depths of OOP (inheritance, multiple inheritance, privacy,
etc.) would be too much for this guide, but it is all possible with Hollywood tables and
metatables. If you are interested in learning more about this topic, you should consult
a book about the Lua programming language because Hollywood uses a Lua kernel. For
example, the book "Programming in Lua (second edition)" by Roberto Ierusalimschy has an
extensive chapter about OOP in Lua, which you usually can adapt straight into Hollywood
code.

I think reading more about Lua (and the book recomendation in particular) is probably a good way to get deeper into Hollywood.

_________________
My programs: via.bckrs.de
MorphOS user since V0.4 (2001)

 Status: Offline
Profile     Report this post  
Deniil715 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 20-Sep-2016 14:32:48
#7 ]
Elite Member
Joined: 14-May-2003
Posts: 4236
From: Sweden

@Bugala

Quote:
2. I never quite understood how are they able to make programs in such way that there are 10 people working on same piece of software.

I do understand one can be making picture showing program, and another one music player, but how does it work that there can be 10 people all working on same music player?


This I can answer:
The program is so big, and consists of so many parts that are more or less isolated that 10 (or 2000) people can work on the same project at the same time because they work on different parts, in different files/directories.

Take WinAmp as a (relatively small, but music player) example: There are several parts to work on:
GUI, audio player, radio stream, video player, play list, settings, plugin subsystem, plugins, installer package, auto update feature, etc. etc.

To coordinate all changes we use a version control system, like git, or svn or cvs. With such a system, several people can even make changes to the same files at the same time because the system is able to merge the changes automatically (unless the exact same piece/lines was modified). usually that's impractical though, better work on different modules.

_________________
- Don't get fooled by my avatar, I'm not like that (anymore, mostly... maybe only sometimes)
> Amiga Classic and OS4 developer for OnyxSoft.

 Status: Offline
Profile     Report this post  
Templario 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 21-Sep-2016 13:18:51
#8 ]
Elite Member
Joined: 22-Jun-2004
Posts: 3663
From: Unknown

@Bugala
In my case for time and with Hollywood to learns making music player or a picture viewer is a good and easy begin than begin with a game, because the examples or routines as examples there aren't very much, like other programming languages, java, c where there are forums, etc.

 Status: Offline
Profile     Report this post  
Bugala 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 27-Sep-2016 16:56:19
#9 ]
Cult Member
Joined: 21-Aug-2007
Posts: 649
From: Finland

@All

Thanks for answers.

I am aware of Object Oriented Programming, but I guess I havent quite understood how useful it can actually be.

I suppose those "create characters" (player, enemies) by simply choosing some parts by turning on and off is then based somehow on having some sort of OOP class that is able to do it all, and you just choose which things it actually does.

I guess I have to start taking OOP programming more seriously, so far i have mainly avoided them since they seemed to make things more complicated.

Last edited by Bugala on 27-Sep-2016 at 04:58 PM.

 Status: Offline
Profile     Report this post  
Hypex 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 28-Sep-2016 15:12:00
#10 ]
Elite Member
Joined: 6-May-2007
Posts: 11204
From: Greensborough, Australia

@Bugala

It could be said that traditional languages are procedural where as OOP is all object based. To put this into perspective imagine you are writing a game and need to move a ship sprite around. The follow pseudo C/++ like code examples show how it is done in one and the other.

So to keep things simple we are going to allocate a sprite, move it around and free it. First we have a Sprite struct. Later we have a Sprite object.

Procedural:


struct Ship *Sprite;

Ship = GetSprite(Image);
MoveSprite(Ship, x, y);
FreeSprite(Ship);


As you can see there is a bit of database management there as Ship needs to stored as one game object with related data and passed to other functions to manipulate it.

Object based:

Class Ship *Sprite;

New Ship.Get(Image);
Ship.Move(x, y);
End Ship;


Okay so here you can see how it has become somewhat neat. So the Ship started off as a handle that had to allocated and passed to subroutines that are called functions to manipulate it.

Then the Ship became an entity itself when it became an object. Also you will see there is a "New" operator which is built in for allocating a new object of that type. To move the ship we simply call a method which is a function embedded in that object, called Move(). To free it we simply use an End operator.

So, it's only a basic example. But OOP can make things look neat and remove typing. Since you only pass things you need to. It also does data hiding well. And fields that would usually be read direct from a structure are usually read from a method in an object.

I think the best example we have of an OOP language on Amiga is AmigaE. This provides the best of both worlds. You can program it procedurally, the way AmigaOS is programmed, or you can use its OOP features. You can also freely mix both in the same program. Brilliant!

Last edited by Hypex on 28-Sep-2016 at 03:17 PM.

 Status: Offline
Profile     Report this post  
Deniil715 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 28-Sep-2016 15:26:30
#11 ]
Elite Member
Joined: 14-May-2003
Posts: 4236
From: Sweden

@Hypex

Quote:
I think the best example we have of an OOP language on Amiga is AmigaE. This provides the best of both worlds. You can program it procedurally, the way AmigaOS is programmed, or you can use its OOP features. You can also freely mix both in the same program. Brilliant!


Well, AmigaE isn't very OOP heavy. PortablE, which is an enhanced and modern version of AmigaE can do full OOP though.

In C++ you can also write pure procedural C code if you want, just like in AmigaE and PortablE. In Java and C# on the other hand, you cannot.

_________________
- Don't get fooled by my avatar, I'm not like that (anymore, mostly... maybe only sometimes)
> Amiga Classic and OS4 developer for OnyxSoft.

 Status: Offline
Profile     Report this post  
Hypex 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 30-Sep-2016 15:18:53
#12 ]
Elite Member
Joined: 6-May-2007
Posts: 11204
From: Greensborough, Australia

@Deniil715

My first experience of OOP would have been AmigaE. I would have read the AmigaE guide but not quite understood it. Once the "bubble had burst" with regard to understanding the concept I could see how useful it was and how even some code I wrote earlier in procedural style was like a mess and made more sense as OOP style and neater. The need to dynamically allocate objects still annoyed me since I had become accustomed to static allocation that AmigaOS let us. But I got used to allocating even the simplest thing.

 Status: Offline
Profile     Report this post  
Jupp3 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 30-Sep-2016 16:07:29
#13 ]
Super Member
Joined: 22-Feb-2007
Posts: 1225
From: Unknown

@Hypex

Quote:

Hypex wrote:
@Bugala

Object based:

Class Ship *Sprite;

New Ship.Get(Image);
Ship.Move(x, y);
End Ship;


Okay so here you can see how it has become somewhat neat. So the Ship started off as a handle that had to allocated and passed to subroutines that are called functions to manipulate it.

And here's another way, you can do it with C:


struct Ship *myShip=NewShip();
myShip->Move(myShip, x, y);


If anyone ever tries to claim that "object instance specific member functions are C++ (or "Non-C") exclusive feature", punch them in the face

Of course there are differences, most notably, you need to pass the object pointer to the function aswell (well, at least if you need to access struct contents), "NewObject()" instead of "new Object", memory management being more automatic in specific cases etc.

Personally, I most often use a combination of both, and have MoveShip() that will do all "common" things (if any), and then check if the pointer is NULL (in some cases, member function isn't necessary - of course I could make constructor fill in "dummy defaults"), and call it, if it isn't. This can also be used to inject any "global" debug functionality, whenever needed.

Also, this makes it possible to keep struct contents fully hidden from the user (as long as he doesn't need to access any members directly) - all you need is:

struct MyStruct;

and you can get the pointer from constructor, pass it around as much as you like, and eventually give it to the destructor.

Might not sound like much, but this can be a major thing for libraries etc. - the less code using the library knows the "inner workings", the more you can change it without breaking stuff. If all struct access happens only via library provided functions (MoveShip()...), I can modify struct contents at will, and no code using it should break.

And regarding the mentioned "database management", with languages like C++, you generally need to store the object pointer in almost exact same way, you store struct pointer in C...

And last but definitely not least - OOP is mainly "coding style" than any "programming language feature" - anyone can do it on (almost) any language, if they just want. Of course some languages can make some things easier with OOP.

And yes, my recent 6502 asm code is definitely way more OOP than any C++ I wrote back in school.

 Status: Offline
Profile     Report this post  
Hypex 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 11-Oct-2016 15:11:09
#14 ]
Elite Member
Joined: 6-May-2007
Posts: 11204
From: Greensborough, Australia

@Jupp3

I'm interested in code where methods can be modified at run time. For example I once wrote a floppy imager in AmigaE. It would be good if I could have a base object I call my read and write routines off. So if it was in test mode then instead of a write routine or method I plug in the test routine. The code calls the write method normally as usual but instead it calls the test routine. There's other programs where having conditional functions would benefit. I hate code where you test for things at run time that don't change or are set once. Especially in loops where something happens once and not again.

Of course you can write in an OOP style in C or any other non-specific OOP language but it can be harder to manage and look slightly messy. For example you need to pass the object to any method call. And this ruins the code somewhat. Unless you set up macros. Since internally C++ must also pass the object as argument even if it's hidden.

OS4 works around this by having some compiler magic for an interface library call. Or method as they call them. Where the interface is passed as the first argument. This magic could be used by the programmer. Or even to create virtual C++ classes for normal C code wanting to do OOP.

 Status: Offline
Profile     Report this post  
NutsAboutAmiga 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 11-Oct-2016 16:15:26
#15 ]
Elite Member
Joined: 9-Jun-2004
Posts: 12817
From: Norway

@Jupp3

As Hypes writes it becomes messy in C, while in C++ with classes, just think about Move function pointer, for a second, in side the Move function (pointer) it look like this in C:


void Move( struct *self, int x, int y)
{
Self -> _x += x;
Self -> _y += y;
}


while in C++, the same code looks like:


void Ship::Move(int x, int y)
{
_x+=x; _y+=y;
}


you don't need to tell C++, about Self, or about its private properties, or global properties. C++ knows about _x and _y because its defined in the Class prototype.

Last edited by NutsAboutAmiga on 11-Oct-2016 at 04:17 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 04:16 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 04:16 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 04:15 PM.

_________________
http://lifeofliveforit.blogspot.no/
Facebook::LiveForIt Software for AmigaOS

 Status: Offline
Profile     Report this post  
NutsAboutAmiga 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 11-Oct-2016 16:34:13
#16 ]
Elite Member
Joined: 9-Jun-2004
Posts: 12817
From: Norway

@Jupp3

Another disadvantage for C, you need to prototype call functions that are going to be assigned double up, inside the struct as function pointer and outside of the struct as prototyped functions like:


Void Move(struct *self, int x, int y );
struct MyStruct *NewShip();
void DeleteShip(struct MyStruct *);

struct MyStruct
{
int _x;
int _y;
void (*move) (struct *self, int x, int y);
};


The C++ version looks like;


class MyClass
{
private:
int _x;
int _y;
public:
void move( int x, int y);
NewShip(); // for new Ship.
~NewShip(); // too delete Ship.
}


This how you create your NewShip in C.


struct MyStruct *NewShip()
{
struct MyStruct *_new = (struct MyStruct *_) malloc(sizeof(struct MyStruct));

If (_new)
{
// initialize the "private" values (C does not really have private data)
_new -> _x = 0;
_new -> _y = 0;
// setup the function pointers
_new -> move = Move;
}
return _new;
}


This how you create your NewShip in C++


NewShip::NewShip()
{
_x = 0;
_y = 0;
};


Using classes in C++ it a lot less to type, its more readable.
methods knows about objects.

Classes know how big they are, you don't need memory management code, you need using structs, "new" does that for you.

function pointers don't know about its what struct it belongs too. (normally)

And finally C++ has everything C has, if like to use structs, or if you need a function pointer you are allowed to use that in C++ as well.

I use functions pointers inside classes as well, because it make easy to replace code on the fly.
It matter of using the best tool for the job, you don't use a drill to hammer in a spike.

Last edited by NutsAboutAmiga on 11-Oct-2016 at 05:23 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 05:19 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 04:45 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 04:42 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 04:41 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 04:39 PM.

_________________
http://lifeofliveforit.blogspot.no/
Facebook::LiveForIt Software for AmigaOS

 Status: Offline
Profile     Report this post  
NutsAboutAmiga 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 11-Oct-2016 18:08:21
#17 ]
Elite Member
Joined: 9-Jun-2004
Posts: 12817
From: Norway

@Bugala

Quote:
I guess I have to start taking OOP programming more seriously, so far i have mainly avoided them since they seemed to make things more complicated.


The truth is when you're used to do something, and you know how that works, it's really hard to motivate oneself to learn some thing that does something similar. Even if it's easier.

What classes does it simplify the code needed to handle you’re enemy's or players.
Classes creates a link between the data, and the methods to be used on that data.

Because you know what belong to what, it should reduce duplication. That often a course of messy code.

Something I have not used a lot is "Inheritance", what it does it allow you to have some standard code that can be reused in many classes, this can also cut down on code you need to write.

Let's say players and enemy's have a lot in common, but there is some tiny difference.
You might have a creature class that players end enemy's inherit most off.

So if wont to add some to enemy's and player, you add it the creature instead.
This not like a struct inside a struct, the difference is that in class it all looks the same.

Last edited by NutsAboutAmiga on 11-Oct-2016 at 06:23 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 06:19 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 06:12 PM.
Last edited by NutsAboutAmiga on 11-Oct-2016 at 06:09 PM.

_________________
http://lifeofliveforit.blogspot.no/
Facebook::LiveForIt Software for AmigaOS

 Status: Offline
Profile     Report this post  
Hypex 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 12-Oct-2016 15:13:38
#18 ]
Elite Member
Joined: 6-May-2007
Posts: 11204
From: Greensborough, Australia

@NutsAboutAmiga

Just for fun. An OS4 specific C code version.


void Move(struct Ship *Self, int x, int y );
{
Self -> _x += x;
Self -> _y += y;
}

struct Ship
{
int _x;
int _y;
void APICALL (*Move)(struct MyStruct *self, int x, int y);
};


Then, assuming MyShip points to a struct Ship and we have filled in all the gaps. This is how we move MyShip.


MyShip->Move(x, y);


Okay so you only hide a self pointer but it helps I think.

Last edited by Hypex on 12-Oct-2016 at 03:15 PM.

 Status: Offline
Profile     Report this post  
NutsAboutAmiga 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 12-Oct-2016 18:36:35
#19 ]
Elite Member
Joined: 9-Jun-2004
Posts: 12817
From: Norway

@Hypex

I'm not angst function pointers, but they are bit more work then methods. As I wrote before I do mix this into my class.

But the structs needs to go. Structs are lot more hazel to manage then a class.

_________________
http://lifeofliveforit.blogspot.no/
Facebook::LiveForIt Software for AmigaOS

 Status: Offline
Profile     Report this post  
Bugala 
Re: Experienced coders, bring me up to date a bit on coding systems.
Posted on 15-Jan-2017 16:22:35
#20 ]
Cult Member
Joined: 21-Aug-2007
Posts: 649
From: Finland

After a long time I have another question regarding this.

I am now starting to realise the idea behind this, and I think I also now know what it was that I was trying to describe in the original question.

imaginary example:

Lets say I have functions called

move() {
self.x = self.x + 1
}

and

fly() {
self.y = self.y - 1
}

So now I can have a object, something like

Human() {
self.x=100
}

All I have to now do, is to simply add this move() function to the human class/object, and that human will be able to move.


Then I make a

Bird() {
self.y = 500
}

Now to make that bird fly, all i have to do is add that Fly function for that bird, and the bird can fly.


Human.move()
Bird.fly()

And they both are moving accordingly, even I didnt do any specific moving codes for neither human or fly, but just took from general move() and fly() functions that i added to their objects/classes.

Based upon this, I suppose there is some sort of function/object/classes like Gravity, different kind of Movements like flying, running, rolling...

That I can inherit to my character classes.


My actual question is, am i right, and if this is so, then is there some place where i can get these classes?

For I would quess there are some ready functions/classes/objects that i can keep adding to my own classes/objects.

Last edited by Bugala on 15-Jan-2017 at 04:23 PM.

 Status: Offline
Profile     Report this post  
Goto page ( 1 | 2 Next Page )

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle