Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Arrays in Types for Patch 5 / 6?

Author
Message
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 27th Apr 2003 17:03
Does anyone know if arrays in types will be possible with Patches 5 or 6?

I am designing the AI system for my next project / tech test, a simple FPS affair, it is based around a "level events" system. Basically all the various actions in the world (barrels exploding, doors opening, bullets firing, baddies dying) generate an event which is handled like this:

[Bullet Fired] > Event Generated > Game checks to see which AI enemies are visually or audibly aware of the event > Event assigned to relevant baddies > Game Processes AI events and assigns actions for each enemy to take as appropriate.

There are LevelEvent and AI types, and I really need the AI type to be able to contain an EventID array which stores all the appropriate event numbers to deal with for that frame.

Can anyone see a way of getting round this without the AI type having to have Event1, Event2... etc. properties to assign each event to which would be pretty inefficient and have limitations on the possible no. of events each AI player can handle. I thought of maybe trying to mimmick this functionality with memblocks, but maybe I am missing an easier way?
Current Project: Retro Compo. Entry.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 27th Apr 2003 18:22 Edited at: 27th Apr 2003 18:24
personally there are a few updates i'd love to see more than anything

Data Type Arrays


Dynamic Array Allocation


Data Type Passing


Data Type Array Access


Data Type Input Definition


i wouldn't mind seeing a Vertex and Pixel buffer either... seeing as the vertex format is FVF - you should be able to creat Vertex & Index buffers within the program which you can then convert to objects later on. I mean i've noticed that no matter what i do i can't seem to convert a memblock i've edited as a FVF to export to an object that is doing what it is suppose to]

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Apr 2003 18:38
I'd like to see passing by reference. That would eliminate most of the need for globals.

Data type arrays ... I totally agree
Dynamic array allocation ... Do't we have a form of this already, using 'ARRAY INSERT AT BOTTOM' or have I missed your point?
Data type passing ... Yes, yes, yes!
Data type array access ... Um, is that accessing each item using a subscript, so [0] would always access A and [1] would always access B? I'm not totally convinced.
Data type input definition ... If you can have passing by reference, you could do this yourself, and have what is effectively a constructor.
n3t3r453r
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Russia
Posted: 27th Apr 2003 18:57 Edited at: 27th Apr 2003 18:58
Agree, but, Raven, dynamic arrays are simply linked-lists or double linked-lists. To use them we must call such functions as "array insert at ..."

>I'd like to see passing by reference. That would eliminate most of the need for globals.
Passing by reference is impossible in C or C++. But emulation is possible and, of course, we need it.

We need more low-level operation with variables, for example:



`should be same as

t2 as _S
t2 = new _S
or something like this... Also we need & and * operations for all data types

I'd like to change the world, but God doesn't want to give me sources!
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 27th Apr 2003 19:13
well yeah the array inset at bottom and such do have the same effect, but for some reason its just not as friendly to use as the C++ method of just adding what you need.

and for the Data type array access i'll show you a better example


that'd copy all of the vertex from the memblock to the Vector type
and now

VectorObject(0).px = VectorObject[0]
VectorObject(0).py = VectorObject[1]
VectorObject(0).pz = VectorObject[2]
VectorObject(1).px = VectorObject[3]
VectorObject(1).py = VectorObject[4]
etc...

basically just indexing which is possible through memory pointers, but we don't even have those with UDT's yet

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Apr 2003 19:25
Aha, now I see.

But wouldn't this be better?



That would make it clearer what was happening, and make it easier for Lee to parse.

Quote: "Passing by reference is impossible in C or C++. But emulation is possible and, of course, we need it"

Not at all. Neither C or C++ would be what they are today without some form of pass by reference.



The first is the C way of doing it (passing the address of the variable), the second is the C++ way (passing the variable). Both compile to *exactly* the same machine code.

This should be relatively easy for Lee to do ... in fact I might suggest an easy way for him to do it That's if he hasn't already done it for patch 5.

Although personally I would like to be able to dynamically allocate memory for structures (a disease I caught from C), I'm not so sure on how to do it in the BASIC way, so that you don't end up with memory leaks, referencing NULL, overwriting memory and all the other dangers that come with doing such a low level thing.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 27th Apr 2003 19:59
well yeah that would be simpler
i've kinda been lost on why Lee went for '( )' as the Array prefix rather than the '[ ]' - i mean it doesn't make sense because surely it'd be simpler to parse if the value is an array or a function if they brakets were different?

however it is choosen to be inplimented i'd love to see index'd types as you do alot more with then because you can access the data stored in a sequence.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 27th Apr 2003 21:12
"i've kinda been lost on why Lee went for '( )' as the Array prefix rather than the '[ ]' - i mean it doesn't make sense because surely it'd be simpler to parse if the value is an array or a function if they brakets were different?"

I definately agree with that, the use of '('s means that arrays can be confused with functions at a glance, square brackets would make it slightly easier to read the code.

I don't mind all those other language features too much, it is just the lack of arrays in types which really bothers me, I have encountered many situations where they would be VERY useful, such as my intended AI implementation.

Current Project: Retro Compo. Entry.
The One Ring
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 28th Apr 2003 01:24
I would LOVE to see :

1. Arrays in types
2. Passing types as function arguments
3. Returning types from functions

Ahhh... To dream....

Good, bad... I'm the guy with the gun. - Ash in Army Of Darkness(1993).
http://www.geocities.com/the_one_ring
iac249
23
Years of Service
User Offline
Joined: 26th Mar 2003
Location: USA
Posted: 28th Apr 2003 01:56
Passing arrays as parameters would be nice. x-d

Login to post a reply

Server time is: 2026-07-11 04:23:34
Your offset time is: 2026-07-11 04:23:34