Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (kzhao, AndrewAMD, bigsmack), 824 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Is it possible to make a game with C/C++ only? [Re: AlexH] #294654
10/20/09 12:47
10/20/09 12:47
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
you're right, but still a scheduler is not necessarily slower than function calls.

Re: Is it possible to make a game with C/C++ only? [Re: AlexH] #294746
10/20/09 22:51
10/20/09 22:51
Joined: Oct 2009
Posts: 33
A
AlexH Offline OP
Newbie
AlexH  Offline OP
Newbie
A

Joined: Oct 2009
Posts: 33
Hello? Can I please get a reply, it honestly does not look like I can program a full game with C++.

lite-C is annoying, limiting, and easy to make a mess of. Entities for example can't have anything other than variables of type "var" attached to them, no inheritance, no initialization and stuff like that, I'd really like to use C++.

Re: Is it possible to make a game with C/C++ only? [Re: AlexH] #294749
10/20/09 23:14
10/20/09 23:14
Joined: Sep 2002
Posts: 1,604
Deutschland
ChrisB Offline
Serious User
ChrisB  Offline
Serious User

Joined: Sep 2002
Posts: 1,604
Deutschland
You can program a full game with cpp. There is no problem. In the manual is a simple tutorial under "engine sdk". Things like the "target" vector is stored in the enginevars struct. You can use it with ev->target, or with v(target).


www.Swollen-Eyeballs.org
ICQ:169213431
#3dgs@quakenet
Re: Is it possible to make a game with C/C++ only? [Re: ChrisB] #335686
07/30/10 02:28
07/30/10 02:28
Joined: Dec 2009
Posts: 128
China
frankjiang Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 128
China
how to used v(target)x or evt->taget in cpp,
could you give me a example?
and in cpp,how can used you and me ?

Last edited by frankjiang; 07/30/10 02:29.

development 3d game is interesting!
Re: Is it possible to make a game with C/C++ only? [Re: frankjiang] #335712
07/30/10 09:39
07/30/10 09:39
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
me, you, target, etc. are global variables in their respective type. Just access them via the engine vars struct like

VECTOR* target = ev->target;

or

vec_set(ev->target, vector(_VAR(1), _VAR(2), _VAR(3));

Since _VAR and his relatives are annoying it might be efficient to use a default vector class and only transfer back the Gamestudio-vector format (count var in, var is annoying) when finishing your calculation.

If you are about speed, then calling all functions and use one wait(1) (--> in Lite-C) is actually faster. The Lite-C compiler is way away from being optimized and a lot of users recognized that a lot of concurrent wait(1) functions are swizzled up in the scheduler -- in a slow fashion. I doubt JCL will proof this or proof this wrong since this is a kea feature of Lite-C, but experience it yourself and you see.

And if you are really about speed, do the same in C++ and do not try to invoke DLL functions for each frame for each entity. It is fast, no doubt, but the reason for while-approach is simple: 1.) no 1000 entity dll calls per frame, only one or two global ones maybe and 2.) (and maybe most important) if you do it in a while and all your entity functions are not dependent on each other you can parallelize easily the function calls per while iteration (actually, when you use e.g. OpenMP, its just one single added line to achieve that).

Just my thoughts. I think, you have to test it on your own to get to know about all this stuff.

Re: Is it possible to make a game with C/C++ only? [Re: HeelX] #335731
07/30/10 11:40
07/30/10 11:40
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
There is no need to use wait() at all.
(only once in the main loop)

In all other games, there is usually a single
Game-loop, wich uses a sleep() function to time the game
(unless it renders with maximum fps)

You can do the same in lite-c.

But then you have to manually call all functions of the gameloop.
And handle all entity actions manually. (using their pointers)

Bottom line, you can write a big game using just a single wait(1), wich is needed to let the renderer take over.

It might be cleaner to program this way. As you dont have
functions running in paralel. And you have full control
of the order of processes.

Re: Is it possible to make a game with C/C++ only? [Re: Damocles_] #335854
07/31/10 03:21
07/31/10 03:21
Joined: Mar 2009
Posts: 146
USA
P
paracharlie Offline
Member
paracharlie  Offline
Member
P

Joined: Mar 2009
Posts: 146
USA
Have fun reinventing the wheel in C++.


A8 Commercial
Re: Is it possible to make a game with C/C++ only? [Re: Damocles_] #335868
07/31/10 08:59
07/31/10 08:59
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
Originally Posted By: Damocles_
It might be cleaner to program this way. As you dont have functions running in paralel. And you have full control of the order of processes.


the scheduler doesn't run functions in parallel either. it also is just a list of functions that get called after each other. you have full control over the order. the big difference is that local variables get stored/restored at each wait().

i think wait() can be very convenient and very fast to work with but it tends to lead to less well planned code because of that. laugh

Re: Is it possible to make a game with C/C++ only? [Re: ventilator] #335894
07/31/10 13:08
07/31/10 13:08
Joined: Mar 2009
Posts: 146
USA
P
paracharlie Offline
Member
paracharlie  Offline
Member
P

Joined: Mar 2009
Posts: 146
USA
I'm trying to figure out an answer to your question but the only thing that I can think of right now is that you may possibly do not truly understand the functionality of wait or scheduling and how it really works "behind the scenes." Why wait is used and when to use it is important for giving the engine time to store local variables, pointers and allow the engine to schedule functions before returning back to the action after designated frames or time and having 50 entity's on the screen with wait doesnt mean you'll wait 50 seconds for the engine to make up its mind. You can overload time without causing any problems because different waits can be run parallel. Why you would think that wait is a bad thing just makes me think that maybe you should do a little bit more reading up on it or work with it more, maybe you just dont understand its use.

I didnt write this as an argument or an attempt to belittle you but maybe you will look at it closer and try to really understand it as a means of helping yourself.

Why do you feel that using var is bad? Just dont understand your thinking.

Last edited by paracharlie; 07/31/10 13:15.

A8 Commercial
Re: Is it possible to make a game with C/C++ only? [Re: paracharlie] #336020
08/01/10 09:15
08/01/10 09:15
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Coroutines are an indeed fine concept. Though, since their execution order is not transparent, you have to assume that they are non-deterministic. This leads to akward code and side effects when you attempt to snychronize e.g. several entity actions. Plus, freezing code which is intersected with wait(1) statements leads to a A) proprietary compilation which is B) not optimized (it is a safe bet that the compiled game runs way faster if you use the VS compiler because it does a hell of optimizations) and C) slower due to the fact of freezing code (storing and restoring local variables, instruction pointers, parameters, etc.pp) and D) single threaded (atm and I wouldn't bet on it that JCL ever makes the execution of all concurrent coroutines multi-threaded!).

If you use the event-hook so that the engine calls one callback function each frame you can do a semantic thread of execution by yourself which avoids all these problems. It forces you to think about your coding (opening coroutines by random just because you have wait(1) is evil, it looks easy and tempting, just because it is easy - but in the end you are yelling around just because refactoring your code is painful. This applies to most novices.). And it gives you the opportunity to do better coding. Things like polymorphism comes into play, which is great (others too, I am just mentioning this one).

and...

var is a fixed point type - which is, technically speaking, a pain in the ass. It is limited, it is unprecise, it is inconvenient. Working with var's feels sometimes like arguing with a woman.

Last edited by HeelX; 08/01/10 09:19.
Page 2 of 3 1 2 3

Moderated by  TWO 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1