Title: Newlink
Gumbro - August 22, 2007 05:07 PM (GMT)
Well, it works indeed. I now have a 10x10 test world with script-generated rooms and links. Perhaps I got it wrong, but one needs to declare
| CODE |
| NewLink(parameters) = name |
In order to get it working. Of course, it is necessary to give an unique name for each link. This is not readily apparent from the manual, at the location where NewLink is described. Or is it just me, abusing the NewLink instruction in some way?
Cheers!
G
Cris - August 22, 2007 06:03 PM (GMT)
Hi,
NewLink() is a function, you should find it documented in the "Functions" section of the developer's reference (page 98)
Using it that way may not continue to work in the future, you should call it on the right hand of the assignment such as:
| CODE |
Dim mylink = NewLink(parameters...)
|
or also
| CODE |
Call NewLink(parameters...)
|
Gumbro - August 23, 2007 07:12 PM (GMT)
No problem, it just took me a while to figure out how to get the NewLink working, even though I had the manual. A piece of sample code there would have been very helpful.
I now have script generated link names, too, and the whole thing is working perfectly. It just takes a little while longer to reset the game. 100 rooms and related links take some time when generated on the fly. Once I have finished the scripts for room content auto-generation, I'll try to make 100x100 world, then 1000x1000 world and probably crash my pc in the process 8-)
Anyhow, big THANKS for the NewLink().
G
Cris - August 24, 2007 10:06 AM (GMT)
I agree on the need of a snippet of code.
If you can send me (or even better, publish somewhere) the source code I can get some piece of it and place in the devref.
Let me know what are the limits, this is interesting to me to know.
Cheers
Gumbro - August 25, 2007 02:14 PM (GMT)
All right, let's see how it goes. The script is pretty ugly at the moment, so let me finish it first.
I also have each room scene picture setting according to the links out of the room. This makes it possible to auto-generate a whole dungeon, city or whatever is needed. If there is no link to north, there is a wall to north, and so on.
So far I've tested generating a modest 1000 room area and actually got it running. For a few minutes. Apparently, my pc overheated itself during the room generation and after a while decided to shut itself down.
So yeah, I crashed my pc!
G
Cris - August 26, 2007 07:54 AM (GMT)
Gumbro - August 27, 2007 04:05 PM (GMT)
With improved cooling, I got 70x70 = 4900 rooms running. Takes approx. 5 minutes to generate it. 100x100 is not possible on my system, at least not now.
Once the rooms have been generated the game runs without any apparent lag. It's as responsive with 100 rooms as with 4900.
Not bad, huh?
G
Cris - August 28, 2007 12:15 PM (GMT)
Yes. Look, I've seen DimensioneX running much faster with Java 1.5 than with Java 1.6
Which Java are you using?
Gumbro - August 28, 2007 03:45 PM (GMT)
Currently Java 1.5.0_11-b03.
The code is not optimized for speed and is pretty ugly, which may be a factor here. It generates the rooms, makes up to four links out of each room to the neighbouring ones, and selects room background images according to the links out of the rooms.
The end product of the script is a platformer like, 3rd person, world.
Here's a code snippet for the rooms:
| CODE |
Dim rows = 70 Dim cols = 70 Dim row = 0 Dim col = 0 Dim temp = 0 Dim temp2 = 0
'Create rooms col = 1 row = 1 For temp = 1 to rows Call makerowrooms(temp2,cols,row,col) col = 1 row = row + 1 Next
SUB makerowrooms(temp2,cols,row,col) 'Create one row of rooms For temp2 = 1 to cols Dim roomfrom = "room_" + row + "_" + col NewRoom(roomfrom) roomfrom.mapx = col roomfrom.mapy = row col = col + 1 Next END_SUB
|
Hey. That looks almost tidy. For links it's a real mess.
G