strings?

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
turshija
Posts: 127
Joined: Sat Feb 17, 2007 9:26 am
Location: Novi Sad, Serbia
Contact:

strings?

Post by turshija »

Weird thing we still don't have strings in ZGE ?
I don't think it would be that hard to implement ...
some DefineString component, with its functions, that can be used in RenderText would be useful for any score keeping, and about reading strings, it can be hacked somehow to make it easy ... :)
You can make KeyPress component, name it Keyz, put "abcdefghijklmnopqrstuvwxyz" in it and put ZExpression with something like

Code: Select all

myString = strCat(myString, char(Keyz.Keyindex + 65));
, or to make it simplier (if possible) just make possibility of adding strings like numbers:

Code: Select all

myString = myString + char(Keyz.Keyindex+65);
Most needed operations with strings are:
length(string),
concatenate(string1, string2),
substring(string, starting_possition, ending possition) and
string compare(string1, string2) ...

example if we pressed backspace we would do something like:

Code: Select all

t = strLen(myString);
myString = substring(myString,1,t-1);
Hopefully this can happen in ZGE, and I'm sure it will help JPH, coz he is always whining about saving scores and inputting name (dunno if he managed to do that somehow)... :P :)
User avatar
VilleK
Site Admin
Posts: 2355
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

As I'm currently evaluating the physics engine by BeRo, I will also take a look at his scripting engine which supports strings and many other features. So we'll see what will come out of that.
User avatar
Kjell
Posts: 1915
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi turshija,

Scores are more commonly tracked using integers or floats instead of strings. Also if you want a way to currently store names / strings, just use a array. For turshija you could for example store 116, 117, 114, 115, 104, 105, 106, 97 when using a full ASCII map. Only downside is that you cannot use the Font Component, but must calculate the Texture Scale and Coordinates of your Font Material yourself.

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

,.he is always whining about saving scores and inputting name,..
what? always whining, I think I mentioned it like once, and only in passing,. . anyway. :P


Yes, strings are a good idea, suppose they would come in with the scripting engine,. . as much as I like to keep the games tinny, I am not opposed to "ZGE the tool for 256kb games!" lol.., I just like the idea of procedural generaton when possible, and not needlessly bloated distributions. For instance, I d/led a demo today that was 50+mb,. and the 'demo' although looking and sounding very nice,. contained all of 10 minuets play time,. in fact many games these days are over 50mb and I think that is way too large for what most do, and many are 900mb, Left 4 Dead is like 3000MB! crazy! Cant these guys use some restraint,. I mean there are several very good pro-level procedural texture tools/lybraries around,. geez.
iterationGAMES.com
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Kjell I gave your idea for defining text from ascii numbers a go however I just am just not seeing any useable method of implementing it,. you still would seemingly need 28 materials,. and loads of conditions in the rendering just to get it functioning,. am I missing a simpler way ?? have you actualy done this ?

I think I will wait for strings before doing a high-scores table in lockOn,. just as well,. I really do need to get moveing on other projects.
Attachments
font_from_ASCII.zgeproj
just a test,.
(1.59 KiB) Downloaded 756 times
iterationGAMES.com
User avatar
Kjell
Posts: 1915
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi jph,

You missed a trick yea :) Create a texture containing all the characters you'd like to use similar to what you'd do for a Font, but instead put them all on one line above* or next to each other ( for convenience ). Then set the Material's TextureScale to the dimensions of a single character and offset the Texture using TextureX/TextureY each character render pass to the desired character. This approach is not all that different from what the RenderText component does internally, but it enables you to work with integers instead of strings.

Good luck ~
K

*Above is desired when you want to scroll between characters vertically during name entry like you used to see in arcade games.
User avatar
VilleK
Site Admin
Posts: 2355
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Once again I got to say you guys come up with the most wonderful tricks to overcome ZGE's limitations :) . I would have thought it wasn't possible at all.
I can't promise strings in scripting soon so Kjell's technique is the best way to go at the moment.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

I'm still not getting it,. I been out of beer monies,. think my mind stops working without that fuel,.
The material will only render ONE textureX setting per render event,. seemingly. I can see how it should work in theory,. however in practical useage,. it still looks like you would need a seperate model or material for each letter and that seems unweldy to me.
Attachments
font_from_ASCII_2.zgeproj
tried in a loop,.
(1.84 KiB) Downloaded 708 times
iterationGAMES.com
User avatar
Kjell
Posts: 1915
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Yo jph,

I'll put together a example for you .. keep your eyes on the Tips'n'Tricks section :wink:

K
User avatar
VilleK
Site Admin
Posts: 2355
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Perhaps why should start a fund-raiser for donating money to help Jph's beer supplies ;)

I can see there being a problem though, ZGE optimize materials so that if you use the same material it does not send all values to OpenGL again, or even test if they are changed. This is a huge time-saver when rendering hundreds of identical objects. Maybe use a technique where you set the texturecoordinates with a RenderNet instead.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

drat!

Post by jph_wacheski »

Haha! yeah, just send money, there is a link on my site! but really this is the reason I need an income,. food, and beer are just things I need to keep going,. without those sadly I die,. . :( Still lookin to move to an artist run permaculture eco-village,. (split time between farming/building and game/art making) saddly again none seem to in existance,. yet. must be ahead of my time,. again. stupide space-time continum,. Doh!

I will look into the net rendering idea,. but I have already wasted most of today beating my head against this wall,. and I don't really care about saving scores anyway,. it was just a 'nice' idea that perhaps other people would like,. for me, one highscore per machine is plenty,. just to keeps track of the best played game.

oh well, as I am gettin' tired now I think I will go chillax a bit,. and hopefully finnalise this lockOn release tomorow.., still gota do the web site work,. .
iterationGAMES.com
Post Reply