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.

Work in Progress / Utility Function Collection [UFC]

Author
Message
enderleit
17
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 23rd Jul 2010 13:40 Edited at: 28th Sep 2010 01:26
UTILITY FUNCTION COLLECTION

This is a collection of useful utility functions for use in your DBPRO games or applications.
There are a lot of stuff in there already, but I have plans to add a lot more, which is why I have posted it under WIP.
The functions already included are ready to go, but I might elaborate on them further if I get some useful ideas.

This collection is free and open source, so please feel free to use it any way you like. You are also welcome to expand the collection if you have anything useful lying around. If you do, please post here so I can keep up to date.

Any comments, ideas, or bug-reports are as always welcome...


Current Utilities:

LANDSCAPES:
- Dynamically create and delete Matrix Landscapes very easily.
- Load and apply HeightMaps or Textures easily with one command.
- Apply HeightMaps or Textures you have already loaded.
- Easily get the Matrix number, or the Width/Depth and number of Tiles, and then use regular Matrix commands on your Landscape.




TIMERS:
- Dynamically create and delete timers.
- More than one Timer can be used at any point.
- Start and Stop/Pause functionality.
- Reset and Restart a timer with same duration.
- Get elapsed time, percentage done, and duration of Timers.
- Independant of framerate and each other...


LOGICS:
- Dynamically create and delete Logic circuits.
- Connect Wires and various Gates to create a circuit.
- Update output Wires based on the Logic of the Gates.
- AND, NAND, OR, XOR, NOR, and CMP Gates can be chosen.
- UFC_Truth() function to get the Logic of a specific Gate type, without creating an actual circuit.


NODES:
- Dynamic creation of tree structures made up of Nodes. Similar to a mindmapping structure.
- Attach Nodes to other Nodes, or create a new Root Node.
- Set a name for your Nodes, and be able to find them later by Name.
- Attach data to your Nodes by referencing their NodeID. (this is not included, since I don't know what data you want to use)
- Read the comments in the "nodes.dba" file for more info...


RESOURCES:
- Simple function to find an available resource number for most standard types.


CHANGELOG

28/09-10: Fixed a bug in Landscapes that caused the Texture to be applied incorrectly. The download has been updated.

26/09-10: Added Landscapes and Resources.

25/09-10: Added Nodes to the collection.

- enderleit

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Jul 2010 14:41
Don't mean to put a downer on this without spending more than the 10 minutes I already have but don't we already have a full system of "logic gates" in DBP anyway?

The timer stuff can make life easier for people new to those sort of functions but is this:


...quicker/better than this?


When you have to add two include files to make it work?

enderleit
17
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 23rd Jul 2010 18:31
The example here is very simple to show how to set up a gate...

The point of it is that you can build all kinds of Logical/Electrical circuits in-game to simulate those kinds of things...

You could draw up a complex schematic on paper and then easily set it up with these functions and have them control doors, locks, elevators, etc...

- enderleit
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Jul 2010 18:43
I'm probably being short-sighted, sorry.

Maybe it would help if you gave an example of this kind of thing to better illustrate the advantages?

Dark Dragon
17
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 23rd Jul 2010 19:07
Sounds cool, Will have to play around with the logics, its making me very curious.

enderleit
17
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 25th Sep 2010 21:08
Edited the top post with a new version...

The new version includes the Nodes functions, which lets you create a Node-tree structure, similar to what you would see in a Mindmapping type program.

This could also be used for many other purposes, though I'm not entirely sure what.
Might be used for stuff like tech trees in strategy games, or similar stuff...

It is possible to attach any kind of data to the Nodes in the tree by referencing their NodeID in your DataList. Although this is something you would have to set up specifically for the use you intend. There is a simple example in the comments of the "nodes.dba" file to help you get started though...

Comments, ideas, suggestions, and bug-reports are as always welcome...

- enderleit
enderleit
17
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 26th Sep 2010 23:06
Added some new functions which helps you create nice Matrix Landscapes with HeightMaps and Textures.

Also added a simple Resource function to easily find an available resource number for most standard types.

Edited the top post with info, and an updated Download...

- enderleit
enderleit
17
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 27th Sep 2010 03:01
I made a slightly better example for the Logics functions. The download is attached to this message.

Hope you like it.

- enderleit

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 14:01:49
Your offset time is: 2024-11-24 14:01:49