|
SubscriptionsSites I Read
|
|
|
|
| =(
No motivation, no inspiration... somebody help! >_<)
PS: I am getting better on WoW script writing, check this out
/cast Hunter's Mark(Rank 1) %T /script PetAttack()
can make two movements in one click! just ONE click, isnt it amazing? could be helpful on your Mage too ned.
sorry i am possessed by evil spirit now...
---- another unrelated post ---
| | |
| Ugh. I'm trying to setup a CVS server..
| | |
| Thank you John for the idea (again): he wrote,
Ah I understand a little more now. Originally, I assumed that you needed to convert Z back to X and Y for some purpose, but you only really asked me whether a unique X and Y could be derived by Z because you wanted to know whether there was a 1-to-1 correspondence, which there is. I was thinking that the conversion back is especially troublesome and slow. If you really want to render the tiles from corner to corner, a loop like this might help. for (int y = 0; y < MaxY; ++y ) { for (int i = 0; i <= y; ++i ) { RenderTile(i, y - i); } } By the way, what is MaxY? I know that you'll probably let the mapeditor decide, but what is the absolute max, that the editor can set?
Ok. I think this would work. Actually this problem also involves the datastructure we are using to store the objects on the map too. We need some sort of collection that we can do: obj = collection.getObjectAt(x,y) really fast. I think I will use combination of everything. Number the tile using bit-shifting and use binary-sort array for O(log(n)) add, remove and search. Then use that loop to render tile. Well but note that the loop above also runs through tiles those don't exist. For example, we have map size 3x3 (MaxY has to be 5). It goes (0,0) (0,1) (1,0) (0,2) (1,1) (2,0) (0,3) (1,2) (2,1) (3,0) (0,4) (1,3) (2,2) (3,1) (4,0) Which actually shouldn't matter for my dual Pentium4 3.2Ghz HT. lol. We could simply add
if (y > RealMaxY or i > RealMaxY) continue;
-- it should help too.
More Problems for the Thinkers.. When we develop AI for monsters or NPCs, we need some kind of algorithm to find objects in a given radius with decent timing.
Suppose a monster is at (10,10) and it detects anything in 2 tiles radius. True circle area would be perfect or a 5x5 square is acceptable too. I need a datastructure that could help me get this list:
ArrayList listOfObjects = collection.getObjectInRadius(x,y,r);
My simple solution is a wrapper class that wraps binary-sort array (discussed above) and scans from (x-r,y-r) to (x+r, y+r). This costs O(r^2) [or ohmega i dont remember]
| | |
| Thank you John for the idea. I thought of the bit shifting and bit masking before. It's a good solution to represent coordinate-pair using one 32-bit (or 64-bit) integer. But it doesn't solve another problem: how do we render from back to front quickly (see numbering sequence below). For example, tile (0,0) needs to be rendered before (1,0) and (0,1), (1,2) should be rendered before (2,1) etc. With my numbering concept, we can have a sequencial rendering.
Actually.. I will need to do some experiment. Maybe this simple loop: for (int y=0; y < MaxY; y++) for(int x=0; x < MaxX; x++) RenderTile(x,y);
- probably gives the same effect of realistic. tsk tsk... And if it works, I don't even need theat complicated numbering.

| | |
| Ok, at least I tried...useful links:
Here you go, Java animation for kids : http://www.video-animation.com/java_007.shtml
Or I can invest in some software like this: http://www.thegamecreators.com/?f=promotion
Data structure wise, here is what I wish to see//
Remember in the "Java animation for kids" link, mentioned that Japanese
anime runs on 4-5 frames per second, so lets make it simple by 4 frames
per second
given: -4 frames per second
-3 Layer object/ class (Body, Armor_Body, Weapon)
-And the instance of this movement class is called "Attack" which will
be set for 3 seconds
Attack ===============================================
| Frame: | 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | | Body | 1 | - | 3 | - |
| 5 | - | 7 | - |
| 1 | 3 | 11 | - | | Body_Armor | 1 | - | 3 | - |
| 5 | - | - | - |
| 9 | - | 11 | 12 | | Weapon | x | - | - | - |
| 1 | - | - | - |
| 5 | - | - | - |
- Loop signal
- Length (seconds)
- Files (Body_01.png, Body_03.png etc etc...)
====================================================
The highlighted yellow are the frame numbers, and the blue
are the pose (image) numbers... So say if they'r 3 paralleled linked list,
each cell will contain pointer to the image base on the number given.
There should be a display/run/play function, that it will go through
the list and display the layered image frame by frame, I think we could
figure it out by studying the "delay" function used in "Java animation for kids.... "
The rules of numbering the poses (images) are as follow~
- If the frame is a hold/repeat of the previous frame, indicated by "-" sign
- If layer is empty, apply x/0 to the empty frames. Any non-empty poses comes after, will start with #1 (e.g. Weapon)
- If we re-use a previous pose (e.g. Body frame 9, 10) the following new pose will be numbered according to the frame #
Some indication of loops may be needed. Probably -1 for continuous loop
(such as breathing cycle), 0 for none, 1 for one loop which is repeat
once... and so on.
----------------------------------------------------------------------------------
This is just an idea... at this point I am not smart enough to come up
with anything more than this... I mean hellooo, i am the artist here!
Probably you and John can work this into some dictionary or a tree
structure for a more efficient result. But please do contact him, you
can explain the problems better than I do. Tks
ps: Here is a link to a map editor some other ppl made, check it out:
http://www.inet2inet.com/InetSoftware/World-Creator/WCv2/NewFeatures_Form.asp
- D.
***update ------------ question #1
So i talked to John tonight, here is his suggestion
[00:39] xanax654: first of all, I think it might work, but I'm really too tired to prove that. proofing is hard work... second
[00:40] xanax: why not an easier functioN+
[00:40] xanax: ?
[00:40] xanax: what are the limits of x and y?
[00:40] GoGoDoug: >= 0
[00:40] xanax: no upper bound?
[00:40] GoGoDoug: depend on the map
[00:40] xanax: are they discrete space? (integers?)
[00:40] GoGoDoug: yes
[00:41] xanax: hmmm, sure it's possible. bit operators are the fastest way
[00:41] xanax: bit masking and bit operators
[00:41] xanax: z = x<<8 + y;
[00:42] xanax: x = z>>8;
[00:42] xanax: 111011<<3 = 111011000
[00:42] xanax: 111011>>3 = 111
[00:42] xanax: y = z & 11111111
[00:43] xanax: so this would be my function
[00:43] xanax: z = x<<8 + y
[00:43] xanax: x = z>>8
[00:43] xanax: y = z&11111111
[00:43] xanax: an example would be this:
[00:44] xanax: x = 10110101
[00:44] xanax: y = 00100101
[00:44] xanax: z = 10110101 00100101
[00:44] xanax: x = z>>8 = 10110101
[00:44] xanax: y = z&0000000011111111 = 00100101
[00:45] xanax: in decimal that would be Z & 255
[00:45] xanax: bitwise AND "&" is just bitmasking the first 8 bits
[00:45] xanax: getting rid of the "garbage" that belongs to "x"
[00:46] xanax: so we only have the bits for y
[00:46] xanax: i'm not saying his function doesn't work, but I just can't verify that right now...
[00:46] xanax: and plus, bit shifting is fast
[00:47] xanax: and easily optimized by most compilers
[00:47] xanax: and easier to understand (most engineers would understand, so it doesn't make code into spaghetti code)
[00:48] xanax: if x and y can be bigger than 255, then just use bigger numbers
- D.
| | |
|