You are an unregistered user, you can register here
Navigation

Information

Site

Donations
If you wish to make a donation you can by clicking the image below.


 
Go Back   The Unreal Admins Page > Forums > Hosted Forums > UTPure > Anti-Cheat Development > Anti-Cheat Developer's Corner

Reply
Thread Tools Display Modes
  #1  
Unread 30th December, 2008, 08:46 AM
Azura's Avatar
Azura Azura is offline
Holy Shit!!
 
Join Date: Apr 2003
Posts: 4,029
Default [Release] LinkedLists for UT

Hi,

Ever been frustrated of being limited to fixed arrays ? Here's something that might interest you.

Download : http://files.filefront.com/LinkedLis.../fileinfo.html

Taken from the readme :

Quote:
LinkedList for Unreal Tournament 4.36
=====================================

[ About ]

LinkedList is a complete script for programmers that allows you to store information under object form without resorting to arrays. Contrary to arrays, the size of a LinkedList can be modified at any time. It's only limitations are how much memory your server has and that it cannot be used to store primitive datatypes such as int (read below for a solution to this).

Note that it is in beta form at the moment so it might contain some bugs. However, it appears to perform as intended.

[ Instructions ]

To test the script, you can load it up as a mutator. Simply drop LinkedList.u and LinkedList.int in your System folder and load the mutator in an offline game. Once the game is started, shut down UT and have a look in UnrealTournament.log. You should see the following lines :

ScriptLog: Add mutator LinkedList.TestMutator
ScriptLog: Test mutator started

The mutator is designed to test the various methods/functions that LinkedList has :

function add( Object anObject ) Add an object
function clear() Clear the LinkedList
function bool contains( Object anObject ) Test if LinkedList contains an object
function Object get( int index ) Get the object at position index
function ListElement getListElement( int index ) Get the ListElement at position index (normally reserved for internal usage)
function bool isEmpty() Test if LinkedList is empty
function removeObject( int index ) Remove the object at position index (remove is an unrealscript keyword)
function set( Object anObject, int index ) Set the object at position index to the given object
function int size() Get the size of the LinkedList

To use this in your script, simply copy the files LinkedList.uc and ListElement.uc that are provided in the Source folder. You can use LinkedLists directly in any of your classes. To instantiate a linked list, proceed as follows :

local LinkedList listTest;

listTest = new class'LinkedList';

If you wish to store primitive data types (int, string, float, etc), create a class containing the variables which you want to work with :

class MyVariables extends Object;

var int myInteger;
var string myString;
var float myFloatArray[32];

defaultproperties
{
}

Refer to the test mutator on how to instantiate a custom class and to store it in LinkedList. Note that typecasting is necessary when you retrive an object from a LinkedList to access it's functions.


!!!Important!!! :
Since instances of classes derived from Actor such as PlayerPawn are also objects, it is possible to store them in a LinkedList. However, it is highly advise to clear any references to these objects using at the end of a game (in Mutator HandleEndGame() for example) as not doing so will prevent UT destroying these objects and probably cause the server to crash. Moreover, any custom objects that do not depend on Actor can remain resident during map changes. So be very careful about how you manage any custom objects you make.

[ Contact ]

If you have any suggestions or comments, send an e-mail to [email address].


James P.
aka 'Azura'
December 2008.

P.S: A big hi to the guys at JavaBlackBelt.com who are doing a really great job of training future developpers.
__________________
How to feck up a perfectly good game:
UT (1999) = UnbelievableGameSoCoolIMustHelpBringNewPlayers Tournament
UT (2008) = Unreal ThrustMyPrivatePartsInYourFaceBish

And that's probably why UTIII was a relative flop. New game, same sh*thead players ^^.
Reply With Quote
  #2  
Unread 30th December, 2008, 03:18 PM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

Interesting. So this adds functionality similar to a java's ArrayList object to UT, if I understanding correctly?
Reply With Quote
  #3  
Unread 30th December, 2008, 06:07 PM
Azura's Avatar
Azura Azura is offline
Holy Shit!!
 
Join Date: Apr 2003
Posts: 4,029
Default

That's more or less the idea. It's not possible to do ArrayLists because UT1 doesn't support dynamic arrays (the output is an array from what I've understood). LinkedLists are the next best thing.

It's using same idea as the Inventory list except it's a lot more flexible. The mutator included tests all the operations possible and outputs the results to the log.

There will probably be an update tommorow adding suggestions by Wormbo to add double links and an instance recycler. An Iterator interface will be added later.

Edit: Small correction. ArrayLists in Java use a dynamic array internally. If there's a performance gain to be had, it might be possible to use fixed arrays in unrealscript and chain those together.
__________________
How to feck up a perfectly good game:
UT (1999) = UnbelievableGameSoCoolIMustHelpBringNewPlayers Tournament
UT (2008) = Unreal ThrustMyPrivatePartsInYourFaceBish

And that's probably why UTIII was a relative flop. New game, same sh*thead players ^^.

Last edited by Azura : 31st December, 2008 at 09:23 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:08 AM.


 

All pages are copyright The Unreal Admins Page.
You may not copy any pages without our express permission.