Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Is it possible...
Old
blue_dtctive
Guest
 
Status:
Posts: n/a
Default Is it possible... - 05-10-2008, 09:07 PM

Hi i want to make an adventure math game for my final project. All i want to ask are:
- Can the user save the game when tired of playing?
- How to make a database in alice?
- Is it possible to make the .exe or .java program?
Thank you very much
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 05-10-2008, 10:09 PM

Quote:
Originally Posted by blue_dtctive View Post
Hi i want to make an adventure math game for my final project. All i want to ask are:
- Can the user save the game when tired of playing?
- How to make a database in alice?
- Is it possible to make the .exe or .java program?
Thank you very much
- Can the user save the game when tired of playing?
I don't think so, but someone else may have other ideas on this.

- How to make a database in alice?
You can create arrays and lists, but as far as I know, you cannot write them out to disk files.


- Is it possible to make the .exe or .java program?
It is possible to write your world into a java applet, but my experience is that it is so large as to be impractical.

Wish I had better news for you.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free Scratch tutorials: http://www.dickbaldwin.com/tocHomeSchool.htm
Free Java/C#, etc. tutorials: http://www.dickbaldwin.com/toc.htm
   
Reply With Quote
Old
groucho
Guest
 
Status:
Posts: n/a
Default 05-11-2008, 06:32 AM

Quote:
Originally Posted by blue_dtctive View Post
- Can the user save the game when tired of playing?
- How to make a database in alice?
Although I know no direct way to save a game, you can use Alice's "save object ..." feature as a workaround.

In your world, make a separate object (say "savedGame") that contains all information about the game you want to save in class level variables. When finished playing, save that object using the "save object ..." method in the object tree.

When playing again, first delete the original "savedGame" object and import the saved one (if you do not delete the original object first, the new object will be renamed savedGame2 - if that happens you can still delete the original object and rename the newly loaded one).

After that, you can use the information from your savedGame object in your world.
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 05-11-2008, 10:16 AM

Quote:
Originally Posted by groucho View Post
Although I know no direct way to save a game, you can use Alice's "save object ..." feature as a workaround.
Could you post an example. When I try to use this to save information from in-game activities, all of the parameters get reset to their default values when the game (and thus the world level method) ends (as in the attached example).

While you could obviously record the parameters manually (or to a text output file with the "print" function) before ending the game, you still have to reset their default values to replay the game. This does works - after a fashion - but I'd like to see a better solution (such as saving an object without ending the world level method) if you have one.
Attached Files
File Type: a2w BookName.a2w (202.1 KB, 105 views)

Last edited by DrJim; 05-11-2008 at 10:24 AM. Reason: Added print/text output note.
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 05-11-2008, 12:28 PM

Quote:
Originally Posted by DrJim View Post
Could you post an example. When I try to use this to save information from in-game activities, all of the parameters get reset to their default values when the game (and thus the world level method) ends (as in the attached example).

While you could obviously record the parameters manually (or to a text output file with the "print" function) before ending the game, you still have to reset their default values to replay the game. This does works - after a fashion - but I'd like to see a better solution (such as saving an object without ending the world level method) if you have one.
If you save the important game values as property values in an object, and then manually save that object before terminating the program, you can manually import that object the next time you run the program and the values that you saved will be intact.

However, you probably need to delete that object before terminating the program the first time. Otherwise, when you restart the game and import the object, it will get a new name, which will not be compatible with existing code. Unfortunately, deleting an object that is referenced by code will cause some difficulties as well.

There are some object naming issues with regard to the names of the object in the code that saves the values as properties prior to termination unless you are going to save them manually. I suppose there may be a way around this manual effort, but right off hand, I don't see what it is.

Like you, I would like to see an example program that accomplishes this objective with a minimum of manual effort on the part of the player of the game. Hopefully we will see something really slick here.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free Scratch tutorials: http://www.dickbaldwin.com/tocHomeSchool.htm
Free Java/C#, etc. tutorials: http://www.dickbaldwin.com/toc.htm
   
Reply With Quote
Old
groucho
Guest
 
Status:
Posts: n/a
Default 05-11-2008, 03:30 PM

Quote:
Originally Posted by DrJim View Post
Could you post an example. When I try to use this to save information from in-game activities, all of the parameters get reset to their default values when the game (and thus the world level method) ends (as in the attached example).
DrJim, you are right. I only checked that you can save and import a saveGame object, but, as you say, you don't have access to that object while the world is running and its property values are reset when the world ends. So my idea does not work. Sorry for that.
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 05-11-2008, 05:00 PM

Quote:
Originally Posted by DickBaldwin View Post
If you save the important game values as property values in an object, and then manually save that object before terminating the program, ...
That is the step I can't figure out how to do. I can't find a command to save the object from within an executing program and I can't access the object tree commands while a program is executing.

Re:
Quote:
So my idea does not work.
I wouldn't go so far as to say it doesn't work at all. Especially if you do a print step when the values are what you want to save - say at the end of a game or after stretching and moving an object - this is a useful approach. It just takes some manual intervention.

Also, I think that the Jython scripting functions probably work well enough to do the input portion of this, since it only involves parameters for a single object. I've actually used the web text I/O script referenced elsewhere in the forum and it does - or at least did - work. However I'm sure there are both object and file naming restrictions, as Dick indicated, and I really am not enough of a programmer to try that. If it could be made to work, however, that would leave only the editing of a text file to do manually.
   
Reply With Quote
Old
blue_dtctive
Guest
 
Status:
Posts: n/a
Default 05-14-2008, 09:56 PM

Thanks for the information! I will split my game into some mini game until i know how to save the game Also thanks about "saved object", i think i will use it in my game
   
Reply With Quote
Old
blue_dtctive
Guest
 
Status:
Posts: n/a
Default 05-14-2008, 10:00 PM

Question again
I have a finished .a2w game, how to convert it to .java?
How big is the size of the program if i convert the extension .a2w to .java?
   
Reply With Quote
Old
nick10492
Guest
 
Status:
Posts: n/a
Lightbulb 05-31-2008, 03:32 PM

You can't do an actual save, but you can give the user a code for each level and in the beggining ask them if they have the code and if they do take them to that level
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.