Too many Variables

Tips, techniques and tutorials about creation tools.

Too many Variables

Postby sylakone2 » Sat, 16Nov12 02:10

Hey guys

So I have been working on a game for quite a while and I'm probably only a quarter of the way through it but already I have so many variables.
I am trying to work out how I can simplify the code as it is getting hard to keep track of everything.
I am using the WBA engine that Soulmate made which is javascript based.

Since this game has a lot of the aspects like the Lop Games.
There is so many variables now the standard stats one is not so hard.
It is all of the on off switches I need for so many things which are dependant on the time of day or the ATT of the Girls, etc.
Then a lot of actions like buying clothes chatting and so on.
Then there is all of the events which trigger based on ATT levels.
There are so many switches during the events for different actions and responses as well.

Any Ideas on how to simplify?

Thanks for any ideas.

Cheers

Sy
Cheers Sy
User avatar
sylakone2
lagoon predator
 
Posts: 224
Joined: Mon, 12Jan09 13:08
Location: Australia, SA
sex: Masculine

Re: Too many Variables

Postby tlaero » Sat, 16Nov12 05:05

Is the problem that you can't keep track of them all, or that the engine isn't allowing you to have enough?

One thing I do in my games is to pack a bunch of on/off variables into a single "events" variable using bitwise math. I can teach you how to do that, and you can use the functions in AC/AC2 if you'd like. But that'll only help if it's that the engine isn't allowing you to have enough. If the problem is that you can't keep track of them all, then packing them into another variable just makes it more complex, not easier.

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1829
Joined: Thu, 09Jun04 23:00
sex: Female

Re: Too many Variables

Postby sylakone2 » Sat, 16Nov12 11:05

Cheers Lady Tlaero

No the engine can handle it.
It just I seem to be getting more and more variables so now the code is very complex.
Usually I can keep track of it but sometimes I get into loops jut trying different ways to simplify the code so less possibility of bugs.
With so many variables when i hit a bug it's a lot harder to work out what's causing it.

Ahh the paradox of choice lol.

It is all good I will keep working at it.

Cheers

Sy
Cheers Sy
User avatar
sylakone2
lagoon predator
 
Posts: 224
Joined: Mon, 12Jan09 13:08
Location: Australia, SA
sex: Masculine

Re: Too many Variables

Postby GDS » Sat, 16Nov12 13:17

sylakone2 wrote:Cheers Lady Tlaero

No the engine can handle it.
It just I seem to be getting more and more variables so now the code is very complex.
Usually I can keep track of it but sometimes I get into loops jut trying different ways to simplify the code so less possibility of bugs.
With so many variables when i hit a bug it's a lot harder to work out what's causing it.

Ahh the paradox of choice lol.

It is all good I will keep working at it.

Cheers

Sy

I ran on this problem too, mostly on the RPG games(1000s of VAR) not the erotic ones,

You need to try different ways until you find one that work for you,
for me: I created very specific and long VAR names to help me keep track and remember,
and as Tlaero said I created and stored then on a control.OBJ(Common practice when doing this kind of programing)
an example of my code:
Code: Select all
//chap 3
G.c03_alchool_level = 0
G.c03_looked_at_loa = false
G.c03_looked_at_eli = false

//chap 4
G.tried_to_look_eli_panty = false
G.talked_about_eli_panty = false
G.started_with_true = false
G.think_about_car = false
G.think_about_loa = false
G.think_about_eli = false
G.think_about_sus = false
G.let_touch_dick_car = false
G.let_touch_dick_loa = false
G.talked_with_car_after_her_touching = false
[*]Suddenly a Party!:http://the-new-lagoon.com/viewtopic.php?f=3&t=3965
[*]Matt and the Bus stop Girl:http://the-new-lagoon.com/viewtopic.php?f=3&t=3666
User avatar
GDS
lagoon predator
 
Posts: 165
Joined: Sat, 16Jan02 12:36
sex: Masculine

Re: Too many Variables

Postby sylakone2 » Sat, 16Nov12 14:06

GDS wrote:
sylakone2 wrote:Cheers Lady Tlaero

No the engine can handle it.
It just I seem to be getting more and more variables so now the code is very complex.
Usually I can keep track of it but sometimes I get into loops jut trying different ways to simplify the code so less possibility of bugs.
With so many variables when i hit a bug it's a lot harder to work out what's causing it.

Ahh the paradox of choice lol.

It is all good I will keep working at it.

Cheers

Sy

I ran on this problem too, mostly on the RPG games(1000s of VAR) not the erotic ones,

You need to try different ways until you find one that work for you,
for me: I created very specific and long VAR names to help me keep track and remember,
and as Tlaero said I created and stored then on a control.OBJ(Common practice when doing this kind of programing)
an example of my code:
Code: Select all
//chap 3
G.c03_alchool_level = 0
G.c03_looked_at_loa = false
G.c03_looked_at_eli = false

//chap 4
G.tried_to_look_eli_panty = false
G.talked_about_eli_panty = false
G.started_with_true = false
G.think_about_car = false
G.think_about_loa = false
G.think_about_eli = false
G.think_about_sus = false
G.let_touch_dick_car = false
G.let_touch_dick_loa = false
G.talked_with_car_after_her_touching = false


Thanks GDS

Yeah I have been playing with a few differnet ways which seems to have worked for the last problem.

Still oads to do I think I have a better way of doing the code that I ahve in the past.
A lot of it is still working out what the Engine I am using can and can't do.

Cheers

Sy
Cheers Sy
User avatar
sylakone2
lagoon predator
 
Posts: 224
Joined: Mon, 12Jan09 13:08
Location: Australia, SA
sex: Masculine

Re: Too many Variables

Postby SoulMate » Sat, 16Nov12 23:08

I agree with GDS that naming vars is a good way to organize them.

For example:
characternameX__stats__like
characternameY__stats__like
characternameX__clothes__jacket
buildingX__doorX__locked
roomY__dog__seen

In the dashboard tab there is a list of used variables and a button to show on what pages this variables is used. This may come in handy.

As for testing:
There is an option in debug.html that let you run automated tests, although it's not well documented.
You can add a file tests.js next to custom.js with the contents:
Code: Select all
window.game_tests = [{
    title='characterXEnd1',
    sequence=['page1', 'page2', 'pageGreetX', 'chatpage', 'pageEnd'],
    vars=[
        {variable='characterX__love', value='5'}
    ]
}, {
    title='characterYEndFail',
    sequence=['page1', 'page2', 'pageGreetY', 'pageFail'],
    vars=[
        {variable='characterY__love', value='1'}
    ]
}];


If there is anything i can help you with, let me know. WBA can be extended with new functionality to ease the creating of games.
SoulMate
great white shark
 
Posts: 79
Joined: Wed, 14Apr23 17:56
sex: Masculine

Re: Too many Variables

Postby sylakone2 » Thu, 16Nov24 22:41

Hey Soulmate

It is good to see you again I have not seen you on here for a while.

I was worried you had left us for good.

i am glad to see you back.

I will definitely take a look at that option in Debug.html

With Redirect pages I noticed that we are not able to put in like an else redirect.

So what I mean is I have to have at least one variable for each redirect.

Is there a way that those redirects can do like an else command?
So if none of the above variables are triggered it will go to this page for instance?

We had a lot of issue with one of our redirect pages in Envying Celina because of this which caused a game breaking bug.

Anyway if you need more info on this let me know.

Cheers

Sy
Cheers Sy
User avatar
sylakone2
lagoon predator
 
Posts: 224
Joined: Mon, 12Jan09 13:08
Location: Australia, SA
sex: Masculine

Re: Too many Variables

Postby SoulMate » Mon, 16Dec12 19:40

Hey Sy,

If the last redirect has no restrictions it functions as an else.

The way WBA redirects works is that it loops over all the redirects and execute the first valid redirect.
SoulMate
great white shark
 
Posts: 79
Joined: Wed, 14Apr23 17:56
sex: Masculine

Re: Too many Variables

Postby sylakone2 » Tue, 16Dec13 12:26

thanks Soul

i will try that and see if it works as expected.

I think I have tried it before but it didn't work.

Anyway I give it another try.

Also on some possible ways to improve the engine.

Is it possible to change the engine so it can support multiple folders for the images?

One thing that slows down my workflow is searching through all the pictures I have to find the one I need.

Cheers

Sy
Cheers Sy
User avatar
sylakone2
lagoon predator
 
Posts: 224
Joined: Mon, 12Jan09 13:08
Location: Australia, SA
sex: Masculine

Re: Too many Variables

Postby SoulMate » Tue, 16Dec20 19:49

Multiple image folders is not possible at the moment.

It's not as easy as it looks because the browser sends only the filename (not the path) for security/privacy reasons.
For this to work i have to ask the creator each time in which folder the image is coming from.
I'll keep the question definitly in mind and hopefully can spend some time on implementing it in future versions.
SoulMate
great white shark
 
Posts: 79
Joined: Wed, 14Apr23 17:56
sex: Masculine

Re: Too many Variables

Postby tlaero » Tue, 16Dec20 20:37

One potential solution is to add the ability to filter down the picture list to make them easier to find. In AC2, I frequently filter to "Unused" pictures so I can quickly find the ones Mortze just sent me. I also sometimes filter to a string like "office*" if I'm looking for an office picture. I also make it easy to synchronize the current picture to the current page. That lets me jump to a page and start using the pictures in order from there.

Sylakone, make sure you use good names for the pictures. Start the names of all of the pictures from a scene with the name of the scene (office1.jpg, office2.jpg, for the office scene, etc).

Tlaero
User avatar
tlaero
Lady Tlaero, games and coding expert
 
Posts: 1829
Joined: Thu, 09Jun04 23:00
sex: Female

Re: Too many Variables

Postby sylakone2 » Thu, 16Dec29 15:42

Thanks for the tips Tlaero

I will keep that in mind.

Cheers

Sy
Cheers Sy
User avatar
sylakone2
lagoon predator
 
Posts: 224
Joined: Mon, 12Jan09 13:08
Location: Australia, SA
sex: Masculine


Return to The workshop of creators

Who is online

Users browsing this forum: No registered users and 7 guests

eXTReMe Tracker