Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Saving Vehicle Location Data Better?

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Mr B




Joined: 20 Mar 2003
Posts: 382

PostPosted: Sat Sep 27, 2003 3:59 am    Post subject: Saving Vehicle Location Data Better? Reply with quote

I don't know if this has been tried before (in fact, I have not even tried it myself, so this is all theoretical), but I came up with an idea for saving location information on maps in a single global variable instead of two -- which could be used to 'remember' where a vehicle was left, for example.

A map cannot have more that 32,767 tiles on it, right? Well, a global variable cannot hold a value larger than 32,767. Because there cannot be more maptiles than the maximum number that a variable can hold, it should be possible to hold the X/Y coordinates of any one place on the map in a single global variable.

Using these pseudocode algorithms:

Saving: var=(Y value of location)*(width of map)+(X value of location)

Loading:
Y=var/(width of map)
X=var,mod,(width of map)

This depends, of course, on the division operation performing an integer truncation instead of rounding. Does OHR division truncate or round?

If it rounds, then have the Loading algorithm go like this:
X=var,mod,(width of map) #same as before...
Y=(var-X)/(width of map) #needs X value

Unfortunately, there is not plotscripting function to find the maximum X widths of maps, so I'd have to use constants.

Criminy, did that make any sense? Rolling Eyes

What do you all think? Would this work?
Back to top
View user's profile Send private message
Flamer
The last guy on earth...




Joined: 04 Feb 2003
Posts: 725
Location: New Zealand (newly discovered)

PostPosted: Sat Sep 27, 2003 8:35 am    Post subject: Reply with quote

...what's the point in using one global for a two global variable??

confused!?
it means, good thinking on the idea, but where on earth does this lead to, coz it'll be much easier to use two global variables instead of the one...
unless of course you are using a great number of globals for other things.
_________________
If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch Raspberry!
(no offense to anyone that was mentioned)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Me
HI.




Joined: 30 Mar 2003
Posts: 870
Location: MY CUSTOM TITLE CAME BACK

PostPosted: Sat Sep 27, 2003 9:00 am    Post subject: Reply with quote

While your method does make sense, keep in mind that the script compiler can handle up to something like 32767 global variables (or was it 16000 global and 16000 local . . . I forget), so unless you're making an absolutely huge game, you won't bee needing to conserve variables. But good idea, very good idea . . .
_________________
UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START
Back to top
View user's profile Send private message AIM Address
Cube
Dimensional Traveller




Joined: 02 Feb 2003
Posts: 294

PostPosted: Sat Sep 27, 2003 10:47 am    Post subject: Reply with quote

Local variables don't have any limit (Although having a LOOOOT might cause some problems while the script is running, like a buffer overflow... Maybe), and you can only have 1000 global variables. Still, 1000 numbers is a lot and not many people will fill that up. Using 100-200 is easy to do, but if you're efficient you should never have any problems.
Back to top
View user's profile Send private message
Mr B




Joined: 20 Mar 2003
Posts: 382

PostPosted: Sun Sep 28, 2003 2:15 am    Post subject: Reply with quote

Oh, I don't particularly care whether it makes sense or not, just as long as it can be done. Wink

Actually, I don't know if anyone would ever use it, really. Unless if there was a game that had a custom battle engine, but even then... Hmm. Maybe someday I should try to make something that uses up all those variables.

Nah.

But I'm sure that there are some uses for it; they just haven't been found. Or needed, at least. I just wanted to know if it could feasibly be done.

P.S., and I think that the OHR supports 1000 global vars. Yeah. Something like that.
Back to top
View user's profile Send private message
Flamer
The last guy on earth...




Joined: 04 Feb 2003
Posts: 725
Location: New Zealand (newly discovered)

PostPosted: Mon Sep 29, 2003 10:16 am    Post subject: Reply with quote

1000 globals is plenty to use for a two or so games...
even games with custom battle systems wouldn't need 100 globals, unless it has all these variables like FF8's zell's limit break(ok not a good example, i'm blank on any battle systems that would go over 100)

besides locals can be "recycled" when one is no longer needed, it's value can be reset (like default 0)
_________________
If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch Raspberry!
(no offense to anyone that was mentioned)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
GMan1988




Joined: 01 Nov 2003
Posts: 16
Location: Nowhere

PostPosted: Tue Nov 25, 2003 4:47 pm    Post subject: Reply with quote

I think that if you're going with plotscripting, you can do just about anything. Don't worry, if you really want to make a rogue-style game, you'll think of something eventually. Just don't ask me for help, okay? I'm pretty new with this stuff. Neutral
_________________
.hack//SIGN is freakin' awesome.
Back to top
View user's profile Send private message
Flamer
The last guy on earth...




Joined: 04 Feb 2003
Posts: 725
Location: New Zealand (newly discovered)

PostPosted: Tue Nov 25, 2003 6:31 pm    Post subject: Reply with quote

ok... i know this sounds stupid, but i've got two things to say...

one: This is a dead thread, DO NOT REVIVE DEAD THREADS!
two: yes, it is possible to do many things with plotscripting... though not everything...
_________________
If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch Raspberry!
(no offense to anyone that was mentioned)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Iblis
Ghost Cat




Joined: 26 May 2003
Posts: 1233
Location: Your brain

PostPosted: Tue Nov 25, 2003 6:37 pm    Post subject: Reply with quote

Also, if you absolutely must revive a dead thread, at least make sure you have something worthwhile to say. Saying "I'm new with plotscripting" is not a worthwhile thing to say.
_________________
Locked
OHR Piano
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Nov 25, 2003 11:26 pm    Post subject: Reply with quote

Oh. I never realised this was a dead thread when I was reading it. But I'll sum up on the topic:

1) Of course that would work B, and the OHR doesn't round.

2) There is a maximum number of local varaibles, and when you exceed it, you get a 'script heap overflow' error. That's why there's a (pink) bar in PS debugging mode for locals.

3) You can eat up huge amount of globals when using fake arrays (which means custom battle system also typically use alot) . For instance, for the script on Moggle1s PS library page that tweaks palette by percentage, I believe it uses 768 globals.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group