Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,238 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 3
Pointers,execute() and code changing after PUBLISH #56924
10/05/05 01:52
10/05/05 01:52
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Hi !
Sorry for big example , but I don't know how to explain it better than with working sample (4 parts in RAR ~1.5Mb).
This sample covers:
-using pointers (especially material and function one) for creating levels on the fly;
-execute() command for creating user defined level file (yes, for published game), look at Orange Brat's awesome camera code. With that camera and this example you can provide level editor even with A6 comm
-trick with execute() to provide user redefinable actions (yes, for published game).

In archive:
File LEVEL01.LVL is a plain text file, that describe user game level (game 'Skeleton Inc.' from AUM). You can modify it.
File USERPROC.TXT is a plain text file but with C-script syntax . It's a user actions for objects defined in level file. You can modify it.
For code and comments look at SKINC.WDL
That's all.
EDIT:
Sorry for very short description, but I coded that at night (4am)
Idea is simple:
to build 'loading engine' for our level file. We can produce WMP format (it's isn't complicated), but our customers can't compile them. So we define our plain text format for game map. Each line is a name_of_prefab, X_coord, Y_coord, name_of_action. I separate these fields by '|' (I want to use comma in comments ). Prefab may be .WMB or .MDL. In my game proj I'm using more types, just rewrite function load_level_ent(fhandle,fsection):
Code:

...
//prepare model file name
str_cat(temp_model, ".wmb");
if (!file_exists(temp_model)) {
str_trunc(temp_model,4);
str_cat(temp_model, ".mdl");
if (!file_exists(temp_model)){
return(-1); //return ERROR if can't find prefab
}
}
...


X and Y coords is an 'imagine' coords (like in 'sea war' game, that i played in school many years ago)
Name_of_action is a real name of function or action, defined in your script.
I divide level file in sections just for clarity, you haven't to do this...
Functions load_my_level(name_of_level) and load_level_ent(fhandle,fsection) does all work (look at their sources, I placed comments a little):
-read level file line by line;
-create entitiy at needed position and assign action to it;
-fill arrays with handles to our entities (you can use these arrays for group operations over entities, look at function purge_level);
-assign some skills to entities (I place index in array into skill MY_INDEX, sorry but forget to define it with define MY_INDEX, skill10; in define.wdl. This can be used, when you kill entity, you have to place 0 at entity's place in array, to avoid crashes in function purge_level);
In sources you can find 10-20 bugs, I hope. But this doesn't matter. I coded it to show general idea.
And for last, to provide user editable actions I'm using trick (showed by me in thread about 'User resources in ZIP'):
Code:

execute("return;} include <userproc.txt>;");


I know that is a trick, so it have to be tested more deeply. Anyway it's working. Try it.
Any comments ?
P.S.
As usually, sorry for my English

Re: Pointers,execute() and code changing after PUBLISH [Re: Lion_Ts] #56925
10/05/05 22:27
10/05/05 22:27
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
No comments I lost motivation

Re: Pointers,execute() and code changing after PUB [Re: Lion_Ts] #56926
10/05/05 23:29
10/05/05 23:29
Joined: Jul 2002
Posts: 2,813
U.S.
Nadester Offline

Expert
Nadester  Offline

Expert

Joined: Jul 2002
Posts: 2,813
U.S.
Thanks for the contribution! Don't lose motivation, I always enjoy seeing your stuff


--Eric
Re: Pointers,execute() and code changing after PUB [Re: Nadester] #56927
10/05/05 23:38
10/05/05 23:38
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Nadester, really ?
THANK YOU.
EDIT:
How about idea to cheat c-script interpreter with execute() to provide editable file ?

Last edited by Lion_Ts; 10/05/05 23:42.
Re: Pointers,execute() and code changing after PUB [Re: Lion_Ts] #56928
10/06/05 04:22
10/06/05 04:22
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
This is an interresting idea.
Thanks very much for contributing this.
Your contributions are always helpfull.

Re: Pointers,execute() and code changing after PUB [Re: Lion_Ts] #56929
10/06/05 08:58
10/06/05 08:58
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Quote:

No comments I lost motivation




Sorry, forgot to respond!

I think it is really useful!
It is a pity that I won't have time to implement it within my game! But I always welcome your contributions as useful professional additions that increase the value of a any game that takes use of it!

Thanks a lot!

Re: Pointers,execute() and code changing after PUB [Re: Pappenheimer] #56930
10/06/05 11:12
10/06/05 11:12
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Thanks. My motivation comes back

Re: Pointers,execute() and code changing after PUB [Re: Lion_Ts] #56931
10/08/05 23:09
10/08/05 23:09
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
2All:
Can't understand, thread about 200 skills spowns big activity, but this one (really usefull as for me) no

Re: Pointers,execute() and code changing after PUB [Re: Lion_Ts] #56932
10/09/05 15:15
10/09/05 15:15
Joined: Aug 2003
Posts: 275
Germany
kopitzki Offline
Member
kopitzki  Offline
Member

Joined: Aug 2003
Posts: 275
Germany
You rule, ne shoochoo!

Re: Pointers,execute() and code changing after PUB [Re: kopitzki] #56933
10/09/05 22:39
10/09/05 22:39
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
kopitzki, ne shoochoo ???
Are you ruussian ?


Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1