Archived

This topic is now archived and is closed to further replies.

Making a scripting engine/console

This topic is 5463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I''m making a 3D game engine, and I''ve got some nice features now. My problem is I want to let other people of my programming team use the engine as well, for map/model testing etc. Since they cannot program/compile and stuff I want to make a console so they can load in maps, models, etc. Commands will be pretty basic first (as in ''loadplayermodel /models/model.mod'', ''loadmap /maps/map.map'', etc.) but later I want to use the scripting system for the game itself, so it should also be able to do more complicated things. I have absolutely no experience for console/scripting programming, and I don''t know where to start. A good thing would be if I knew how to display and read in what the user types (the console thingy. I want the player to be able to type something and the console should display that and check the input) Also I am not sure how to do the scripting system so that it''ll still be fast if I add lots of commands. Now, are there any good articles/tutorials on this, or do you have advice for me? Anything is welcome BTW I''m using OpenGL/C++ | Panorama 3D Engine | Contact me | | MSDN | Google | SourceForge |

Share on other sites
Im going to use lua for mine, an example of how a command might look with lua...

SpawnPlayerModel(location,"somemodel.3ds");

or something like that

This function would be part of a real engine function but with a lua interface for it...

//an example...int l_SetPlayerLocation(lua_State* l){  PlayerEntity.Set_Location(lua_tonumber(l,1),lua_tonumber(l,2),lua_tonumber(l,3));	return 1;}bool InitAll(){         lua_register(lua,"SetPlayerLocation",l_SetPlayerLocation);}

Theres a great article here on game dev about lua,
I would suggest reading it. you could also check out the script
/ mods etc forum.

The console part would be a matter of handling input and displaying text on some sorta window, or quad...

This is how I plan on doing mine, so im not sure if its gonna work perfect, but in thoery is should.
good luck.

Share on other sites
I completed my console a couple of days ago, using Lua. It''s networked, so you can connect to it from a different computer to execute commands while the program is running fullscreen (I have a terminal on my desk exclusively for doing this). Really useful stuff.

How appropriate. You fight like a cow.

Share on other sites
ps.

Lua is VERY fast in my opinion and is easy to work with.
A bit of a pain to get installed on your system though.

Basicly, you need to make a basic text editor for the console.
I havent actually done this yet though.

Hmm, theres a good tut at
http://www.ultimategameprogramming.com/
(for a small fee though)

look under GL and I think DX tutorials as well for it.

Share on other sites
ok, seem good. But I''d rather make my own, instead of using another scripting engine. This is my first engine, and my goal is to do everything myself to learn as much as I can from it. So I''ll only use some pre-made scripting system if I really can''t figure out myself.

| Panorama 3D Engine | Contact me |
| MSDN | Google | SourceForge |

Share on other sites
There is a great book called ''Game scripting mastery'' which
shows you how to build a C like scripting language from the
ground up, with compiler, assembler, and a VM. There is two
chapters on command based scripting to, but that is really
simple stuff. It also teaches you how to use existing languages
like LUA, Python, and TcL. By the end of the book you will have
a scriping language which you can customize in every way
possible to fit you engine (think mod development).

• 32
• 12
• 10
• 9
• 9
• Forum Statistics

• Total Topics
631349
• Total Posts
2999467
×